Bug 89958

Summary: new-kernel-pkg sets incorrect root= in grub.conf file
Product: [Retired] Red Hat Linux Reporter: Jean-Luc Richier <jean-luc.richier>
Component: mkinitrdAssignee: Jeremy Katz <katzj>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-05-05 16:33:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jean-Luc Richier 2003-04-30 11:14:59 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003

Description of problem:
Installing a new kernel in Redhat 9 calls new-kernel-pkg to update
the /boot/grub/grub.conf file. The root= value computed by new-kernel-pkg is
incorrect and the kernel line installed in grub.conf has an invalid argument
root=LABEL=/
(The correct value should be root=/dev/hda2 in my case)

This is acceptable with 2.4 kernels, but a 2.5.65 kernel will refuse to boot,
with an 'invalid root device' message.

The reason is a bad parse of /etc/fstab: the correct value is computed in a
wrong variable.
The bug may also create incorrect lilo.conf files




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

How reproducible:
Always

Steps to Reproduce:
1.Take a Redhat 9.0 with grub and /etc/fstab starting with LABEL=/ /    
2.Compile and install a new kernel
3. inspect /etc/grub.conf
    

Actual Results:     kernel /boot/vmlinuz-2.4.20-9 ro root=LABEL=/

Expected Results:     kernel /boot/vmlinuz-2.4.20-9 ro root=/dev/hda2

Additional info:

The following patch corrects the bug
--- /sbin/new-kernel-pkg.DIST   2003-02-18 18:41:17.000000000 +0100
+++ /sbin/new-kernel-pkg        2003-04-29 19:50:49.000000000 +0200
@@ -69,9 +69,9 @@
     short=$(echo $rootdevice | cut -d= -f1)
     if [ "$short" == "LABEL" ]; then
        label=$(echo $rootdevice | cut -d= -f2)
-       device=$(echo "showlabels" | /sbin/nash  --force --quiet | 
+       rootdevice=$(echo "showlabels" | /sbin/nash  --force --quiet | 
                        awk '$2 == "'$label'" {print $1}')
-       if [ -z "$device" ]; then
+       if [ -z "$rootdevice" ]; then
            rootdevice=$(mount | awk '$3 == "/" { print $1 }')
        fi
     fi

Comment 1 Jeremy Katz 2003-05-05 16:33:23 UTC
No, this is intentional so that labels get used for mounting the rootfs.  This
will work fine as long as you are using an initrd with nash which is what
new-kernel-pkg assumes.

Comment 2 Jean-Luc Richier 2003-05-12 14:26:46 UTC
OK I understand the response, but in that case the problem
is that new-kernel-pkg does not work with kernels compiled without
the initrd option - as new-kernel-pkg do not test this case
and set a root=LABEL=/ which cause an error in the boot
So new-kernel-pkg should be smarter - or the initrd should be
mandatory in kernels