Lock packages
Introduction
Sometimes you’d like to lock a package at a specific version and not allow it to be updated. This document shows how that can be done and undone. The package will not be updated unless you manually unlock it or update to a new release of Kubuntu or Ubuntu.
Check the dependencies of the package
Please be careful when deciding to lock a package. Do some research to be sure doing so won’t negatively impact the rest of the system. If other programs depend on the file, they may not run properly or at all with a file that isn’t current.
To get detailed information about a package and its dependencies and reverse dependencies, type this command in a terminal window, replacing XXX with the package name (the version number is not needed) to get detailed information about a package and its dependencies and reverse dependencies:
apt-cache showpkg XXX
-
Example:
apt-cache showpkg amarok
Result:
Package: amarok Versions: 2:2.5.0-0ubuntu6 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages) (/var/lib/dpkg/status) Description Language: File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages MD5: 8cb0abbd7a36a44af04429c5df99b014 Description Language: en File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en MD5: 8cb0abbd7a36a44af04429c5df99b014 Reverse Depends: tangerine,amarok 2.0 remuco-amarok,amarok 2.0 moodbar,amarok ichthux-desktop,amarok ezgo-multimedia,amarok kubuntu-full,amarok kubuntu-desktop,amarok amarok-utils,amarok 2.1.80-1~ amarok-utils,amarok 2.1.80-1~ amarok-help-uk,amarok amarok-help-sv,amarok amarok-help-ru,amarok amarok-help-pt-br,amarok amarok-help-pt,amarok amarok-help-nl,amarok amarok-help-it,amarok amarok-help-fr,amarok amarok-help-et,amarok amarok-help-es,amarok amarok-help-en,amarok amarok-help-de,amarok amarok-dbg,amarok 2:2.5.0-0ubuntu6 amarok-common,amarok 2:2.5.0-0ubuntu6 Dependencies: 2:2.5.0-0ubuntu6 - amarok-common (5 2:2.5.0-0ubuntu6) amarok-utils (5 2:2.5.0-0ubuntu6) kde-runtime (0 (null)) libc6 (2 2.8) libcurl3-gnutls (2 7.16.2-1) libgcc1 (2 1:4.1.1) libgcrypt11 (2 1.4.5) libgdk-pixbuf2.0-0 (2 2.22.0) libgl1-mesa-glx (16 (null)) libgl1 (0 (null)) libglib2.0-0 (2 2.14.0) libgpod4-nogtk (18 0.7.0) libgpod4 (2 0.7.0) libkcmutils4 (2 4:4.5.86) libkdecore5 (2 4:4.5) libkdeui5 (2 4:4.5.2) libkdewebkit5 (2 4:4.5) libkdnssd4 (2 4:4.5) libkfile4 (2 4:4.5) libkio5 (2 4:4.5) libknewstuff3-4 (2 4:4.5) liblastfm0 (2 0.4.0~really0.3.3) libloudmouth1-0 (2 1.1.4-2) libmtp9 (2 1.1.0) libmygpo-qt1 (2 1.0.2) libmysqlclient18 (2 5.5.13-1) libphonon4 (2 4:4.7.0really4.3.80) libplasma3 (2 4:4.5.86) libqjson0 (2 0.7.1) libqt4-dbus (2 4:4.6.1) libqt4-network (2 4:4.5.3) libqt4-opengl (2 4:4.5.3) libqt4-script (2 4:4.5.3) libqt4-sql (2 4:4.5.3) libqt4-svg (2 4:4.5.3) libqt4-xml (2 4:4.5.3) libqtcore4 (2 4:4.8.0) libqtgui4 (2 4:4.8.0) libqtwebkit4 (2 2.2~2011week36) libsolid4 (2 4:4.5) libstdc++6 (2 4.6) libtag-extras1 (2 1.0.0) libtag1c2a (2 1.6.1) libthreadweaver4 (2 4:4.5) libx11-6 (0 (null)) libxml2 (2 2.7.4) phonon (0 (null)) zlib1g (2 1:1.2.0) libqtscript4-core (0 (null)) libqtscript4-gui (0 (null)) libqtscript4-network (0 (null)) libqtscript4-xml (0 (null)) libqtscript4-sql (0 (null)) libqtscript4-uitools (0 (null)) libxine1-ffmpeg (0 (null)) libqt4-sql-sqlite (0 (null)) libqt4-sql-mysql (0 (null)) libqt4-sql-psql (0 (null)) moodbar (0 (null)) kdemultimedia-kio-plugins (2 4:4.2.0) Provides: 2:2.5.0-0ubuntu6 - Reverse Provides:
Check the status of the package
The “Status” line tells you whether the package is installed or not. It also tells you if the package is locked. An unlocked package will show as “Status: install ok installed” and a locked package will show as “Status: hold ok installed”.
To check the status of a package, type this command in a terminal window, replacing XXX with the package name (the version number is not needed):
dpkg --get-selections XXX
-
Example:
dpkg --get-selections amarok
Result if the package isn’t locked:
amarok install
Result if the package is locked:
amarok hold
Lock the package
To lock a package, type this command in a terminal window, replacing XXX with the package name (the version number is not needed):
echo "XXX hold" | sudo dpkg --set-selections
-
Example:
echo "amarok hold" | sudo dpkg --set-selections
Unlock the package
To unlock a package, type this command in a terminal window, replacing XXX with the package name (the version number is not needed):
echo "XXX install" | sudo dpkg --set-selections
-
Example:
echo "amarok install" | sudo dpkg --set-selections
Obligatory Happy Ending
And they all lived happily ever after. The end.

Comment: