Ubuntu – How to remove Kernel 3.1 that I added via a PPA

downgradekernelppa

Is there a way to remove kernel 3.1 from Oneiric?

I downloaded and upgraded to 3.1 with these instructions:

Open the terminal and run these two commands for both 32-bit and
64-bit versions of Ubuntu 11.10/11.04:

wget http://kernel.ubuntu.com/~kernel-ppa...241006_all.deb
sudo dpkg -i linux-headers-3.1.0-030100_3.1.0-030100.201110241006_all.deb

Ubuntu (64-bit)

For Ubuntu 11.10/11.04 (64-bit), issue these commands:

wget http://kernel.ubuntu.com/~kernel-ppa...1006_amd64.deb
sudo dpkg -i linux-headers-3.1.0-030100-generic_3.1.0-030100.201110241006_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa...1006_amd64.deb
sudo dpkg -i linux-image-3.1.0-030100-generic_3.1.0-030100.201110241006_amd64.deb

Everything went well. I was able to reboot quickly, but Firefox and Chrome constantly crash with Kernel 3.1. I am using Gnome 3.2 and saw improvement with 3.0.0.13 provided by ppa. Any help with 3.1 or just removing it would be helpful. Thanks to all that reply.

Best Answer

It is advisable, though not strictly necessary, to reboot and select an older kernel first. You can remove a kernel "under" the system that is running it--it will continue to stick around in memory and function OK. But just in case some problem has developed preventing your older kernels from working, you should try booting to one of them first. (Also, some installation processes might assume that the running kernel is actually installed.)

To use an older kernel, reboot and hold down Shift while your computer is starting up. You should see different options for booting, like a recovery mode and an option to check your memory/RAM. If you see any options for a kernel that is not version 3.1, select the latest such kernel (don't select "recovery mode"). That is, select the 3.0-series kernel with the highest version number, but do not select a 3.1-series kernel. If you don't see any such option, then select the option to view older kernels, and select it there.

In the unlikely event that you attempt to boot from an older kernel but cannot, you should not proceed with the uninstallation, as that might be the only kernel you have (if no others are listed) or the only kernel that is properly functioning. (In that case, you should post a comment to this question detailing what happened, and I'll add information about how to solve this problem to my question...or request more information if necessary. However, given the information you have provided, this situation is extremely unlikely.)

After booting from an 3.0-series kernel (or not, if you decided to forego that), you can remove the 3.1-series kernel you installed by running this command:

sudo apt-get purge linux-headers-3.1.0-030100 linux-headers-3.1.0-030100-generic linux-image-3.1.0-030100-generic

Using remove instead of purge (as suggested in the other answers so far) will work too but may leave some left-over global configuration files; purge is probably preferable.

It's not necessary to search for the packages to remove using something like dpkg -l | grep "linux\-[a-z]*\-" (as this answer suggests) or sudo aptitude search ~i | grep linux-image (as this one suggests) because we know exactly what packages you installed (since you provided the instructions used to install them, which includes the exact package names). Your older (i.e., 3.0-series) kernels would not have been removed automatically, and the version for this kernel would not have changed since you installed it by manually downloading and installing the .deb files rather than by actually enabling the PPA. (If you'd installed it from the PPA, then you still wouldn't have to search--you could just ppa-purge the PPA.) We also do not have to worry about virtual packages being installed that would result in the 3.1-series kernel coming back automatically; installing those virtual packages would give you the newer kernel, but installing the newer kernel as you did above would not install those virtual packages.

Thus the steps described above should be quite sufficient.