Next, we must generate a new grub2.cfg file by using grub2-mkconfig. You can generate it according to your boot modules.

On BIOS based machines: grub2-mkconfig -o /boot/grub2/grub.cfg

On UEFI based machines: grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Where -o option means where to generate output file.

To check if your system uses BIOS or UEFI type dmesg command.

As it’s shown above, we use BIOS in our system. And you may noticed that boot image is still the old one with old VG, LV names.

[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.10.0-514.el7.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8

[root@host ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/cl-root’.

[root@host ~]#

I have got following error message

/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/cl-root’.

Now you have two options; either you boot your system with a live cd in rescue mod and regenerate grub config with:

  • On BIOS based machines:chroot /mnt/sysimagegrub2-mkconfig /etc/grub2.cfg
  • On UEFI based machines:chroot /mnt/sysimagegrub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Or you simply reboot the server edit kernel image with new VG, LV names then after your system boot up retype grub2-mkconfig -o /boot/grub2/grub.cfg command. We will see this way because maybe you don’t have a live cd and you need to fix the problem without it. Or maybe you don’t have time for finding a cd somewhere.

I switched to console view and reboot the server.

grub menu

Press e to edit kernel image.

Replace old VG, LV names by new ones. Then press ctrl+x to reboot your server.

We replaced these lines with new LV  and VG names:

root=/dev/mapper/cl-root ro crashkernel=auto

Your system will reboot correctly. But be careful this change is temporary you should continue with grub config regeneration.

And It’s done. Your system is ready to boot from grub with proper VG names.

After writing this article, I wonder if we could do this modification on kernel image file before rebooting the server and then try to pass grub2-mkconfig -o /boot/grub2/grub.cfg command.

I mean for last step, maybe we do not need to reboot the server and edit kernel. If you have time and of course always take a snapshot before such action. Try:

When you have following error message:

[root@host ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/cl-root’.

  • Open with a text editor /boot/grub2/grub.cfg file.
  • Find this line

linux16 /vmlinuz-0-rescue-70ccd28ffc587175d417545096e57dd2 root=/dev/mapper/root_vg-lv_root ro crashkernel=auto rhgb quiet

and edit appropriate VG, LV names, save the file.

  • type again grub2-mkconfig -o /boot/grub2/grub.cfg before rebooting your system.

Check if you receive the error message. Logically this should work. I did not have time to check this but anyway, you already know how to handle it.