Upgrading Ubuntu 12.04 to 14.04 breaks encrypted LVM
My laptop runs Ubuntu and is fully encrypted (since version 10.04). Upgrade from 10.04 to 12.04 was smooth in the sense that my system booted fine, asking for the passphrase to unlock the LVM. However, when I upgraded from 12.04 to 14.04, things broke and my laptop no longer booted properly as the LVM never got encrypted. I had to do the following to get my laptop working again (after many rounds of trial and error):
- Boot a live usb Ubuntu session, de-crypted the LVM, and chroot'ed to run as the original OS
- Finish the upgrade session via
apt-get update && apt-get upgrade
- It appears Ubuntu 14.04 installed some new package (did not write name down) that manages LVM or disks somehow (based on googling the error message). I removed this package.
- Saw
lvm
issues, so installed the packagelvm2
- I made sure both
dm-crypt
andlvm2
were installed, and were accessible ininitramfs
, ascryptsetup
was removed frominitramfs
since version 13.10. Had to do something with the following CRYPTSETUP issue. - Based on this post, I modified various files, but things still did not boot properly. I believe what finally fixed it was explicitly pointing to the LVM by
/dev/sda5
in theGRUB_CMDLINE_LINUX
line in/etc/default/grub
.
The following is summary of these files for me. /etc/crypttab
:
# <target name> <source device> <key file> <options>
# sdb5_crypt UUID=731a44c4-4655-4f2b-ae1a-2e3e6a14f2ef none luks
sdb5_crypt UUID=731a44c4-4655-4f2b-ae1a-2e3e6a14f2ef none luks,retry=1,lvm=vg01
/etc/initramfs-tools/conf.d/cryptroot
:
## vinh created http://www.joh.fi/posts/2014/03/18/install-ubuntu-1310-on-top-of-encrypted-lvm/
# CRYPTROOT=target=sdb5_crypt,source=/dev/disk/by-uuid/f1ba5a54-ac7e-419d-8762-43da3274aba4
CRYPTOPTS=target=sdb5_crypt,source=UUID=f1ba5a54-ac7e-419d-8762-43da3274aba4,lvm=vg01
Then run update-initramfs -k all -c
in order to update the initramfs
images.
Have this line in /etc/default/grub
:
#GRUB_CMDLINE_LINUX="cryptopts=target=sdb5_crypt,source=/dev/disk/by-uuid/f1ba5a54-ac7e-419d-8762-43da3274aba4,lvm=vg01"
#GRUB_CMDLINE_LINUX="cryptopts=target=sdb5_crypt,source=UUID=f1ba5a54-ac7e-419d-8762-43da3274aba4,lvm=vg01"
GRUB_CMDLINE_LINUX="cryptopts=target=sdb5_crypt,source=/dev/sda5,lvm=vg01"
Run update-grub
.
Again, I think the key is the source
definition in the previous line. I kept trying to refer to it by uuid
but that did not work.