Canonical: kernel updates on a two-week cycle – GRUB menu at boot and availability of more older kernels

Hello everyone,
Given the increased risk of problems associated with the accelerated release of new kernels, shouldn’t we ?
1) Enable the GRUB menu at boot (for 5 seconds, for example)

sudo gedit /etc/default/grub

Option to retain the user’s kernel selection until the next selection is made:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5

or
Option to select the latest available kernel (do not save the user’s choice for the next boot):

GRUB_DEFAULT=0
#GRUB_SAVEDEFAULT=true
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5

Save and then :

sudo update-grub

2) Keep several older kernels available on the system (e.g. 3)

sudo gedit /etc/apt/apt.conf.d/01autoremove
Add between NeverAutoRemove { ... }; and VersionedKernelPackages { ... }; :
# Keep a custom amount of kernels when autoremoving. The logic dictates that
# the running kernel and the latest kernel are not autoremoved. In case the
# running kernel is the latest kernel, the previous kernel is kept. Any count
# lower than two is therefore disregarded.
NeverAutoRemove::KernelCount 4;

That makes one active kernel and three former kernels, making a total of 4.

At the end save.

Quick check after making changes:

apt-config dump | grep KernelCount

Must display:

APT::NeverAutoRemove::KernelCount "4";

The new formula will come into effect with the next kernel update.

4 Likes

Great tutorial, thank you :wink:

1 Like