Bug 695988

Summary: RFE: "yum --installroot=/a upgrade" fails to populate /etc/grub.conf
Product: Red Hat Enterprise Linux 5 Reporter: Pranesh Medilall <pmedilal>
Component: mkinitrdAssignee: Brian Lane <bcl>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team>
Severity: high Docs Contact:
Priority: medium    
Version: 5.5CC: cww, ddumas, gergnz
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-27 18:17:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Pranesh Medilall 2011-04-13 02:37:40 UTC
Description of problem:

When using yum with the --installroot option, and a kernel is being installed, grubby fails to create an entry in /etc/grub.conf. It fails with the follwoing error: "grubby fatal error: unable to find a suitable template" 


Version-Release number of selected component (if applicable):



How reproducible:
Always


Steps to Reproduce:
1.How we create "/a":

lvcreate -n root2 -L 4G rpool
lvcreate -n var2 -L 2G rpool
mkfs -t ext3 /dev/rpool/root2
mkfs -t ext3 /dev/rpool/var2
mkdir /a
mount /dev/rpool/root2 /a
cp -ax / /a
mount /dev/rpool/var2 /a/var/
cp -ax /var /a
chroot /a
mount /proc
mount /sys
exit
mount --bind /dev /a/dev
mount --bind /boot /a/boot

2.
"yum --installroot=/a upgrade" fails to populate /etc/grub.conf

  
Actual results:

kernel is being installed, grubby fails to create an entry in /etc/grub.conf. It fails with the follwoing error: "grubby fatal error: unable to find a suitable template" 

Expected results:

grub.conf should be automatically populated with the related kernel entries


Additional info:

Grubby upstream has changed the method to determine which device is root and which device the kernel is on.
Compiling grubby from upstream (fedora git repo), and installing, replacing grubby in RHEL5 does succeed and ends up with an entry in /etc/grub.conf but does not reflect the root as provided by "--installroot", but instead the original root device.

This is the code that is goinging wrong in grubby.c:
dev = nashGetPathBySpec(_nash_context, dev);
if (!dev)
return 0;

i = stat(dev, &sb);
if (i)
return 0;

stat("/", &sb2);

if (sb.st_rdev != sb2.st_dev)
return 0;

return 1;

Grubby in fedora, changes to using UUIDs:
dev = getpathbyspec(dev);
if (!dev)
return 0;

rootdev = findDiskForRoot();
if (!rootdev)
return 0;

if (!getuuidbydev(rootdev) || !getuuidbydev(dev)) {
free(rootdev);
return 0;
}

if (strcmp(getuuidbydev(rootdev), getuuidbydev(dev))) {
free(rootdev);
return 0;
}

free(rootdev);

return 1;

Ultimately grubby, rpm, yum needs to be aware of the change of root and cope with this automatically.

Comment 1 David Cantrell 2011-07-27 18:17:29 UTC
It's too late for new feature development in RHEL-5.