Bug 695988 - RFE: "yum --installroot=/a upgrade" fails to populate /etc/grub.conf
Summary: RFE: "yum --installroot=/a upgrade" fails to populate /etc/grub.conf
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: mkinitrd
Version: 5.5
Hardware: All
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Brian Lane
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-13 02:37 UTC by Pranesh Medilall
Modified: 2018-11-14 15:41 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-27 18:17:54 UTC
Target Upstream Version:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.