Operating System - Linux
1821980 Members
3537 Online
109638 Solutions
New Discussion юеВ

Upgrading kernel from Kickstart script

 
Chad C. Beattie
New Member

Upgrading kernel from Kickstart script

I am working on automating a RedHat 7.3 setup on a couple of DL380 servers. I have built a custom kernel and made an rpm package from the original src rpm for the generic kernel. After installing the base os, I copy over some additional rpm files in the %post section of the script. I then install the rpm packages. After the rpm's are done, I copy over a pre-made lilo.conf file for the new kernel, the last command I run from kickstart is /sbin/lilo -v. From watching the install, everything works fine, even the lilo command works without any errors. After server is rebooted, it still boots to the old kernel. If I log into the server and run lilo again and reboot, it boots to the new kernel. Anything I am missing here?

Sorry, my first post here, so hopefully I included enough information.

Thanks.
8 REPLIES 8
Stuart Browne
Honored Contributor

Re: Upgrading kernel from Kickstart script

Unfortunately, this is one thing that I've never tried to do using Kickstart. Assuming it's the last thing in the %post, I can't see why it wouldn't be working.

You might want to have a look at http://www.redhat.com/mailing-lists/kickstart-list/, and see if the people on the list can help you further though.
One long-haired git at your service...
I_M
Honored Contributor

Re: Upgrading kernel from Kickstart script

Hi,

According to your post, your %post script could install your original kernel RPM, but failed to re-write your MBR...right?

As you know, lilo command use /etc/lilo.conf. During the install session, your installer working on RAM disk. Which have /etc directory.
But your filesystems on HD are mounted under /mnt/sysimage.
So I think lilo command have to use /mnt/sysimage/etc/lilo.conf.

You have 2 choices.

use -C /mnt/sysimage/etc/lilo.conf

or

chroot the system on HD then issue /sbin/lilo -v

I do "chroot" when ever I do this kind of troubleshoot.

Or, if you use grub, you don't need to update MBR like lilo.

Good luck

Stuart Browne
Honored Contributor

Re: Upgrading kernel from Kickstart script

Masanari,

All %post commands are run in a 'chroot' environment, so the /etc/lilo.conf file is indeed the one on his HDD, not that stored in the RAM disk image.

What I would also suggest is for Chad to watch the output from the %post commands (I think it's on the 4th VTY) during the installation, and see if it spits out any error messages.
One long-haired git at your service...
Chad C. Beattie
New Member

Re: Upgrading kernel from Kickstart script

Ok, here are the messages I get. This one is what I see when watching the kickstart install via the virtual terminal:

Message when lilo is run at the end of
kickstart.

LILO version 21.4-4, Copyright (C) 1992-1998 Werner Almesberger
'lba32' extensions Copyright (C) 1999,2000 John Coffman

Reading boot sector from /dev/cciss/c1d0p1
Merging with /boot/boot.b
Mapping message file /boot/message
Boot image: /boot/vmlinuz-2.4.18-3
Mapping RAM disk /boot/initrd-2.4.18-3.img
Added linux-old
Boot image: /boot/vmlinuz-2.4.18-3.netmgr.v01
Mapping RAM disk /boot/initrd-2.4.18-3.netmgr.v01.img
Added linux *
Backup copy of boot sector in /boot/boot.6901
Writing boot sector.

Now, after kickstart, the boot menu only
shows linux and it still points to old kernel.
After reboot, I run lilo again. Here is the output.

LILO version 21.4-4, Copyright (C) 1992-1998 Werner Almesberger
'lba32' extensions Copyright (C) 1999,2000 John Coffman

Reading boot sector from /dev/cciss/c1d0p1
Merging with /boot/boo.b
ide-floppy driver 0.99.newide
hda: ATAPI 24x CD-ROM drive, 128kb Cache
Mapping message file /boot/message
Boot image: /boot/vmlinuz-2.4.18-3
Mapping RAM disk /boot/initrd-2.4.28-3.img
Added linux-old
Boot image: /boot/vmlinuz-2.4.18-3.netmgr.v01
Mapping RAM disk /boot/initrd-2.4.18-3.netmgr.v01.img
Added linux *
/boo/boot.6901 exists - no backup copy made
Writing boot sector

After this, when I reboot, I see both linux and linux-old as an option and linux boots to my new kernel.

Here is my lilo.conf file that I copy over during the kickstart install:

prompt
timeout=50
default=linux
boot=/dev/cciss/c1d0p1
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear

image=/boot/vmlinuz-2.4.18-3
label=linux-old
initrd=/boot/initrd-2.4.18-3.img
read-only
root=/dev/cciss/c1d0p2

image=/boot/vmlinuz-2.4.18-3.netmgr.v01
label=linux
initrd=/boot/initrd-2.4.18-3.netmgr.v01.img
read-only
root=/dev/cciss/c1d0p2

As far as using grub, I have had no luck with that either. When I install grub instead of lilo, it won't boot past the kernel load. It says it cannot mount the ext3 file system and is unable to find /sbin/init.
Stuart Browne
Honored Contributor

Re: Upgrading kernel from Kickstart script

Is '/boot' it's own filesystem and is it mounted at the time you issue the 'lilo' command from the %post?

You aren't using a '%post --nochroot' are you?

It looks as if everything is doing what it's supposed to be doing :(
One long-haired git at your service...
I_M
Honored Contributor

Re: Upgrading kernel from Kickstart script

Stuart,
thanks for the comment.

BTW, one thing I can not get it.

>Backup copy of boot sector in /boot/boot.6901

What is 6901?
I think this number is 69=major, 01=minor number of the device file.
If the system disk is scsi, it should be /boot/boot.0800.
But your system returned 6901.
What is the device, 6901 pointing?
Stuart Browne
Honored Contributor

Re: Upgrading kernel from Kickstart script

Actually (without looking at any references), I thought it was the PID of the calling Lilo process..

*goes docco hunting* Nope, I was wrong..

quote (man lilo):

-s save-file
When lilo overwrites the boot sector, it preserves the old contents in a file, by default /boot/boot.NNNN where NNNN depends on the device. This option specifies an alternate save file for the boot sector. (Or, together with the -u option, specifies from where to restore the boot sector.)

quote (/usr/share/doc/lilo-21.4.4/README):

Whenever the map installer updates a boot sector, the original boot sector is copied to /boot/boot., where is the hexadecimal device number. If such a file already exists, no backup copy is made.

Still doesn't really explain 6901 though :P
One long-haired git at your service...
Chad C. Beattie
New Member

Re: Upgrading kernel from Kickstart script

Just an FYI: I tried this same install on our other DL380, and it worked just fine. So I did the smartstart system erase on the system I was having problems and reconfigured it all. After doing the ks install again, it worked fine. Thanks everyone for all of your help.