Ask Your Question

After migration of LVM PE to new PV, boot fails

asked 2017-09-04 19:32:30 -0500

pdestefa gravatar image

I've been running encrypted PV in LVM for many years. root is on an LV on the encrypted PV. Booting used to work fine and would prompt for PV LUKS passphrase and then find all LVs inside, start them automatically, mount root and continue booting.

I created a new PV, encrypted it with LUKS, like before, put it in my VG and migrated all the PEs from the old PV to the new PV. Now, when I try to boot, it prompts to unlock the old PV --I can tell because the UUID is the old PV UUID.

This makes some sense since grub shows the old UUID on the kernel command line. But, I've tried to fix it a number of different ways, and nothing has worked. For example, if I remove the old parameter and try, it will prompt to unlock the new PV, and succeeds, but it doesn't start LVM and find the root LV and boot; it just stalls.

How do I reconfigure grub and dracut properly? I cannot boot the system, remember. Clearly, one or both of these do not contain the right configuration, but I don't understand why since none of the LV names or UUIDs have changed, which is what I thought was in initrd.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-06 01:55:53 -0500

pdestefa gravatar image

After much research and testing, I relearned the general procedure for building a bootable Linux system, which is what I needed. I've done this several times in the past, but it was a long time ago and things have changed.

  1. boot live image
  2. assemble MD, unlock LUKS, LVM check, etc.
  3. build target system in chroot jail
    1. mount /newroot ../boot ../boot/efi and ../var, at least
    2. mount -t sysfs sysfs /newroot/sys
    3. mount -t proc none /newroot/proc
    4. mount -t bind /dev /newroot/dev
    5. mount -t bind /run /rnewroot/run
  4. chroot /newroot
    1. from inside jail, fix stuff as needed (/etc/fstab /etc/crypttab /etc/mdadm.conf /etc/lvm/ etc.)
  5. and, fix grub2 CMDLINE env var with new kernel parameters
    1. dracut --print-cmdline will output a minimal set of parameters. This is super helpful as it's hard to know what your distro needs and to keep up with latest kernel options. Moreover, saves you the trouble of tracking down UUIDs for luks/md devices!
  6. build new grub2 config
    1. grub2-mkconfig [-o <path for="" bios="" or="" efi="" cfg="" file="" as="" needed="">]
  7. install grub2, if necessary
    1. for BIOS grub2-install
    2. for EFI, distro dependent
    3. dnf reinstall grub-efi grub-efi-modules shim?
  8. regen intird/initramfs boot image
    1. dracut
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-09-04 19:32:30 -0500

Seen: 80 times

Last updated: Sep 06 '17