8

I have two kernels installed on my system. 3.16... and 3.19.3...I'm running Ubuntu 14.10 and it came with the 3.16...kernel. I decided to try the latest possible kernel (3.19.3...), but I sometimes get errors and the system feels unstable. I see no reason to keep this new kernel. Is there any issue I might run into if I choose to boot into the older kernel, and then remove the newer one using say, Synaptic? Will I run into issues once I reboot, or will Ubuntu just boot automatically into the older kernel with no fuss?

Any advice on the proper procedure and what methods to best achieve my goal would be appreciated. Thanks.

6

You can remove kernels the same way you remove other packages, as long as you are not booted in that kernel.

To get a list of the kernels you have installed, use dpkg -l with a grep as in:

dpkg -l | grep linux

There you will see the list of packages that got installed.

Then use the remove command of apt-get

sudo apt-get remove linux-...<name as shown by dpkg -l>

The headers do not need to be removed, the linux-image-... are the actual binaries that need removal.

Note that apt-get should automatically re-run the necessary commands to update grub and the startup RAM disk.

Of course, if you use apt-get update + apt-get upgrade (or the auto-upgrade which does the same), the newer kernel will get re-installed...

I think you can prevent re-installation, but I do not know the command for that.

  • Thanks! I cannot seem to upvote your answer without 15 reputation points (which I unfortunately don't have at the moment). I appreciate the answer though. – Wes Haq May 10 '15 at 20:12
4

This is very simple. First you need to know a few things about the kernel you want to remove. You gotta have its full name (For example, 3.19.0-15-generic). You can find this by booting with 3.19 kernel, opening Terminal (Ctrl+Alt+T) and running the command

uname -r

Take note of the output. Reboot with 3.16 kernel and open Terminal again, running the commands

sudo apt-get remove linux-headers-$(uname -r)
sudo apt-get remove linux-image-$(uname -r)
sudo update-initramfs -d -k $(uname -r)
sudo update-initramfs -u
sudo update-grub

And it is done! The next time you see GRUB, 3.19 kernel will not be there anymore.

  • Thanks! I cannot seem to upvote your answer without 15 reputation points (which I unfortunately don't have at the moment). I appreciate the answer though. – Wes Haq May 10 '15 at 20:12
  • No trouble, I'm here to help you! – Eduardo Cola May 10 '15 at 20:24
  • @WesHaq Hello Wes! You can select this as the solution by clicking the icon to the left. – mchid Jan 14 '18 at 18:09
  • 1
    Running sudo apt-get remove linux-headers-$(uname -r) will uninstall the currently running kernel. Do not do this. – Cerin Jul 27 '18 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.