2

I installed debian stretch using encrypted lvm from the installer on a usb drive.

during installation, with all disks connected, sdo5 is assigned to my boot disk. when running the full system, my boot disk is now assigned sdn5

this is problematic, because I have an encrypted data disk that shows up as sdo1, as per blkid.

I need to change the crypt configuration and initramfs to look for sdn, so that sdo is free. how can I do that?

simply changing the crypttab and running update-initramfs -u -k all gives an error about invalid line in crypttab and then the system will not boot.

cryptsetup: WARNING: invalid line in /etc/crypttab for sdo5_crypt

there must be another step. where is sdo5_crypt referenced other than crypttab?

my crypttab is as follows:

sdo5_crypt UUID=long_string_here none luks

and my fstab is:

/dev/mapper/coldstorage--vg-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sdo1 during installation
UUID=long_string_here /boot           ext2    defaults        0       2
/dev/mapper/coldstorage--vg-swap_1 none            swap    sw              0       0

EDIT:

I can see there is a lingering /dev/mapper/sdo5_crypt even when I reboot after changing crypttab but not updating initramfs (which causes the system to request the password for sdn5)

If I can rename that, it might be enough? lvrename does not seem to work.

# ls /dev/mapper/
control  sdo5_crypt  coldstorage--vg-root  coldstorage--vg-swap_1

result of pvdisplay

  --- Physical volume ---
  PV Name               /dev/mapper/sdo5_crypt
  VG Name               coldstorage-vg

and attempt to fix... # pvmove /dev/mapper/sdo5_crypt /dev/mapper/sdn5_crypt Physical Volume "/dev/mapper/sdn5_crypt" not found in Volume Group "coldstorage-vg".

1 Answer 1

3

Got it.

dmsetup rename sdo5_crypt sdn5_crypt
sed -i -e 's/sdo5_crypt/sdn5_crypt/g' /etc/crypttab
update-initramfs -u -k all
1
  • 1
    Hey thanks a lot for posting these instructions. I was curious why dmsetup rename was necessary. Now I know the reason: When you update-initramfs, it will look on your system for a mounted device mapper named whatever new name you gave it. That's why the steps are as you say: 1. Rename the mapper device on your live system, 2. Edit crypttab to refer to the device as its new name, 3. Update initramfs to install the new crypttab settings into your boot system. Makes perfect sense! Your list is the exact list of necessary commands! Although I use vi /etc/crypttab to edit it manually. :-) Feb 26, 2021 at 6:38

You must log in to answer this question.

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