After renaming LVM volume group, receiving "/usr/sbin/grub2-probe: error: failed to get canonical path"

Solution Unverified - Updated

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9

Issue

  • After renaming LVM volume group, receiving "/usr/sbin/grub2-probe: error: failed to get canonical path".
/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/  rhelnew1-root’.

Resolution

Rescue Mode Workaround

  • Boot the system to rescue mode and rebuild grub2 using following command:
    • BIOS-based machines:

              # chroot /mnt/sysimage
              # grub2-mkconfig -o /boot/grub2/grub.cfg
      
    • UEFI-based machines:

              # chroot /mnt/sysimage
              # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
      

Refer to How to generate sosreport from the rescue environment for details.
The above workaround assumes /etc/fstab has already been set correctly and /etc/default/grub has been updated as well

Grubby Workaround

  • After renaming the volume group, update fstab:
# vgrename rhel new_rhel
# sed -i 's/rhel/new_rhel/g' /etc/fstab
  • Update the boot parameter:
# grub2-editenv - list | grep kernelopts
kernelopts=root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet

# grub2-editenv - set "kernelopts=root=/dev/mapper/new_rhel-root ro crashkernel=auto resume=/dev/mapper/new_rhel-swap rd.lvm.lv=new_rhel/root rd.lvm.lv=new_rhel/swap rhgb quiet"
  • Update the kernel arguments:
#  grubby --info DEFAULT
index=0
kernel="/boot/vmlinuz-4.18.0-240.el8.x86_64"
args="ro crashkernel=auto resume=/dev/mapper/new_rhel-swap rd.lvm.lv=new_rhel/root rd.lvm.lv=new_rhel/swap rhgb quiet $tuned_params"
root="/dev/mapper/new_rhel-root"
initrd="/boot/initramfs-4.18.0-240.el8.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-240.el8.x86_64) 8.3 (Ootpa)"
id="c2bbf943f69c4d8eb352b4f66e3d84ae-4.18.0-240.el8.x86_64"

#  grubby --args "ro crashkernel=auto resume=/dev/mapper/new_rhel-swap rd.lvm.lv=new_rhel/root rd.lvm.lv=new_rhel/swap rhgb quiet $tuned_params" root="/dev/mapper/new_rhel-root" --update-kernel ALL

#  grubby --info DEFAULT
index=0
kernel="/boot/vmlinuz-4.18.0-240.el8.x86_64"
args="ro crashkernel=auto resume=/dev/mapper/new_rhel-swap rd.lvm.lv=new_rhel/root rd.lvm.lv=new_rhel/swap rhgb quiet $tuned_params"
root="/dev/mapper/new_rhel-root"
initrd="/boot/initramfs-4.18.0-240.el8.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-240.el8.x86_64) 8.3 (Ootpa)"
id="c2bbf943f69c4d8eb352b4f66e3d84ae-4.18.0-240.el8.x86_64"
  • Then reboot the system.
# reboot
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.