Ask your questions here.
Post a reply

Reinstall grub from livecd with luks encrypted volumes

Thu Oct 23, 2014 7:48 am

I had:
/boot unencrypted on /dev/sdb5
/ encrypted on /dev/sdb6

Grub screwed up and it was not obvious how to restore it, pointing it to an encrypted volume. Here is how I rescued the system. I post it as a reference if somebody has the same problem.

# Run the livedvd distro
# If encrypted volume was not opened (next 4 lines):
lsblk --fs # List Luks devices
cryptsetup luksClose root_fs # root_fs is the encrypted partition name
mkdir /mnt/system
cryptsetup luksOpen /dev/sdb6 root_fs
ls -la /dev/mapper/root_fs # root_fs is the encrypted partition name and should appear here
# If you don't have lvm2 on your livecd (next 5 lines):
apt-get install lvm2
vgscan
vgchange -ay
lvscan
ls /dev/mapper/ # See the situation
# If encrypted volume is open
mount /dev/mapper/root_fs /mnt/system/
#mount /dev/mapper/root_fs-home /mnt/system/home/
mount /dev/sdb5 /mnt/system/boot/
mount -o bind /dev/ /mnt/system/dev/
mount -o bind /proc/ /mnt/system/proc/
mount -o bind /sys /mnt/system/sys/
chroot /mnt/system
grub-install /dev/sda
update-grub

Re: Reinstall grub from livecd with luks encrypted volumes

Thu Oct 23, 2014 5:01 pm

Why do you first luksClose root_fs, then mkdir a directory, and then luksOpen root_fs again?
Seems superfluous.

The name you pick, in your case root_fs must be in line with the entires in fstab and crypttab, both in etc
I think.

Just thinking out loud, rather asking then telling.

Thanks too.
You might wanna add your how-to here:
cryptsetup-t195.html
if you like.

Re: Reinstall grub from livecd with luks encrypted volumes

Thu Oct 23, 2014 7:02 pm

Yes, superfluous to close, then open again.

However, in my case I was asked a passphrase at boot time and the encrypted filesystem was open, but not mounted. This was causing some confusion. So, the extra closing step at the beginning is just to ensure you start from real skratch.
Post a reply