16

I'd like to block all distribution-shipped kernel updates due to a nasty thing that recently happened to me. (I'm on a Ubuntu 12.04 amd64 derivative.)

I'd like to block all updates to installed kernels of the minor version 3.2 to the linux-headers, linux-headers-generic, linux-image, and linux-image-extra packages. The problem I'm encountering is that these all have a version and if I block a specific version, nothing is gained because a new version will be installed (eg: if I block linux-image-3.2.0-35, linux-image-3.2.0-36 is not blocked and could still potentially be installed with a dist-upgrade from apt.)

18

What you need to use is a feature of apt-get called holding

You can either do this via Synaptic or Dpkg, Here is how I would hold my kernel using the dpkg method.

First check your kernel image name

dpkg -l | grep linux-image

output for me:

ii  linux-image-3.2.0-4-amd64              3.2.35-2                           amd64        Linux 3.2 for 64-bit PCs
ii  linux-image-amd64                      3.2+46                             amd64        Linux for 64-bit PCs (meta-package)

then tell dpkg to hold the metapackage (the generic version without any version numbers)

echo linux-image-amd64 hold | sudo dpkg --set-selections

You can then check this worked via dpkg -l linux-image-amd64

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                       Version            Architecture       Description
+++-==========================-==================-==================-==========================================================
hi  linux-image-amd64          3.2+46             amd64              Linux for 64-bit PCs (meta-package)

Notice the 'hi' at the bottom, h means held and i means currently installed. This package is installed but will not be upgraded.

You can reverse this via

echo linux-image-amd64 install | sudo dpkg --set-selections

and again can check via dpkg -l linux-image-amd64

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                       Version            Architecture       Description
+++-==========================-==================-==================-==========================================================
ii  linux-image-amd64          3.2+46             amd64              Linux for 64-bit PCs (meta-package)

Notice 'ii', the first i means this package is set to install and the second i means it is currently installed. This package is installed and will be upgraded.

For more information on these flags see man dpkg specifically the 'package selection states' sections.

  • 1
    My image names are here. Do I want to ban "linux-image-generic"? – Naftuli Kay Feb 1 '13 at 1:15
  • 1
    @TKKocheran yes; you want to place a hold on the metapackage, rather than a specific version. – cjh Feb 1 '13 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.