grub2-mkconfig command shows "/usr/sbin/grub2-probe: error: failed to get canonical path of `/dev/mapper/rhel-root'." error message after renaming root lv.
Environment
- Red Hat Enterprise Linux (RHEL) 7
- Red Hat Enterprise Linux (RHEL) 8
- Red Hat Enterprise Linux (RHEL) 9
Issue
- After renaming root lv, grub2-mkconfig command shows below error message:
# grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-probe: error: failed to get canonical path of `/dev/mapper/vg_root-lv_root'.
-
Server fails to boot and goes in dracut shell after reboot.
-
From rescue mode, grub2-mkconfig command executed without any error which helped the server boot up successfully.
-
Why grub2-mkconfig command failed and server failed to boot as renaming root lv is online procedure?
Resolution
-
To avoid the booting issues during next reboot, we could manually update the new root volume group and lv name in the "/boot/grub2/grub.cfg" file.
-
grub-mkconfig command does the same task i.e. generate a GRUB configuration "/boot/grub2/grub.cfg" file.
-
Even after manually updating the new vg and lv name in "/boot/grub2/grub.cfg" file, there will be the same message logged by "grub2-mkconfig", because it still refers to the root filesystem reference in "/proc/self/mountinfo" file. But as we have manually updated the root vg and lv name in the GRUB configuration file (/boot/grub2/grub.cfg), the system will NOT get stuck or fail in next reboot.
Root Cause
- Below error is being logged because the "/usr/sbin/grub2-probe" command looks for root filesystem reference from "/proc/self/mountinfo", "/proc/mounts". Both of these places shows the old root filesystem name. This is because the root filesystem reference in these files could not be updated while the root filesystem is in use.
# grub2-mkconfig -o /boot/grub2/grub.cfg
/usr/sbin/grub2-probe: error: failed to get canonical path of `/dev/mapper/rhel-root'.
Diagnostic Steps
- Check old root filesystem reference is still in "/proc/self/mountinfo", "/proc/mounts" :
# cat /proc/self/mountinfo |grep -i root
39 0 253:0 / / rw,relatime shared:1 - xfs /dev/mapper/rhel-root rw,seclabel,attr2,inode64,noquota
# cat /proc/mounts |grep -i root
rootfs / rootfs rw 0 0
/dev/mapper/rhel-root / xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
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.