UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

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

without comments

If you want to lock some packages on your debian PC, then you can use next variants. As told in debian online manual (http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html):

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
root@vm-12:~# 

Written by spectre

April 30th, 2013 at 12:50 pm

Leave a Reply

*