49

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

Ivan
  • 58,745

3 Answers3

44

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: release *
Pin-Priority: -1

By giving a negative priority for this pin we will block the installation of <nameofpackage>. A Pin criterion is required, but here we use a wildcard. We could blacklist more specific versions of the package by changing the Pin line, see man apt_preferences.

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 may break your package management.

For an alternative, and to prevent updating of a given package see:

Tobu
  • 473
Takkat
  • 144,580
7

I have a package that keeps sneaking back in and breaking git

sudo apt-mark hold libgnutls-deb0-28

should prevent that package from being installed

2

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

muru
  • 207,228
maniat1k
  • 8,340