Bug 142346

Summary: Grubby inserts new yaboot.conf kernel config in wrong spot
Product: [Fedora] Fedora Reporter: W. Michael Petullo <redhat>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dwmw2
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-12-27 23:01:13 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:
Attachments:
Description Flags
Patch
none
Patch to fix test cases
none
Patch to make grubby pass the newly-modified tests.
none
Patch to make grubby pass the newly-modified tests. none

Description W. Michael Petullo 2004-12-09 04:10:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.7.3)
Gecko/20041027 Epiphany/1.4.4

Description of problem:
Grubby does not seem to insert kernel configurations into yaboot.conf
correctly.  Though the contents inserted are right, they are placed in
the wrong place.

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

How reproducible:
Always

Steps to Reproduce:
1.  Install a new kernel, ie kernel-2.6.9-1.1020_FC4: 
2.  Inspect /etc/yaboot.conf
    

Actual Results:  The new definition for vmlinuz-2.6.9-1.1020_FC4 was
placed in the middle of the global definitions, between magicboot= and
macosx=.  Also, a second default= line was added.

#boot=/dev/hda2
#device=/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:
boot=/dev/sda2
ofboot=/pci@f2000000/usb@1b,1/disk@1:2
init-message="Welcome to imp!\nHit <TAB> for boot options.\n\n"
#partition=4
partition=2
timeout=30
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot
default=linux
image=/vmlinuz-2.6.9-1.1020_FC4
        label=2.6.9-1.1020_FC
        append="enforcing=0"
        root=/dev/mapper/root
        initrd=/initrd-2.6.9-1.1020_FC4.img
        read-only

macosx=/dev/hda7
enablecdboot
default=linux
defaultos=linux
delay=10

image=/vmlinuz
        label=linux
        append="enforcing=1"
        root=/dev/hda5
        initrd=/initrd.gz
        read-only

Expected Results:  The new definition should go at the bottom of the file:

#boot=/dev/hda2
#device=/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:
boot=/dev/sda2
ofboot=/pci@f2000000/usb@1b,1/disk@1:2
init-message="Welcome to imp!\nHit <TAB> for boot options.\n\n"
#partition=4
partition=2
timeout=30
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot
macosx=/dev/hda7
enablecdboot
default=linux
defaultos=linux
delay=10

image=/vmlinuz
        label=linux
        append="enforcing=1"
        root=/dev/hda5
        initrd=/initrd.gz
        read-only

image=/vmlinuz-2.6.9-1.1020_FC4
        label=2.6.9-1.1020_FC
        append="enforcing=0"
        root=/dev/mapper/root
        initrd=/initrd-2.6.9-1.1020_FC4.img
        read-only


Additional info:

I do have somewhat of a non-standard yaboot.conf.

Comment 1 Jeremy Katz 2004-12-20 17:25:14 UTC
Should be fixed in mkinitrd-4.1.20

Comment 2 W. Michael Petullo 2004-12-21 17:17:35 UTC
This still seems to be too fragile (see "unable to find suitable
template"):

[root@imp mike]# rpm -ivh /tmp/kernel-2.6.9-1.1047_FC4.ppc.rpm
WARNING: Multiple same specifications for /var/run/dbus(/.*)?.
Preparing...               
########################################### [100%]
   1:kernel                
########################################### [100%]
WARNING: /lib/modules/2.6.9-1.1047_FC4/kernel/drivers/video/vga16fb.ko
needs unknown symbol vgacon_remap_base
grubby fatal error: unable to find a suitable template
[root@imp mike]# rpm -q mkinitrd
mkinitrd-4.1.20-1

What is grubby looking for in /etc/yaboot.conf?  Here is mine:

boot=/dev/sda2
ofboot=/pci@f2000000/usb@1b,1/disk@1:2
init-message="Welcome to imp!\nHit <TAB> for boot options.\n\n"
partition=3
timeout=30
install=/usr/lib/yaboot/yaboot
default=2.6.9-1.1021_FC
magicboot=/usr/lib/yaboot/ofboot
macosx=/dev/hda7
enablecdboot
delay=10
defaultos=linux
default=2.6.9-1.1021_FC
image=/vmlinuz-2.6.9-1.1021_FC4
        label=2.6.9-1.1021_FC
        append="enforcing=1"
        root=/dev/hda5
        initrd=/initrd-2.6.9-1.1021_FC4.img
        read-only
image=/vmlinuz-2.6.9-1.1020_FC4
        label=2.6.9-1.1020_FC
        append="enforcing=0"
        root=/dev/hda5
        initrd=/initrd-2.6.9-1.1020_FC4.img
        read-only

Comment 3 W. Michael Petullo 2004-12-21 17:36:50 UTC
I think you can scratch comment #2.  I am doing some unrelated work
with mkinitrd that goofed up my results.  I still see the same things
as documented in the initial report.

Comment 4 David Woodhouse 2005-08-03 13:52:26 UTC
*** Bug 164980 has been marked as a duplicate of this bug. ***

Comment 5 David Woodhouse 2005-08-03 13:54:46 UTC
Created attachment 117403 [details]
Patch

The problem is that grubby thinks that a whole bunch of generic config options
which live at the top of the file are in fact selections in the boot menu, like
'other' in Grub. This includes 'magicboot=', 'macosx=', etc. 

This patch should fix it.

Comment 6 Peter Jones 2005-08-03 18:16:42 UTC
Dave, can you add test case fixes that are appropriate for both the correct way
and the regressions?

Currently the patch you have doesn't match the testcases, and I don't know what
yaboot.conf _should_ look like in these cases.

Comment 7 David Woodhouse 2005-08-04 10:19:55 UTC
Hm, when the generic (first-stage) options like 'macosx=' are mixed in with the
kernel choices for the second stage, as they are in test/yaboot.1, grubby is
assuming that the 'macosx=' line is part of the image definition and is
reproducing it when it adds a new kernel based on the one which is above the
'macosx=' line.

It also _removes_ the macosx= option if it happens to come after a kernel which
is being removed.

Unfortunately this bug is going to have created config files which look like
that, so fixing it this way isn't really going to work. 

We possibly need to add a new line type for generic config options which
_aren't_ part of an image definition.

Comment 8 David Woodhouse 2005-08-04 11:56:04 UTC
Created attachment 117440 [details]
Patch to fix test cases

This makes the expected output of the test cases saner, with generic (or
first-stage) options collected at the top of the file instead of in the middle
of the kernel images for the second stage yaboot.

Comment 9 David Woodhouse 2005-08-04 11:59:56 UTC
Created attachment 117441 [details]
Patch to make grubby pass the newly-modified tests.

This makes grubby move generic config options up to the top of the file, before
the kernel images start.

Comment 10 David Woodhouse 2005-08-04 12:00:01 UTC
Created attachment 117442 [details]
Patch to make grubby pass the newly-modified tests.

This makes grubby move generic config options up to the top of the file, before
the kernel images start.

Comment 11 W. Michael Petullo 2005-12-27 23:01:13 UTC
I have not had this problem with Raw Hide grubby for quite some time.  Marking
as resolved.