Holding a package on Debian

From Strugglers
Jump to: navigation, search

Sometimes you want a package on Debian to never be considered for upgrade by APT and friends.

In my case on pride I have to use a custom kernel with patches that are not in either upstream or in debian's kernel, so replacing my custom kernel with a newer Debian one is not helpful.

I think it is possible to use a setting of make-kpkg to generate packages whose version is high enough that no Debian package could ever be considered to replace them, but I did not do this with my custom kernel package and did not really want to generate a new kernel and install it just for this.

The answer appears to be to use dpkg to put the package on hold:

$ echo "kernel-image-2.6.8-2-386 hold" | sudo dpkg --set-selections

Now the package is never reported as being newly available for upgrade, and it is always held back when I apt-get upgrade.

Next time I compile the kernel though it will probably be better to work out how to do similar in make-kpkg.

Thanks to resiak and Xalior on #lugradio for the tips.

  • Footnote - if you use aptitude, you can achieve the same thing by selecting the package and pressing =