Table of Contents

Ubuntu - aptitude - Hold a package

Blacklist package updates.

NOTE: This method works with both installed and uninstalled packages.


Hold a package

sudo aptitude hold [package name]
sudo aptitude hold nginx

Remove the hold for a package

sudo aptitude unhold [package name]
sudo aptitude unhold nginx

Forbid a package from being upgraded to a particular version, while allowing automatic upgrades to future versions

This is useful for example to avoid a known broken version of a package such as grub:

sudo aptitude forbid-version {pkg}={version}
sudo aptitude forbid-version bash=5.0-6ubuntu1.1

When you try to upgrade package using the aptitude command you will see message:

sudo aptitude upgrade

The following packages will be upgraded:

  libcomerr2 libx11-data 
2 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
....