An up-to-date kernel is one requirement out of several. On its own it does not
mean the machine will pass verification. Ubuntu also releases updates for the
rest of the system. The full system upgrade installs those as well; the
kernel-only path leaves them alone.
Full system upgrade (packages included)
For a machine whose packages you already keep current. The kernel moves with everything else, and the whole upgrade is three commands:linux-oem-22.04 on certified OEM hardware or linux-nvidia, where step 1 of
the kernel-only path matches nothing.
--with-new-pkgs is not optional here. A kernel upgrade pulls in new versioned
packages such as linux-image-5.15.0-190-generic, and plain apt-get upgrade
will not install packages that are not already present, so it holds the kernel
back:
--with-new-pkgs allows those additions, and it never removes a package.
Confirm the new kernel is the one running, because the reboot on its own proves
nothing:
Kernel-only upgrade
For a machine where you want the kernel to move on its own and the rest of the system to stay where it is. The five steps below query the metapackage names rather than assuming them, install the update, and confirm it took.1. Find your kernel metapackage
Find which kernel metapackages are installed. These are the names you will upgrade in step 3, and they differ between machines, so save them to a variable that the later commands read:echo printed nothing,
stop: no linux-generic* metapackage is installed, and steps 2 and 3 have
nothing to act on.
More than one line is a valid result, and every one of them is upgraded
together:
KERNEL_METAPACKAGES lives only in the shell session you set it in. If your
connection drops, or you open a second terminal, set it again before
continuing.
Ubuntu ships two kernel stacks. GA is the kernel the release shipped with and is
supported for the life of the LTS release. HWE, the hardware enablement stack,
tracks the kernel from a later release to support newer hardware. Server
installations default to GA and offer HWE as an option, so most machines report
linux-generic.2. Check for updates
Refresh the package lists first, or you will be comparing against stale data.Installed and Candidate are the same, the machine is already at the
current patch level and step 3 has nothing to do. That is the normal result of a
routine check. Before calling it done, confirm the kernel you are running is the
newest one installed, since an earlier upgrade may be installed but never
rebooted into:
Candidate is the version you are about to install, and the
remaining steps need a maintenance window.
3. Install the kernel update
24 not upgraded is the rest of the
system being left alone, which is what keeps this from turning into a general
package upgrade during a maintenance window.
Upgrade the metapackage, not a bare
linux-image-... package. The metapackage
depends on both the image and the matching headers, which is why
linux-headers-5.15.0-190-generic appears above. DKMS needs headers matching
the kernel it is building for, and the NVIDIA driver is built by DKMS. Install
an image on its own and the driver has nothing to rebuild against, so the GPUs
disappear on the next boot.4. Reboot
The kernel you installed in step 3 does not become the running kernel until the machine restarts.5. Verify
Once the machine is back, check that the new kernel is the one running:Installed and Candidate must now be the same value. If Installed is still
what step 2 reported, nothing was patched, whatever the install output said.
The metapackage assignment is repeated here because the reboot ended the shell
session that held it. Note also that the metapackage version and the kernel
release are written differently: metapackage
5.15.0.190.169 installs kernel
5.15.0-190-generic. The 190 is the part that carries over.When
uname -r matches the newest kernel in /boot, Installed matches
Candidate, and nvidia-smi lists every GPU, the machine is up to date for its
release and back in service. Record the new kernel version and the date against
the machine for your own maintenance log; the next check reads the current state
from apt-cache policy rather than from that record.Recovery
Both paths end in a reboot. These two sections cover the ways that reboot goes wrong, and they apply whichever path you took.If the machine booted the old kernel
Step 5 is what surfaces this:uname -r reports an older version than the
newest kernel in /boot, while Installed and Candidate match. The upgrade
worked and the new kernel is on disk. GRUB did not boot it.
The machine is up and reachable here, so unlike the section below, this is
fixable over SSH.
Start with the entry GRUB is configured to boot. grub-mkconfig reads
/etc/default/grub first and then every /etc/default/grub.d/*.cfg, so a
drop-in overrides the main file and reading the main file alone can show you a
value that is not the one in effect. Resolve it the way grub-mkconfig does:
0 is the first entry in the generated menu, and Ubuntu builds that menu
in reverse version order, so entry 0 is the newest installed kernel. That is
what lets a new kernel boot without touching the bootloader.
Two values break it. GRUB_DEFAULT=saved boots whatever booted last, and
paired with GRUB_SAVEDEFAULT=true every boot re-saves the old kernel as the
default, so the machine stays on it through any number of upgrades. A
GRUB_DEFAULT pinned to one entry, by index or by title, boots that kernel and
ignores newer ones:
0, keeping a copy of the file first:
GRUB_SAVEDEFAULT only has an effect when GRUB_DEFAULT=saved, so once the
default is 0 it can stay as it is./etc/default/grub.d/, correct GRUB_DEFAULT
there as well. That file is sourced after the main one, so leaving it alone
means it overrides the edit you just made.
Editing the configuration changes nothing on its own. Regenerate the menu:
update-grub will change, and rebooting only lands you on
the old kernel again. Absence means grub-mkconfig did not find the kernel to
begin with: check that /boot is mounted and that
/boot/vmlinuz-<version> and the matching /boot/initrd.img-<version> both
exist for the version you installed.
uname -r should now match the newest kernel in /boot.