How to prevent a package update in Debian (dpkg, aptitude, dselect). Not for *buntu kids …

If you want to lock some packages on your debian PC, then you can use next variants. As told in debian online manual (

7.12 How do I put a package on hold?

There are three ways of holding back packages, with dpkg, aptitude or with dselect.

With dpkg, you have to export the list of package selections, with:

     dpkg --get-selections \* > selections.txt

Then edit the resulting file selections.txt, change the line containing the package you wish to hold, e.g. libc6, from this:

     libc6                                           install

to this:

     libc6                                           hold

Save the file, and reload it into dpkg database with:

     dpkg --set-selections < selections.txt

With aptitude, you can hold a package using

     aptitude hold package_name

and remove the hold with

     aptitude unhold package_name

With dselect, you have to enter the [S]elect screen, find the package you wish to hold in its present state, and press the `=' key (or `H'). The changes will go live immediately after you exit the [S]elect screen. 

For example to set 'hold' on the kernel packages:

root@vm-12:~# dpkg --get-selections|egrep 'linux-images|linux-headers'| awk '{print $1."\thold"}' | dpkg --set-selections
root@vm-12:~# dpkg --get-selections|egrep 'linux-images|linux-headers'
linux-headers-2.6-686                           hold
linux-headers-2.6.32-5-686                      hold
linux-headers-2.6.32-5-common                   hold
Scroll to top