Navigation:

Kernel issues

LTS enabled stacks: Updating the kernel in LTS versions of Ubuntu

sudo apt-get install --install-recommends linux-generic-hwe-16.04 xserver-xorg-hwe-16.04 

See this page for a description of LTS enabled stacks.

Modules included in kernel

To search for specific modules in the kernel, for example, to look for the wifi drivers that are included, use

modinfo iwlwifi

Removing old kernels

Newer and simpler instructions here: https://help.ubuntu.com/community/RemoveOldKernels

Use:

   $ sudo apt-get autoremove --purge 

Older info below:

https://help.ubuntu.com/community/RemoveOldKernels#Safely_Removing_Old_Kernels

For users of LVM systems, encrypted systems or limited-storage systems, the most frequent problem is that the /boot partition is simply full. The package manager cannot install a pending upgrade due to lack of space. Addiitionally, apt-get can not remove a package due to broken dependency.

This problem can be fixed from the shell: by manually remvoing one or two old kernels, we can provide the package manager enough space to install the queued upgrade.

First remove any leftover temporary files from previous kernel updates.

  $ sudo rm -rv ${TMPDIR:-/var/tmp}/mkinitramfs-*

Determine the version number of the currently running kernel, which you DO NOT want to remove.

  $ uname -r
  4.2.0-21-generic

List all the kernels, including the booted one (4.2.0-21-generic in this example), in the package database and their statuses.

$ dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+'

rc  linux-image-4.2.0-14-generic  ## The oldest kernel in the database
                                  ## Status 'rc' means it's already been removed
ii  linux-image-4.2.0-15-generic  ## The oldest installed kernel. Removable.
                                  ## Status 'ii' means Installed.
ii  linux-image-4.2.0-16-generic  ## Another old installed kernel. Removable.
ii  linux-image-4.2.0-18-generic  ## Another old installed kernel. Removalbe.
ii  linux-image-4.2.0-19-generic  ## The previous good kernel. Keep.
ii  linux-image-4.2.0-21-generic  ## Same version as 'uname -r', package for the current kernel. DO NOT REMOVE.
iU  linux-image-4.2.0-22-generic  ## DO NOT REMOVE. Status 'iU' means it's not installed,
                                  ## but queued for install in apt.
                                  ## This is the package we want apt to install.

To free space in /boot we'll remove an initrd.img file for a suitable old kernel manually, this is necessary due to a kenel packaging bug.

  $ sudo update-initramfs -d -k 4.2.0-15-generic

Now we'll use dpkg in order to TRY to purge the kernel package for the same old kernel:

  $ sudo dpkg --purge linux-image-4.2.0-15-generic

NOTE: The previous command will probably fail, as there probably is a depending linux-image-extra package installed together with a 'generic' kernel package. In general, the output of the previous command will tell which package you need to remove first. In this example case you would run

  $ sudo dpkg --purge linux-image-4.2.0-15-generic linux-image-extra-4.2.0-15-generic

Finally, we will fix the package installation process that previously failed.

  $ sudo apt-get -f install         ## Try to fix the broken dependency.

If the last command fails due to insufficient disk space in /boot, you have to purge another kernel (e.g. linux-image-4.2.0-16-generic) same way. Otherwise you could continue to chapter Manual Maintenance to remove more kernels. Make sure the linux-headers packages respective to the kernels purged above will also be purged.

AJMPublic/computing/linux-advanced (last edited 2023-04-02 08:06:46 by apw185)