Ubuntu – Disable Kernel Auto-Updates in Ubuntu 18.04 (cli only)


I have a setup that needs me to make some manual changes every time I do a kernel update.

I'd like be able to do kernel updates manually, instead of having unattended-upgrades push them into my system automatically.

I'm only interested in answers that can be done through the CLI as I don't have gnome-software or ubuntu-software GUIs.

I found an article that was talking on how to do this with Ubuntu 14/15:

sudo apt-mark hold linux-image-generic linux-headers-generic

Does this still work? It feels out of date because current kernels packages all have version numbers attached to package, eg. linux-headers-4.15.0-62. If I tell the system to hold linux-headers-4.15.0-62, I can't imagine a hold stopping the upgrader from automatically installing a newer kernel (eg. linux-headers-4.15.0-72) and setting it as the main kernel, seeing how updating does not actually replace the old kernel but simply makes the system use a new one.

If it doesn't work, is there something else I can try?

Best Answer

You can also add the packages to the 50unattended-upgrades config file:

nano /etc/apt/apt.conf.d/50unattended-upgrades

Locate the blacklist section, and edit to include the packages - even a regex is supported:

// List of packages to not update (regexp are supported)
Unattended-Upgrade::Package-Blacklist {
//      "vim";
//      "libc6";
//      "libc6-dev";
//      "libc6-i686";
Related Question