There are at least couple ways to hold specific package and prevent it from being updated
as you can use apt
, dpkg
, aptitude
, dselect
, apt preferences
,
but only the last one is effective in every case.
Solution
The easiest way is to read How APT Interprets Priorities section of the apt_preferences manual page, and use negative priority number.
Read above mentioned manual page to fully understand the consequences.
Example
I will use recently modified pykolab package to quickly describe the whole process.
I replaced pykolab
package but the system wants to update it.
# apt-cache policy pykolab pykolab: Installed: 0.5.11-5 Candidate: 0.5.11-5 Version table: 0.5.11-5 0 501 http://mirror.kolabsys.com/pub/debian/kolab-3.0/ wheezy/updates amd64 Packages *** 0.5.11-5 0 100 /var/lib/dpkg/status 0.5.11-1 0 501 http://mirror.kolabsys.com/pub/debian/kolab-3.0/ wheezy/release amd64 Packages
# apt-get upgrade -s Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: pykolab 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Inst pykolab [0.5.11-5] (0.5.11-5 Kolab 3.0.x Packages:testing [all]) Conf pykolab (0.5.11-5 Kolab 3.0.x Packages:testing [all])
To solve this problem I created APT preferences /etc/apt/preferences.d/pykolab
file where I assigned negative priority number to the pykolab
package.
Package: pykolab Pin: origin "mirror.kolabsys.com" Pin-Priority: -1
Quick verification that the mentioned problem is now solved.
# apt-cache policy pykolab pykolab: Installed: 0.5.11-5 Candidate: 0.5.11-5 Package pin: 0.5.11-5 Version table: 0.5.11-5 -1 501 http://mirror.kolabsys.com/pub/debian/kolab-3.0/ wheezy/updates amd64 Packages *** 0.5.11-5 -1 100 /var/lib/dpkg/status 0.5.11-1 -1 501 http://mirror.kolabsys.com/pub/debian/kolab-3.0/ wheezy/release amd64 Packages
# apt-get upgrade -s Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.