Ubuntu – How to pin the lowlatency kernels so apt doesn’t update with a newer generic kernel

12.04aptkernelpackage-managementpinning

I'm on Kubuntu 12.04 with lts-raring HWE stack. I'm running kernel 3.8.0.30.18 low latency. A recent update replaced my low latency kernel with a slightly newer (3.8.0.31) generic kernel. I wish to prevent this and to use only the low latency kernels. How would I do this?

I believe this information is required:

$ dpkg -s kxstudio-kernel-lowlatency
Package: kxstudio-kernel-lowlatency
Status: install ok installed
Priority: optional
Section: metapackages
Installed-Size: 26
Maintainer: falkTX <falktx@gmail.com>
Architecture: all
Source: kxstudio-kernel
Version: 2.4~precise1
Depends: linux-lowlatency, linux-image-lowlatency, linux-headers-lowlatency
Description: The KXStudio kernels - Low-Latency
 This is a metapackage that provides the lowlatency kernel

I also wish to know exactly how to use apt-cache policy to verify that the installation candidates (for any kernel) are correct. The command below would apparently not show me when a generic kernel might supersede a low latency kernel.

$ apt-cache policy linux-lowlatency
linux-lowlatency:
  Installed: 3.8.0.30.18
  Candidate: 3.8.0.30.18
  Version table:
 *** 3.8.0.30.18 0
        500 http://ppa.launchpad.net/kxstudio-team/kernel/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
     3.2.0.54.43 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/universe amd64 Packages
     3.2.0.23.20 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages

Best Answer

sudo apt-get autoremove --purge linux-image-generic

If you don't ever want to use the pure -generic kernel image, then simply remove it. You might also have to separately remove the actual kernel image, as well as this meta-package. Just make sure you have a usable kernel image installed before removing some of them. Then apt will simply not update that which is not installed.

The -generic kernels do not supersede the -lowlatency kernels. However, the last kernel that was installed, becomes the default. You will still have the -lowlatency kernel installed, and you can still choose it within the grub boot menu, or even change it to be the default again.