Bug 594474 - Kernel Options Post: not populating grub.conf following system install
Summary: Kernel Options Post: not populating grub.conf following system install
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: anaconda
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Anaconda Maintenance Team
QA Contact: Release Test Team
Depends On:
TreeView+ depends on / blocked
Reported: 2010-05-20 19:19 UTC by PaulB
Modified: 2010-12-08 17:22 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-12-08 17:22:20 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description PaulB 2010-05-20 19:19:08 UTC
Description of problem:
Anaconda is not populating grub.conf with "Kernel Options Post" when installing a system via provisioning thru Beaker.
The system has both Kernel Options and Kernel Options Post required, as is configured in Beaker. The system installs. However, the grub.conf file is not populated with the required post install options.

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

How reproducible:

Steps to Reproduce:
Actual results:
Kernel Options Post not populating grub.conf

Expected results:
Post options should be added to grub.conf

Additional info:
Here is the required install configuration from Beaker:
Kickstart Metadata  	 grubport=0x03f8
Kernel Options 	         console=tty0 console=ttyS0,115200n81 ksdevice=00:1B:21:4C:EE:2B nointremap agp=off vnc
Kernel Options Post 	 console=ttyS0,115200n81 nointremap agp=off

Here is the kickstartfile for the install:

 nfs --server storage.bos.redhat.com --dir /vol/engineering/devarchive/redhat/rel-eng/RHEL6.0-Snapshot-4/6/Server/x86_64/os
#url --url=nfs://storage.bos.redhat.com:/vol/engineering/devarchive/redhat/rel-eng/RHEL6.0-Snapshot-4/6/Server/x86_64/os
key --skip

# System bootloader configuration
bootloader --location=mbr

# Error: no snippet data for network

firewall --disabled

# System keyboard
keyboard us
# System language
lang en_US.UTF-8

#Root password
rootpw --iscrypted $1$redhat$9yxjZID8FYVlQzHGhasqW/
# SELinux configuration
selinux --enforcing

# Configure the X Window System
xconfig --startxonboot

# System timezone
timezone  America/New_York
# Install OS instead of upgrade

repo --name=beaker-debug-optional --cost=100 --baseurl=http://lab2.rhts.eng.bos.redhat.com/distros/vol/engineering/devarchive/redhat/rel-eng/RHEL6.0-Snapshot-4/6/Server/x86_64/os/../../optional/x86_64/debug
repo --name=beaker-os-optional --cost=100 --baseurl=http://lab2.rhts.eng.bos.redhat.com/distros/vol/engineering/devarchive/redhat/rel-eng/RHEL6.0-Snapshot-4/6/Server/x86_64/os/../../optional/x86_64/os
repo --name=beaker-debug --cost=100 --baseurl=http://lab2.rhts.eng.bos.redhat.com/distros/vol/engineering/devarchive/redhat/rel-eng/RHEL6.0-Snapshot-4/6/Server/x86_64/os/../debug
repo --name=beaker-os --cost=100 --baseurl=http://lab2.rhts.eng.bos.redhat.com/distros/vol/engineering/devarchive/redhat/rel-eng/RHEL6.0-Snapshot-4/6/Server/x86_64/os/.

clearpart --all --initlabel


# Error: no snippet data for RedHatEnterpriseLinux6

# Error: no snippet data for system

%packages --ignoremissing
#RHEL6 and Fedora12


wget "http://lab2.rhts.eng.bos.redhat.com/cblr/svc/op/trig/mode/pre/system/intel-huronriver-01.lab.bos.redhat.com" -O /dev/null

# Start pre_install_network_config generated code

#  Start eth0
#  Skipping (not a physical interface)...
# End pre_install_network_config generated code

# Check in with Beaker Server
python << _EOF_
import xmlrpclib
server = xmlrpclib.Server("http://lab2.rhts.eng.bos.redhat.com:8000")

wget -O /tmp/anamon "http://lab2.rhts.eng.bos.redhat.com/cobbler/aux/anamon"
python /tmp/anamon --name "intel-huronriver-01.lab.bos.redhat.com" --server "lab2.rhts.eng.bos.redhat.com" --port "80"

# Error: no snippet data for RedHatEnterpriseLinux6_pre

# Error: no snippet data for system_pre

wget "http://lab2.rhts.eng.bos.redhat.com/cblr/svc/op/yum/system/intel-huronriver-01.lab.bos.redhat.com" --output-document=/etc/yum.repos.d/cobbler-config.repo

# End yum configuration
# Start post install kernel options update
/sbin/grubby --update-kernel=`/sbin/grubby --default-kernel` --args="console=tty0 console=ttyS0,115200n81 nointremap agp=off "
# End post install kernel options update

# Start download cobbler managed config files (if applicable)
# End download cobbler managed config files (if applicable)

# Start koan environment setup
echo "export COBBLER_SERVER=lab2.rhts.eng.bos.redhat.com" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER lab2.rhts.eng.bos.redhat.com" > /etc/profile.d/cobbler.csh
# End koan environment setup

# begin Red Hat management server registration
# not configured to register to any Red Hat management server (ok)
# end Red Hat management server registration

# Enable post-install boot notification

wget -O /usr/local/sbin/anamon "http://lab2.rhts.eng.bos.redhat.com/cobbler/aux/anamon"
wget -O /etc/rc.d/init.d/anamon "http://lab2.rhts.eng.bos.redhat.com/cobbler/aux/anamon.init"

chmod 755 /etc/rc.d/init.d/anamon /usr/local/sbin/anamon
test -d /selinux && restorecon /etc/rc.d/init.d/anamon /usr/local/sbin/anamon

chkconfig --add anamon

cat << __EOT__ > /etc/sysconfig/anamon
LOGFILES="/var/log/boot.log /var/log/messages /var/log/dmesg"

/sbin/chkconfig ntpdate on
/sbin/chkconfig ntpd on
echo 'OPTIONS="$OPTIONS -x"' >>/etc/sysconfig/ntpd

#/bin/sed -i 's/^serial.*/serial --port=0x03f8 --speed=115200/' /boot/grub/grub.conf
/bin/sed -i 's/^\(serial.*\)--unit=\S\+\(.*\)$/\1--port=0x03f8\2/' /boot/grub/grub.conf

# Add Distro Repos
cat << EOF > /etc/yum.repos.d/beaker-debug-optional.repo
cat << EOF > /etc/yum.repos.d/beaker-os-optional.repo
cat << EOF > /etc/yum.repos.d/beaker-debug.repo
cat << EOF > /etc/yum.repos.d/beaker-os.repo

# Add Harness Repos

# Add Custom Repos

# Install old rhts commands
yum -y --disablerepo=* --enablerepo=beaker-* install rhts-test-env-lab rhts-legacy
yum -y --disablerepo=* --enablerepo=beaker-* install koan
# Install new harness
yum -y --disablerepo=* --enablerepo=beaker-* install beah
cat << EOF > /etc/beah_beaker.conf
# LAB_CONTROLLER: URI of Beaker's XML-RPC handler
# # HOSTNAME: Pretend to be machine with given name:
# #HOSTNAME=fake.hostname.com
# Turn on Debug logging
/bin/sed -i 's/DEVEL=False/DEVEL=True/' /etc/beah.conf
/bin/sed -i 's/INTERFACE=localhost/INTERFACE=/' /etc/beah.conf
/bin/sed -i 's/CONSOLE_LOG=.*/CONSOLE_LOG=True/' /etc/beah.conf

chkconfig --add beah-srv
chkconfig --add beah-beaker-backend
chkconfig --add beah-fwd-backend

#Add test user account
useradd --password '$6$oIW3o2Mr$XbWZKaM7nA.cQqudfDJScupXOia5h1u517t6Htx/Q/MgXm82Pc/OcytatTeI4ULNWOMJzvpCigWiL4xKP9PX4.' test
wget -O /etc/rc.d/init.d/koan "http://lab2.rhts.eng.bos.redhat.com/beaker/koan.init"

chmod 755 /etc/rc.d/init.d/koan
test -d /selinux && restorecon /etc/rc.d/init.d/koan

chkconfig --add koan

wget "http://lab2.rhts.eng.bos.redhat.com/cblr/svc/op/nopxe/system/intel-huronriver-01.lab.bos.redhat.com" -O /dev/null
wget "http://lab2.rhts.eng.bos.redhat.com/cblr/svc/op/ks/system/intel-huronriver-01.lab.bos.redhat.com" -O /root/cobbler.ks
wget "http://lab2.rhts.eng.bos.redhat.com/cblr/svc/op/trig/mode/post/system/intel-huronriver-01.lab.bos.redhat.com" -O /dev/null

# Error: no snippet data for RedHatEnterpriseLinux6_post

# Error: no snippet data for system_post

Here is a copy of the grub.conf file on the system following the install:

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_intelhuronriver01-lv_root
#          initrd /initrd-[generic-]version.img
serial --port=0x03f8 --speed=115200
terminal --timeout=5 serial console
title Red Hat Enterprise Linux (2.6.32-25.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-25.el6.x86_64 ro root=/dev/mapper/vg_intelhuronriver01-lv_root rd_LVM_LV=vg_intelhuronriver01/lv_root rd_LVM_LV=vg_intelhuronriver01/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us console=ttyS0,115200n81
        initrd /initramfs-2.6.32-25.el6.x86_64.img

Thank you,

Comment 2 Hans de Goede 2010-05-21 06:47:19 UTC
From "man grubby":

              Display the full path to the current default kernel and exit.

              When  a  new  kernel  is  added, this specifies the command line
              arguments which should be passed to the kernel by default  (note
              they  are merged with the arguments from the template if --copy-
              default is used).  When --update-kernel is used, this  specifies
              new arguments to add to the argument list. Multiple, space sepa-
              rated arguments may be used. If an argument already  exists  the
              new  value  replaces  the  old values. The root= kernel argument
              gets special handling if the configuration file has special han-
              dling  for specifying the root filesystem (like lilo.conf does).

IOW the grubby invocation in the %post script is wrong. But you really should not be using grubby for this in the first place.

To get the desired result simple change the bootloader line in the kickstart script from:
bootloader --location=mbr

bootloader --location=mbr --append="nointremap agp=off"

Comment 3 PaulB 2010-05-26 20:36:16 UTC
Updating/reopening BZ:

Description of problem:
I had previously reported that the Beaker Kernel Options Post was not populating grub.conf following RHEL6 system install. At that time, none of the Kernel Options Post were added to /etc/grub.conf following a RHEL6 install. However, it seems that Anaconda automagically added the console lines to /etc/grub.conf.

Following the Beaker upgrade to 0.5.40-0.el5, I retested a RHEL6 install on my system. All the Beaker Kernel Options Post are now successfully populating. However, there are now dual console entries added to /etc/grub.conf: Those added by the Kernel Options Post and those automagically added by Anaconda.

Yes, I can remove the console lines from Kernel Options Post, as a work around.

However, this is a functionality issue. There are numerous systems added to Beaker with console lines in the Kernel Options Post. Developers reserving these systems to debug RHEL6 issues will not be capable of logging in via serial console unless they ssh in and edit /etc/grub.conf following the RHEL6 install.

Version-Release number of selected component (if applicable):
Beaker upgrade to 0.5.40-0.el5

How reproducible:
Add console lines to Kernel Options Post, install RHEL6, and try to log i via console.

Steps to Reproduce:
1. Add console lines to Kernel Options Post
2. Install RHEL6
3. Try to log in via console.
Actual results:
The serial data is all truncated and the user is not able to log in via serial console.

Expected results:
The user should be able to log in visa serial console.

Additional info:
Here is the required install configuration from Beaker:
Kickstart Metadata       grubport=0x03f8
Kernel Options           console=tty0 console=ttyS0,115200n81
ksdevice=00:1B:21:4C:EE:2B nointremap agp=off vnc
Kernel Options Post   console=ttyS0,115200n81 nointremap agp=off


Comment 4 PaulB 2010-05-26 20:44:09 UTC
Updating/reopening BZ:

see comment#3.

Thank you,

Comment 5 Hans de Goede 2010-05-26 20:59:45 UTC
When you do an installation which uses a serial console during the install, we add a console= argument to grub.conf so that the serial console will work with the installed system too. This is a feature not a bug.

Moreover the post script which you run is using grubby to modify the kernel parameters so anaconda is not even involved in the adding of the duplicate console= argument, other then that it executes the instructions in the post script.

The proper thing to do here is to fix-up the involved installation scripts, not to keep re-opening this bug.

Comment 6 John Villalovos 2010-05-26 21:21:54 UTC
Okay, I'm confused.  Why does anaconda choose to take some of the kernel command line options given during the install and put them into the grub.conf, but not do all of the command line options?

Is there a list of which options are considered special case options and thus transferred to the grub.conf?

What are the downsides to having anaconda transfer all the options that were specified and putting them in the grub.conf?

It was annoying to me that when I installed this system from DVD and specified the nointremap option (in F12) and after the install that option was not in the grub.conf and then the system crashed on boot.

Comment 7 Bill Peck 2010-05-27 14:38:34 UTC
I agree 100% with John here.  What are the rules for anaconda passing on boot options to the installed kernel?  It should be all or none, not some arbitrary unknown list.

Comment 8 Bill Peck 2010-05-27 14:59:36 UTC
btw - I switched the kickstarts to using --append="$KERNEL_OPTIONS_POST" so were not using grubby anymore like you suggested.  The problem now is its unclear which options we need to duplicate between kernel_options and kernel_options_post.  As you mentioned console gets automatically added but other command line options don't.

Its very confusing for a user.

Expected results:

anaconda should pop all anaconda specific options off the cmdline stack and pass the rest of the cmdline to the installed kernel.

Comment 9 Chris Lumens 2010-05-27 15:08:38 UTC
The list is roughly this:

        # look for kernel arguments we know should be preserved and add them
        ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht",
                   "acpi", "video", "pci", "nodmraid", "nompath", "nomodeset",
                   "noiswmd", "fips"]

Plus some other stuff like s390-specific parameters and serial console.  I'd guess it's this way so that grub.conf doesn't end up with ks= and other anaconda-specific parameters.  Still, it seems there's got to be a better way here and I'd support looking for what that way might be.

Comment 10 Bill Peck 2010-05-27 15:16:02 UTC
Hi Chris,

so do you think removing the anaconda args would work?  you obviously know what args you understand and only apply to anaconda.  just pass the command line through minus your args.

Comment 11 John Villalovos 2010-05-27 15:22:04 UTC
+1 to Bill's idea

I think a "black list" would be better than a "white list".

Since it is impossible to know all the kernel arguments that are valid.  Of course the same thing could be said of the ones to remove, unless all you remove are anaconda specific parameters.

But I think it will work better to have a black list to remove things like ks= and other anaconda specific parameters.

Then if the user puts options on the command line during the install, it will also show up in the grub.conf.

Of course I don't know what the negatives are with this kind of solution.

Comment 12 Chris Lumens 2010-05-27 20:37:37 UTC
It's not likely to be that simple.  First, anaconda option processing is scattered across loader and stage2 so doing this processing in booty would require some duplication.  Second, it's likely that the bootloader is passing some special arguments when the install media is booted up that we would not want to include in the final configs.  I'm thinking things like "root=", "livecd", and so forth.

So that gets us to having a blacklist of anaconda options that we can probably do a reasonable (if sometimes slightly out-of-date) job of maintaining, and a blacklist of installation bootloader options that we can probably do a pretty terrible job of maintaining.

In summary, good idea but harder than it ought to be.

Comment 13 RHEL Program Management 2010-06-07 15:56:17 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for

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