How to downgrade kernel after bad update (16.04)

Recent upgrades to the Ubuntu 16.04 kernel (4.4.0-89 and -91) failed badly on my laptop. Happily, I’ve got the previous, working version still installed (4.4.0-57). For now I’ve got Grub configured to show me a menu, and I’m manually selecting -57 on boot, but this seems fragile, likely to break on a future sudo apt upgrade.

I think I want:

  • To remove -89 and -91, as they’re not doing me any good.
  • To make -57 the default for Grub, in a way that will persist through upgrades.
  • To ensure the -57 stays installed, even if I install later kernel upgrade
  • To be able to easily try later kernel updates, but revert back to -57 if it fails. My primary concern is -57 being automatically removed.
  • If I find a functioning later update, an easy path to return to undo all of this and return to following kernel updates.

Trying to remove -91 with sudo apt remove linux-image-4.4.0-91-genericrequires me to remove linux-generic and linux-headers-generic. That seems Bad, so I haven’t tried it.

I can find a variety of questions about the general problem, but none seem to address all of my goals, and most are old enough that I don’t think they apply any more.

What’s the best way to do this?

Addendum: This was flagged as a duplicate of How to prevent updating of a specific package? . That answer might address a portion of my question, but does not address the bigger picture.

Broadly, the issue is that the kernel is handled in an unusual way. It’s installed via linux-generic, which is nothing but a dependency on linux-image-generic and linux-image-headers. Those in turn are only dependencies on linux-linux-image-VERSION-generic and headers-VERSION-generic, packages noteworthy for baking the version number into the package name (presumably to make it easy to install multiple in parallel).

Specifically not addressed in that answer are:

  • Does not address how to remove -89 and -91.
  • Does not address how to make -57 the default for Grub, even if I install later updates.
  • Does not address how to ensure that -57 stays installed, even if I install later updates. Even if the answer is to hold one or more packages, given the several packages involved, which ones would I hold? If it’s a matter of holding linux-generic, how do I downgrade it first?
Asked By: Alan De Smet


Remove the latest kernel by

sudo apt remove linux-image-4.4.0-91-generic linux-headers-4.4.0-91-generic

That will uninstall meta packages linux-generic, linux-image-generic and linux-headers-generic. Kernels will never be upgraded.

To revert it you can run

sudo apt install linux-generic

That will install the latest kernel and kernels will get upgrades.

linux-generic is a meta package. It is empty, but depends on two other meta packages: linux-image-generic and linux-headers-generic.

The last two point to the latest kernel image and headers.

If you remove meta packages, nothing will be removed from the Linux, but kernel image and headers won’t get updates. You can always install them later. They will pull the latest “real” kernel packages.

So the solution is to manually remove the kernel packages you don’t want and also the meta packages.

Answered By: Pilot6

Although Pilot6’s solution may be the best solution, you can do less drastic measures.

I would personally remove the kernels you do not want from software center and then put those packages on hold – see How to prevent updating of a specific package?

This is a trivial change and you can over ride or revert the change rather easily.

Answered By: Panther
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.