Exclude Packages from being Installed and Upgraded in Debian/Ubuntu

  • August 20, 2008
  • Avatar for peter

Package - http://www.sxc.hu/photo/918252

Package managers make life on Linux a whole lot easier. Instead of managing bits of software by yourself and sorting out the inevitable dependency hell, where one package depends upon another and that depends upon yet another and so on, you can have a clever bit of software do all the work.

Debian, Ubuntu and other derivatives use the .deb package format and Aptitude (Apt for short) as the package manager.

However, there are some occasions when your package manager can hinder, rather than help. It may end up insisting on installing or upgrading something you don't want, or upgrading something you want left alone at its current version. Its persistence could extend to your update manager on your desktop nagging you every five minutes - wouldn't it be nice to shut it up?

To avoid this problem, Apt users can specify to put specific packages on hold, preventing them from being upgraded or installed. Of course, you can easily remove this restriction later.

To do this, first install the Wajig program, which offers a simple command line interface to Dpkg and Apt.

$ sudo apt-get install wajig

Once the program is installed, you can put a package on hold, so it will be ignored by Apt, like so:

$ sudo wajig hold package

When you now go to upgrade or install new packages, you will not be pestered to update that package.

Naturally, when you want to remove this restriction, simply run the command again with 'unhold':

$ sudo wajig unhold package

Also, if at any time you want to see the list of packages that are on hold, run:

$ sudo wajig list-hold

A simple solution to what can be a rather irritating problem.

[image source]

Avatar for peter Peter Upfold

Home » Articles »