Boot into new kernel (if it exists).

Place to discuss Fedora and/or Red Hat
Post Reply
ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Boot into new kernel (if it exists).

Post by ZiaTioN » Wed Apr 21, 2004 3:51 pm

As I am sure you remember I wrote a perl script to auto update my systems every night via apt-get. I had a couple questions pertaining to possible new kernel releases that may have been downloaded during one of these nightly updates.

First question:
How do I find out what kernel release I am currently running on. (I know it is a simple command but I forget it).

Second question:
Where would I look to see if a newer kernel release is available on my system (downloaded by apt-get).

Last question:
If there is a newer kernal release available how would I update my system to boot into the newest kernel (or a kernel of my choice)? Is there any recompilation envolved if I want to use the same configuration as in old kernel releases?

Thanks for any answeres! :)

chartoo
user
user
Posts: 32
Joined: Mon Mar 22, 2004 5:43 pm
Location: cerebral cortex
Contact:

Post by chartoo » Wed Apr 21, 2004 4:32 pm

How do I find out what kernel release I am currently running on


uname -r

;-)

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Wed Apr 21, 2004 4:44 pm

ahh yes, uname. I guess I should have looked at another system stasts script i wrote a while ago. That would have reminded me.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Re: Boot into new kernel (if it exists).

Post by Void Main » Wed Apr 21, 2004 5:31 pm

ZiaTioN wrote: Second question:
Where would I look to see if a newer kernel release is available on my system (downloaded by apt-get).
In both Red Hat and Debian, apt-get does not automatically download new kernels with a default apt configuration (and you really wouldn't want it to). You have to install the kernel specifically using apt, continued on your next question:
Last question:
If there is a newer kernal release available how would I update my system to boot into the newest kernel (or a kernel of my choice)? Is there any recompilation envolved if I want to use the same configuration as in old kernel releases?
In Red Hat all the system kernels should be configured the same so if you are currently using a system kernel with no 3rd party modules then you should be just fine upgrading to the next one. If you have 3rd party modules you'll have to add those modules to the new kernel configuration as well. Also in Red Hat when you install a new kernel via apt-get it will automatically add the new kernel to the GRUB menu for you (but not make it the new default, this you should rightly do manually).

Just type "apt-get install kernel" to see what kernels are available. It will also show you which one(s) you currently have installed:

Code: Select all

# apt-get install kernel
Reading Package Lists... Done
Building Dependency Tree... Done
Package kernel is a virtual package provided by:
  kernel#2.6.5-1.309 2.6.5-1.309 [Installed]
  kernel-smp#2.4.22-1.2179.nptl 2.4.22-1.2179.nptl
  kernel-smp#2.4.22-1.2174.nptl 2.4.22-1.2174.nptl
  kernel-smp#2.4.22-1.2140.nptl 2.4.22-1.2140.nptl
  kernel-BOOT#2.4.22-1.2179.nptl 2.4.22-1.2179.nptl
  kernel-BOOT#2.4.22-1.2174.nptl 2.4.22-1.2174.nptl
  kernel#2.4.22-1.2179.nptl 2.4.22-1.2179.nptl
  kernel#2.4.22-1.2174.nptl 2.4.22-1.2174.nptl [Installed]
  kernel#2.4.22-1.2140.nptl 2.4.22-1.2140.nptl
  kernel-smp#2.4.22-1.2115.nptl 2.4.22-1.2115.nptl
  kernel-BOOT#2.4.22-1.2115.nptl 2.4.22-1.2115.nptl
  kernel#2.4.22-1.2115.nptl 2.4.22-1.2115.nptl [Installed]
  kernel-smp#2.6.5-1.332 2.6.5-1.332
  kernel#2.6.5-1.332 2.6.5-1.332
You should explicitly select one to install.
E: Package kernel is a virtual package with multiple good providers.
As you can see I have kernel versions 2.4.22-1.2174.nptl and 2.4.22-1.2115.nptl installed. The latest 2.4 kernel available for install is 2.4.22-1.2179.nptl and this is how I will install it:

Code: Select all

# apt-get install kernel#2.4.22-1.2179.nptl
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
  kernel#2.4.22-1.2179.nptl
0 upgraded, 1 newly installed, 0 removed and 0 not upgraded.
Need to get 12.9MB of archives.
After unpacking 29.4MB of additional disk space will be used.
Get:1 http://ayo.freshrpms.net fedora/linux/1/i386/updates kernel#2.4.22-1.2179.nptl 2.4.22-1.2179.nptl [12.9MB]Fetched 12.9MB in 50s (253kB/s)
Committing changes...
Preparing...                ########################################### [100%]
   1:kernel                 ########################################### [100%]
copy from /lib/modules/2.4.22-1.2179.nptl/./kernel/fs/jbd/jbd.o(elf32-i386) to /tmp/initrd.Ox3982/lib/jbd.o(elf32-i386)
copy from /lib/modules/2.4.22-1.2179.nptl/./kernel/fs/ext3/ext3.o(elf32-i386) to /tmp/initrd.Ox3982/lib/ext3.o(elf32-i386)
Done.
The kernel/modules/initrd get installed in the usual places /boot and /lib/modules/<kernversion>. The RPM itself will be cached just like any RPM does in /var/cache/apt/archives (until you do an "apt-get clean"). It will add a menu option to your /boot/grub/menu.lst file that looks something like this:

Code: Select all

title Fedora Core (2.4.22-1.2179.nptl)
        root (hd0,1)
        kernel /vmlinuz-2.4.22-1.2179.nptl ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.4.22-1.2179.nptl.img
It actually will stick it first in the list, but will increment "default=" so as your old kernel will continue to boot. If you have checked out the new kernel and want to make it the default just change that to "default=0" (0 is the first kernel entry in the list).

I hope those were the answers you were looking for.

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Wed Apr 21, 2004 6:11 pm

Umm yeah that kinda addresses what I was asking. LOL... J/K that is exactly what I needed. Ok now I asked this question when I was at work at it did apply to Fedora because that is what I run at work but now I am home and I run RH 9 here and I entered the apt-get command and this was the results.
[root@Hackbox root]# apt-get install kernel
Reading Package Lists... Done
Building Dependency Tree... Done
Package kernel is a virtual package provided by:
kernel-smp#2.4.20-30.9 2.4.20-30.9
kernel-smp#2.4.20-28.9 2.4.20-28.9
kernel-bigmem#2.4.20-30.9 2.4.20-30.9
kernel-bigmem#2.4.20-28.9 2.4.20-28.9
kernel-BOOT#2.4.20-30.9 2.4.20-30.9
kernel-BOOT#2.4.20-28.9 2.4.20-28.9
kernel#2.4.20-30.9 2.4.20-30.9
kernel#2.4.20-30.9 2.4.20-30.9
kernel#2.4.20-30.9 2.4.20-30.9
kernel#2.4.20-28.9 2.4.20-28.9
kernel#2.4.20-28.9 2.4.20-28.9
kernel#2.4.20-28.9 2.4.20-28.9
kernel-smp#2.4.20-8 2.4.20-8
kernel-bigmem#2.4.20-8 2.4.20-8
kernel-BOOT#2.4.20-8 2.4.20-8
kernel#2.4.20-8 2.4.20-8
kernel#2.4.20-8 2.4.20-8
kernel#2.4.20-8 2.4.20-8
You should explicitly select one to install.
E: Package kernel has no installation candidate
Now thia does not show the kiernel I have installed, possibly because it is somewhat old.
[root@Hackbox root]# uname -r
2.4.20-8
Now this kernel is in the list but does not say I have it installed. Anyway from this list for RH 9 which kernel should I install. I imagine I would want to get the newest release being 2.4.20-30.9 but I see there are multiple entries for this kernel.
kernel-smp#2.4.20-30.9 2.4.20-30.9
kernel-bigmem#2.4.20-30.9 2.4.20-30.9
kernel-BOOT#2.4.20-30.9 2.4.20-30.9
kernel#2.4.20-30.9 2.4.20-30.9
Now what are the differences in these 4 and what one would be best to install?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Apr 21, 2004 6:30 pm

If you do a "uname -a" you will see a little more info. If you are running a dual/multi processor machine (I'm guessing that you are not) you would likely have the "smp" kernel installed. Most people would have the regular uni-processor kernel installed which is probably the one you need. You would do this:

Code: Select all

# apt-get install kernel#2.4.20-30.9

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Wed Apr 21, 2004 6:41 pm

[root@Hackbox root]# apt-get install kernel#2.4.20-30.9
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
kernel#2.4.20-30.9
0 packages upgraded, 1 newly installed, 0 removed and 0 not upgraded.
Need to get 13.9MB of archives.
After unpacking 31.9MB of additional disk space will be used.
Get:1 http://ayo.freshrpms.net redhat/9/i386/updates kernel#2.4.20-30.9 2.4.20-30.9 [13.9MB]
Fetched 13.9MB in 3m12s (72.2kB/s)
Executing RPM (-ivh)...
Preparing... ########################################### [100%]
1:kernel ########################################### [100%]
stty: standard input: Invalid argument
stty: standard input: Invalid argument
stty: standard input: Invalid argument
Hmm Invalid arguments? Should I be concerned?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Apr 21, 2004 7:06 pm

Well, there really should be no concern because it shouldn't have removed your old kernel. Worst case you boot your old kernel (which should still be the default). It's hard to tell what caused the error. I would have to look at the spec file to see why the "stty" would be called, but I would highly doubt that it would have actually caused anything to fail. Did it add an entry to your /boot/grub/menu.lst file for the new kernel? You can actually see the commands that would have produced that error message by doing this:

Code: Select all

$ rpm --scripts -q kernel-2.4.20-30.9
It will probably show you that the /sbin/new-kernel-pkg script was run (at least on Fedora that's what gets run). My guess is that the error message was associated with that script.

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Wed Apr 21, 2004 9:58 pm

Yes it did make an entry to the /bun/grub/menu.1st.
[root@Hackbox root]# cat /boot/grub/menu.lst
# 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,1)
# kernel /vmlinuz-version ro root=/dev/hdc3
# initrd /initrd-version.img
#boot=/dev/hdc
default=1
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-30.9)
root (hd0,1)
kernel /vmlinuz-2.4.20-30.9 ro root=LABEL=/
initrd /initrd-2.4.20-30.9.img
title Red Hat Linux (2.4.20-8)
root (hd0,1)
kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
initrd /initrd-2.4.20-8.img
title Windows XP
rootnoverify (hd0,0)
chainloader +1
This seems strangely similar to the data that resides in /etc/grub.conf.
[root@Hackbox root]# cat /etc/grub.conf
# 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,1)
# kernel /vmlinuz-version ro root=/dev/hdc3
# initrd /initrd-version.img
#boot=/dev/hdc
default=1
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.20-30.9)
root (hd0,1)
kernel /vmlinuz-2.4.20-30.9 ro root=LABEL=/
initrd /initrd-2.4.20-30.9.img
title Red Hat Linux (2.4.20-8)
root (hd0,1)
kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
initrd /initrd-2.4.20-8.img
title Windows XP
rootnoverify (hd0,0)
chainloader +1
I did do the upgrade remotely, could that have anything to do with the error? I was ssh'd into my box upstairs via my laptop downstairs. Oh and before someone attacks me about the "Windows XP" partition, I ony have that on there for when I used to do a lot of video compression and rendering. AMD's are much better than P4's in that arena.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Apr 21, 2004 10:29 pm

ZiaTioN wrote: This seems strangely similar to the data that resides in /etc/grub.conf.
It should, they are the same file:

Code: Select all

# ls -alp /boot/grub/menu.lst
lrwxrwxrwx  1 root root 11 Jul 20  2003 /boot/grub/menu.lst -> ./grub.conf
# ls -alp /etc/grub.conf
lrwxrwxrwx  1 root root 22 Jul 20  2003 /etc/grub.conf -> ../boot/grub/grub.conf
Actually the real file is /boot/grub/grub.conf and the other two are symbolic links to it.
I did do the upgrade remotely, could that have anything to do with the error? I was ssh'd into my box upstairs via my laptop downstairs.
Quite possibly. You should be just fine.

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Thu Apr 22, 2004 9:54 am

Sorry the "same file" thing was my lame attempt at a joke. As for the kernel I booted into it last night on my RH system and it seems fine and I believe it will stay that way.

I just updated my Fedora system here at work a few minutes ago and did not recieve this error, but I am also here locally at this machine when I was not when I did my RH machine.
This new kernel appears to be stable on Fedora also and I had one last question. When I decide to set the new kernel to default would I change the "default=1" value to "default=0" or something?

chartoo
user
user
Posts: 32
Joined: Mon Mar 22, 2004 5:43 pm
Location: cerebral cortex
Contact:

Post by chartoo » Thu Apr 22, 2004 10:16 am

the "default=1" value to "default=0" or something?
default=0

;-)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Apr 22, 2004 10:32 am

Heh heh, I actually covered that at the bottom of my first reply in this thread. :)

chartoo
user
user
Posts: 32
Joined: Mon Mar 22, 2004 5:43 pm
Location: cerebral cortex
Contact:

Post by chartoo » Thu Apr 22, 2004 10:57 am

Heh heh, I actually covered that at the bottom of my first reply in this thread. :)
You certainly did, Olly.
VoidMain wrote
If you have checked out the new kernel and want to make it the default just change that to "default=0" (0 is the first kernel entry in the list).

I hope those were the answers you were looking for.
I got over excited 'cause I actually knew the answer.

;-)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Apr 22, 2004 11:32 am

I'm glad you did. I should lay off a little and let you do more answering. :)

Post Reply