2

When I installed Linux, the block-device-path of my root LUKS device was /dev/md125 and the unencrypted partition was /dev/mapper/md125_crypt. I have since renamed the MD device to /dev/md0, and now I'd like to rename the LUKS partition to /dev/mapper/md0_crypt. Here's what I've done so far:

  1. Replaced all references (in the various *tabs) of md125_crypt
  2. Updated my initramfs
  3. Updated grub2

However, when I reboot, my system doesn't make it to the point of asking for my decryption password; it says something about being "unable to find the root partition".

I've also tried adding a symlink (/dev/mapper/md125_crypt -> ./md0_crypt) but it doesn't seem to persist after a reboot.

How can I rename my unencrypted LUKS partition such that I can successfully boot after doing so?

1 Answer 1

0

When updating your initramfs, the root partition is detected from the running system -- not from your new/renamed config values. Instead, use a live cd and chroot to set the new name.

  1. Boot into another/similar system (live/rescue cd).
  2. Do cryptsetup open /dev/md0 md0_crypt to indicate the new root name md0_crypt.
  3. Mount /dev/mapper/md0_crypt, with the partition for /boot and --bind mounts for /dev /proc /sys inside.
  4. Do chroot into the mounted md0_crypt.
    1. Edit /etc/crypttab and /etc/fstab with the new root name.
    2. Update your initramfs plus grub's kernel parameters.
    3. Double-check everything before closing the chroot
  5. Reboot into the main system.

Tested the above steps on Ubuntu 22.04, but with (instead if grub); in that case, also edit refind_linux.conf to set the new root name in the kernel parameters.


Running dmsetup rename md125_crypt md0_crypt to temporarily change the name in /dev/mapper also seems like a viable option. As-is it doesn't affect the root partition detection in update-initramfs like chroot does though.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.