PDA

View Full Version : Backing out a Kernel



yakky58
26th May 2009, 08:38 PM
I allowed a update on yum to load up a new kernel....

2.6.27.25-170.2.68 no problem it installed. Trouble is there was no nvida driver to match and I lost
my X session. I was able to get into the Grub menu and load the previous version 2.6.27.21-170.2.56. Once this was done I altered my grub.conf to point to the old kernel. Hey presto It all works ok except I now have a kernel installed that doesn't work. I guess I could wait for the compatible nvida.ko driver but I would like to know how I can back off the new kernel...

grub.conf.....
#boot=/dev/sda
default=1
timeout=10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.27.24-170.2.68.fc10.i686)
root (hd0,0)
kernel /boot/vmlinuz-2.6.27.24-170.2.68.fc10.i686 ro root=UUID=8a9872f7-4a2c-48eb-9307-24d1de85af6f rhgb quiet
initrd /boot/initrd-2.6.27.24-170.2.68.fc10.i686.img
title Fedora (2.6.27.21-170.2.56.fc10.i686)
root (hd0,0)
kernel /boot/vmlinuz-2.6.27.21-170.2.56.fc10.i686 ro root=UUID=8a9872f7-4a2c-48eb-9307-24d1de85af6f rhgb quiet
initrd /boot/initrd-2.6.27.21-170.2.56.fc10.i686.img
title Fedora (2.6.27.5-117.fc10.i686)
root (hd0,0)
kernel /boot/vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=8a9872f7-4a2c-48eb-9307-24d1de85af6f rhgb quiet
initrd /boot/initrd-2.6.27.5-117.fc10.i686.img
[root@Fedora10 grub]#

Any one have a good HOWTO.

Thanks.

stoat
26th May 2009, 08:50 PM
Hello yakky58,

When that has happened to me, I just used the rpm command to delete the unwanted kernel. That will also remove the grub.conf entry. For example, list the installed kernels first...
rpm -qa | grep kernelThen copy and paste the relevant one to this...
su
rpm -e [kernel package name]After you get this fixed, you can exclude kernels from your routine system updates by editing /etc/yum.conf and adding this...
exclude=kernel*Then when you feel lucky or whatever, you can comment out the line and do an update that includes the kernel.

yakky58
26th May 2009, 09:19 PM
perfect answer ... works one to save away in my Linux Tips...

Thanks Stoat.

pwca
26th May 2009, 09:24 PM
And you can do the same thing with yum if you're not comfortable using rpm.

This command will show the kernels installed (including devel, headers, docs and firmware)

yum list installed kern*

Copy and paste the kernel you want to remove into this command and it will remove the kernel as well as the stuff related to it (most times anyway)

yum remove [kernel package name]

Then modify the yum.conf as stoat suggested above to keep ALL future kernel updates from happening. If at some point in the future you would like to try another kernel you will have to force the install or change the yum.conf file back to what it was before.

Dangermouse
26th May 2009, 09:41 PM
Or you could of installed akmod-nvidia if you wanted to use the latest kernel with nvidia

edit, or if you did install akmod-nvidia before, just update kernel-devel

bg3075
27th May 2009, 02:40 AM
And you can do the same thing with yum if you're not comfortable using rpm.

This command will show the kernels installed (including devel, headers, docs and firmware)

yum list installed kern*

Copy and paste the kernel you want to remove into this command and it will remove the kernel as well as the stuff related to it (most times anyway)

yum remove [kernel package name]

Then modify the yum.conf as stoat suggested above to keep ALL future kernel updates from happening. If at some point in the future you would like to try another kernel you will have to force the install or change the yum.conf file back to what it was before.
I am having same problem...I would like to do this, pwca, but the kernel I am running, 2.6.27.21-170.2.56.fc10 , and the one I'd like to get rid of, 2.6.27.24-170.2.68.fc10, have the same package name, kernel.i686 (see below):



kernel.i686 2.6.27.5-117.fc10 installed
kernel.i686 2.6.27.21-170.2.56.fc10 installed
kernel.i686 2.6.27.24-170.2.68.fc10 installed
kernel-debug.i686 2.6.27.21-170.2.56.fc10 installed
kernel-debug.i686 2.6.27.24-170.2.68.fc10 installed
kernel-devel.i686 2.6.27.21-170.2.56.fc10 installed
kernel-devel.i686 2.6.27.24-170.2.68.fc10 installed
kernel-firmware.noarch 2.6.27.24-170.2.68.fc10 installed
kernel-headers.i386 2.6.27.24-170.2.68.fc10 installed
kerneloops.i386 0.12-2.fc10 installed


This is what it returned...I did not want to get rid of all of these, so I backed out (see below). Is there a way to repair a kernel?



Package Arch Version Repository Size
================================================== ================================================== ============
Removing:
kernel i686 2.6.27.24-170.2.68.fc10 installed 50 M
kernel i686 2.6.27.21-170.2.56.fc10 installed 50 M
kernel i686 2.6.27.5-117.fc10 installed 50 M
Removing for dependencies:
kmod-ndiswrapper i686 1.53-5.fc10.21 installed 0.0
kmod-ndiswrapper-2.6.27.21-170.2.56.fc10.i686 i686 1.53-5.fc10.17 installed 186 k
kmod-ndiswrapper-2.6.27.24-170.2.68.fc10.i686 i686 1.53-5.fc10.21 installed 186 k
kmod-nvidia i686 180.51-1.fc10.5 installed 0.0
kmod-nvidia-2.6.27.21-170.2.56.fc10.i686 i686 180.51-1.fc10.1 installed 7.5 M
kmod-nvidia-2.6.27.24-170.2.68.fc10.i686 i686 180.51-1.fc10.5 installed 7.5 M
ndiswrapper i386 1.53-2.fc10 installed 76 k
xorg-x11-drv-nvidia i386 180.51-1.fc10 installed 7.6 M
xorg-x11-drv-nvidia-libs i386 180.51-1.fc10 installed 21 M

Transaction Summary
================================================== ================================================== ============
Install 0 Package(s)
Update 0 Package(s)
Remove 12 Package(s)

stoat
27th May 2009, 01:29 PM
I would like to do this, pwca, but the kernel I am running, 2.6.27.21-170.2.56.fc10 , and the one I'd like to get rid of, 2.6.27.24-170.2.68.fc10, have the same package name, kernel.i686Hello bg3075,

But that's not really the package name that you need if you want to remove it. Yum would need to have the full package name with the arch and version and in the proper format. I like to use rpm -qa | grep kernel to get a list of the currently installed kernel package names. Why don't you try that. Then use the result with yum or rpm.

bg3075
28th May 2009, 12:22 AM
OK, I just removed all kernels associated with the name "2.6.27.24-170.2.68.fc10", including those with "devel" and "debug" within the name. I got a message to update back to the same kernel, on my panel bar. Should I try to re-update to the same kernel...I used it for a couple weeks before it crapped out. I think I messed it up somehow by following tips, in the online Fedoraguide, for speeding up Firefox and Fedora bandwidth tweaks.

BTW, how do you guys type the vertical bar, such as in rpm -qa | grep kernel?

bg3075
28th May 2009, 12:53 AM
Hello yakky58,

When that has happened to me, I just used the rpm command to delete the unwanted kernel. That will also remove the grub.conf entry. For example, list the installed kernels first...
rpm -qa | grep kernelThen copy and paste the relevant one to this...
su
rpm -e [kernel package name]After you get this fixed, you can exclude kernels from your routine system updates by editing /etc/yum.conf and adding this...
exclude=kernel*Then when you feel lucky or whatever, you can comment out the line and do an update that includes the kernel.

This is what is in my yum.conf file (below)...see the notes at the bottom of the file; would adding the kernel exclusion line, that stoat suggested, screw up the file based on making it bigger then, as the notes in the file recommend not doing?

BTW, thanks to you all for the help.

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

stoat
28th May 2009, 12:55 AM
OK, I just removed all kernels associated with the name "2.6.27.24-170.2.68.fc10", including those with "devel" and "debug" within the name.That's exactly what I do in that situation (rare, thankfully).





I got a message to update back to the same kernel, on my panel bar. Should I try to re-update to the same kernel...I used it for a couple weeks before it crapped out.You can try it. If it misbehaves, then you can boot it out the door again.





BTW, how do you guys type the vertical bar, such as in rpm -qa | grep kernel?It's done with shift + \. On your keyboard it will look like two vertically aligned dashes.

stoat
28th May 2009, 01:01 AM
...would adding the kernel exclusion line, that stoat suggested, screw up the file based on making it bigger then, as the notes in the file recommend not doing?It won't hurt a thing. I've been adding that line for a long time now. I comment it out (with the # character) every now and then when I want to try a new kernel. It hasn't harmed me in any way. It probably doesn't matter, but I like to put the exclude line up in the top section like this example...
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
exclude=kernel*

# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


P.S.: For the longest time, I never did this exclude thing for kernels. I never thought twice about kernel updates. Nothing bad ever happened. Then about two years ago or so, that seemed to change IMO. New kernels began to bust things sometimes. Wireless. Video. Whatever. It could be anything. It seemed to get a little worse over time. That's when I started doing this. It works for me. But that's just my opinion. I think keeping things (including kernels) updated is good and appropriate. I just update kernels less often, that's all.

P.P.S.: If anybody else wants to add their own comments for bg3075 about excluding kernels from routine yum updates, then feel free to do it. My comments are just my opinions and my personal policy regarding new kernels. I don't want or intend to suggest that it's necessarily for everybody. I thought the situations of yakky58 and bg3075 in this thread might make the idea worth considering.

bg3075
28th May 2009, 01:30 AM
I'll give it a try, stoat...thanks a lot, Bro!

yakky58
4th June 2009, 09:17 PM
Hi Stoat,

I think this is good idea to exclude the kernel. The real issue I have is that a kernel is released and the associated nvidia driver is not released at the same time or is in a beta status and thus the system gets in a mess. I have spent lots of time checking so that a exclude is useful to stop automatic updates.