Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I configure Ubuntu to never install a specific package even if it is required by another package I install?

share|improve this question
You cannot install a package without its dependencies, unless you want to break your system. – enzotib Nov 5 '11 at 22:05
@enzotib, first of all you're wrong: package dependencies can be redundant. there are numerous examples, or you can have installed an equivalent of a required package another way (for example I have openjdk-6 installed as it is required by all the java applications in the repos, but I never actually use openjdk-6, I set up everything to use openjdk-7 or Oracle JDK 7 instead). And the second thing - I didn't say I want the dependant package to be installed - it can just throw an error in this case, I just want to make sure a particular package is never installed anyway. – Ivan Nov 5 '11 at 22:29
There is a similar question. – Nimmermehr Nov 8 '11 at 15:38

As in Debian we can use apt-pinning for version and installation control in Ubuntu too.

To block the installation of a given package we may put the following lines in /etc/apt/preferences

Package: <nameofpackage>
Pin: origin ""
Pin-Priority: -1

By giving a negative priority for this pin we will block the installation of <nameofpackage> from any origin. Of course we could also use apt-pinning to pin a certain package version or origin.

Before you proceed it is strongly recommended to read the documentation given above and the manpage from apt_preferences because errors in these files are not checked by apt and if they occur it may break your package management.

share|improve this answer
Do you know if this could work in Ubuntu 12.04? Another question is reporting that maybe it doesn't work. – Lucio Feb 20 '13 at 19:27
@Lucio: sure - it still works; just tested it to work in 12.10 too. – Takkat Feb 20 '13 at 21:32
In the Package:-line, you can list multiple packages separated with spaces, like this: Package: metacity metacity-common libmetacity-private0a. (Seems like patterns like Package: metacity* are also possible) – Volker Siegel Aug 22 '14 at 2:46

In debian you can block a package, and that package wont upgrade anymore

# echo name_of_package hold | dpkg --set-selections

but I'm not sure that you can forbid

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.