3

Several years ago I installed Debian on my 500 GiB hard disk. During installation I chose to have encrypted filesystem. So installer created one small unencrypted boot partition (I guess that grub configuration is kept there) and one large LUKS encrypted partition. This large encrypted partition is a physical volume, which is the only member of a volume group, on which two logical volumes are created - one for swap and one for everything else. And everything was working fine in this configuration for several years without me thinking too much about it.

Few days ago I bought new 2 TiB hard drive and decided to move my system to it. I copied my old hard drive to my new hard drive - bit by bit, simple by "cat /dev/sda > /dev/sdb". After that my computer was booting fine from my new hard disk, but it was only 500 GiB large, because it had partition table copied from the old hard disk. So I tried to enlarge it.

First I created new (the third) partition on it. I created physical volume on it. I LUKS encrypted this physical volume (using "cryptsetup" command), with the same password as the old partition had. I added this physical volume to already existing volume group. I enlarged already existing logical volume, enlarging filesystem sitting on it as well. I did it all using Knoppix booted from CD. I did not alter grub configuration. Then (I was still at Knoppix) I tried to mount the filesystem from these two encrypted partitions - it worked well, it was one filesystem, 2 TiB large and all files were there.

Then I tried booting from this hard disk. Grub asked me for a password to a LUKS encrypted partition and then failed with these messages:

grub errors

In these messages we can see uuid "EFc551-(...)" - I don't know what this uuid is.

Commands that grub executes while booting are those (the photo is blurry, but I hope you can read the text):

grub commands

String "9e5881c3(...)" which you can see in this command is uuid of the old encrypted partition. Now I want to achieve two things:

  • understand what goes on,
  • be able to boot from my 2 TiB hard disk.

Could you help me to achieve those two goals?


Final solution

Marmarek's idea was the right one.

Contrary to what I thought at the beginning, in my setup (which is, I guess, default Debian setup) grub has nothing to do with LVM. Grub boots small unencrypted boot partition and it's job of that partition's init to decrypt and mount encrypted LVM volumes. So I didn't have to tinker with grub but with initrd. Marmarek suggested to recreate it under Knoppix using update-initramfs, but it did not work. Initrd created by update-initramfs lacked /conf/conf.d/cryptroot file (my original initrd had it) and because of that it didn't try to decrypt any partitions at all. I guessed that maybe it lacked that file because when I run update-initramfs command those partitions were not unencrypted and LVM volumes were not activated?

So I just unpacked my original initrd image and put into its init file such line:

cryptsetup luksOpen UUID=some-uuid udisks-luks-uuid-this-uuid

I don't know if the last argument to cryptsetup must be exactly as I gave it - I just mimicked what I saw in some examples.

The line had to be put in such place inside init where /dev is already mounted - I found such place by trial and error. This was the place right after the line:

run_scripts /scripts/init-top

When I packed back this modified initrd and booted my computer, it asked me for two passwords and worked well.

2 Answers 2

6

This uuid "EFc551-(...)" probably is your 2TB disk (namely encrypted PV on it). You need to tell somehow your initramfs about this second PV. Probably update-initramfs will do it, something like (from knoppix): (assuming you've mounted your disk in /mnt/disk)

cp -a /dev/* /mnt/disk/dev/
chroot /mnt/disk
mount /proc
mount /sys
update-initramfs -u -k all

1
  • Your diagnosis may be right, because the uuid "EFc551-(...)" really is the uuid of the encrypted PV on my new partition. Which, by the way (maybe somebody else will have similar problem), I found out by first decrypting it with "cryptsetup luksOpen /dev/sda3 test3" and then doing "pvdisplay".
    – user983447
    Dec 18, 2012 at 4:29
4

Did you update on your 2TB hdd the /etc/fstab to point to the correct UUID of the encrypt volume?

In case you don't know what is the UUID of the encrypt volume you can check by issuing the cmd:

cryptsetup -v status /dev/

After you need to update your /etc/fstab and the grub configuration to point to the correct UUID.

This should solve your question assuming that it is a matter of having the grub and fstab pointing to the correct drive.

2
  • 1
    It may be helpful to point out that modifying the volume by resizing it most likely changed the UUID and that is why it needs to be updated.
    – asm
    Dec 17, 2012 at 17:24
  • 1
    I don't think this is the reason of my problems. My boot partition doesn't have /etc/fstab, initrd which is inside it doesn't have it. And I guess that the /etc/fstab which is on logical volume isn't the cause of problem, because during boot this logical volume isn't activated yet while the error message is shown.
    – user983447
    Dec 18, 2012 at 4:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .