10

I upgraded Ubuntu to 12.04, all packages. But after that I encountered a lot of problems so I decided to downgrade to 11.10.

After I did that I found I now have two kernels: 3.2.x and 3.0.x. I found many explanations of how to remove older kernels, but i have no idea how to remove the newer kernel.

I dont see a 3.2 kernel running when im using the 3.0 kernel. But I see it in Grub.

When I type uname -r in terminal I see the 3.0.x kernel which im using at present.

How do I proceed to remove the 3.2 kernel?

0xF2
  • 3,154
Pawel
  • 109

3 Answers3

11

There are 3 files you will need to remove, more if you are using a virtual machine too. But these are the main ones.

Open synaptic, use the search to find the installed kernels

  • linux-headers-3.2.x.x
  • linux-headers-3.2.x.x-generic (possibly generic-pae or i686)
  • linux-image-3.2.x.x

Should be easy enough to remove. Afterward run

sudo update-grub
Zanna
  • 70,465
Ringtail
  • 16,127
  • I dont see any version of kernel in synaptic, other than 3.0.0.x – Pawel Feb 21 '12 at 08:03
  • Strange, are you sure that you still have the package installed or is it a ghost contained in GRUB? I would run "sudo update-grub" and see if it goes away. If not look into your /boot folder and see if there are any remains of the kernel in question. – Ringtail Feb 21 '12 at 20:30
  • After update grub i have in console:

    Generating grub.cfg ... Found linux image: /boot/vmlinuz-3.2.0-17-generic Found initrd image: /boot/initrd.img-3.2.0-17-generic Found linux image: /boot/vmlinuz-3.0.0-16-generic Found initrd image: /boot/initrd.img-3.0.0-16-generic

    Also i /boot directory i have entries with 3.2.x version.

    – Pawel Feb 21 '12 at 21:27
  • OK if you open synaptic and search 3.2.0-17 what are the results? – Ringtail Feb 21 '12 at 21:56
  • Empty list. No results. – Pawel Feb 22 '12 at 08:15
  • Apparently there is no such package on your system otherwise synaptic would pick up on it. – Ringtail Feb 22 '12 at 16:14
  • Hm. weird, beacuse i can run linux on this 3.2.x kernel ... – Pawel Feb 23 '12 at 16:50
  • Right now I am running Natty on 3.2.4-030204-generic-pae and had a rough time removing the 2.6.38 one I had. – Ringtail Feb 23 '12 at 17:31
6

This should remove your 3.2 kernel:

sudo apt-get remove --purge 3.2.x-xx-*

Obviously, replace the x's with the actual version numbers from your 3.2 kernel version. If you don't remember what those numbers are, you should be able to see them by looking in the /boot directory.

The last time I did this, I recall it triggering a grub-update to remove it from the GRUB menu as well.

-This works best for removing newer kernels that you want remove like 3.3.0 +, which would not be found in synaptic, this is a life saver! -Rabbit2190

Aaron
  • 6,714
  • Afther this command: E: Couldn't find any package by regex '3.2.0-17-generic' – Pawel Feb 21 '12 at 08:04
  • Do you see any files with that version in your /boot dir? Based-on the comments on BlueXrider's answer it almost sounds like it's already been removed. – Aaron Feb 22 '12 at 13:33
0

I think the second will work for you :

1. For uninstalling the kernel run:

sudo apt-get remove linux-image-version_number*

sudo apt-get remove linux-headers-version_number*

sudo apt-get remove linux-image-extra-version_number* (if applicable)

or simply uninstall them from synaptic/software center.

2. For uninstalling the kernel installed from source, run:

sudo rm -rf /lib/modules/kernel_version

sudo rm -f /boot/vmlinuz-kernel_version*

sudo rm -f /boot/initrd.img-kernel_version*

sudo rm -f /boot/config-kernel_version*

sudo rm -f /boot/System.map-kernel_version*

Finally, after uninstalling the kernel by either one of the processes above, run:

sudo update-grub

to clean the grub menu.