Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

Reinstall grub from livecd with luks encrypted volumes

Ask your questions here.

Reinstall grub from livecd with luks encrypted volumes

Postby aquilarubra » 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
aquilarubra
 
Posts: 39
Joined: Wed Sep 10, 2014 7:07 am

Re: Reinstall grub from livecd with luks encrypted volumes

Postby nadir » 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.
So i herd u liek mudkip?
User avatar
nadir
 
Posts: 1159
Joined: Wed Mar 09, 2011 4:18 am
Location: here

Re: Reinstall grub from livecd with luks encrypted volumes

Postby aquilarubra » 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.
aquilarubra
 
Posts: 39
Joined: Wed Sep 10, 2014 7:07 am


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred