You're getting double password prompt because your /boot
partition is encrypted. First, GRUB prompts for password because it needs to load the kernel from encrypted /boot
. Then kernel prompts for password again to decrypt /
.
There are two approaches to this problem:
Don't use encrypted /boot
. GRUB won't ask for password. This will allow anyone tinker with kernel and initramfs files. For example one could replace kernel with a malicious one that accesses your encrypted /
once you enter the password.
Create an decryption key and add it to a free LUKS slot on /
, then embed that key in initramfs. This will let the kernel access /
without password.
The setup for #2 is quite complicated, so I'll go with the former approach. I'm typing this from the top of my head, without any testing. Make backups and proceed carefully. I'm not responsible for any data loss and other issues caused by this process.
You'll need a bootable Linux media with cryptsetup
and resize2fs
. I'd recommend using Ubuntu flash drive. You can also replace the latter with partclone
. You'll also need about 500 MB of free disk space to store intermediate decrypted /boot
image.
Boot from your Linux media. Access the LVM (honestly, I've never dealt with it, so I have no idea if any additional steps are necessary - there's a possibility that Ubuntu will deal with this automatically). Open the encrypted /boot
:
cryptsetup open /dev/<boot> cryptboot
Make an image of unencrypted boot: (to see progress use pv
instead of cat
)
cat /dev/mapper/cryptboot > /media/ubuntu/<someExternalStorage>/boot.img
Close /boot
:
sync
cryptsetup close cryptboot
Write unencrypted /boot
to the partition and adjust filesystem size:
cat /media/ubuntu/<someExternalStorage>/boot.img > /dev/<boot>
resize2fs /dev/<boot>
Get UUID of /boot
(take a note of it):
blkid /dev/<boot>
Open and mount /
, update fstab
:
cryptsetup open /dev/<root> cryptroot
mkdir -p /mnt/root
mount /dev/mapper/cryptroot /mnt/root
cd /mnt/root
vi etc/fstab
Adjust the line that mounts /boot
to use the new UUID instead of /dev/mapper/...
entry. You may also have to remove /boot
line from etc/crypttab
.
Update initramfs (this one may break in Ubuntu if your main OS is Arch... I'm not sure, so just be careful):
cd /mnt/root
mount -t sysfs sysfs sys
mount -t tmpfs tmp tmp
mount -t proc proc proc
mount --bind /dev dev
mount /dev/<boot> boot
mount --bind /boot/efi boot/efi
chroot
update-initramfs -u -k all
exit
As far as I remember that should suffice. You can also simplify GRUB config by disabling encrypted boot in its configuration files. It can speed up booting slightly, but isn't necessary.
Clean up after yourself:
umount boot/efi boot dev proc tmp sys
cd ..
umount root
cryptsetup close cryptroot