Bug 2217551

Summary: grub2-mkconfig fails to generate configuration after renaming volume group
Product: Red Hat Enterprise Linux 7 Reporter: CJ Travers <cj.travers>
Component: lvm2Assignee: LVM Team <lvm-team>
lvm2 sub component: Changing Logical Volumes QA Contact: cluster-qe <cluster-qe>
Status: NEW --- Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, heinzm, jbrassow, msnitzer, pjones, prajnoha, zkabelac
Version: 7.9   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description CJ Travers 2023-06-26 16:38:03 UTC
Description of problem:
After renaming logical volumes using vgrename, grub2-mkconfig fails to generate a new configuration file with the message: "/usr/sbin/grub2-probe: error: failed to get canonical path of /dev/mapper/somevg_somelv". The error appears to occur because grub2-probe relies on the names in /dev/mapper to check for bootable logical volumes, and in this situation it fails to do so because the names in /dev/mapper are not updated live by vgrename. This results in requiring updating config files in single user or recovery mode to boot successfully. 

Version-Release number of selected component (if applicable):
grub2-tools-2.02-0.87.el7_9.11.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Rename volume group foo to bar using vgrename
2. Execute grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Actual results:
/usr/sbin/grub2-probe: error: failed to get canonical path of /dev/mapper/foo-root

Expected results:
grub2-mkconfig completes successfully and generates the new grub.cfg with the updated volume group name.

Additional info:
A workaround can be implemented by editing the GRUB_DEVICE parameter in /usr/sbin/grub2-mkconfig to hard-code the updated path (/dev/mapper/bar-root in this example). Adding " || true" to the line as suggested by some sources results in a blank "root=" boot parameter and a failed boot.