Blacklist package updates.
NOTE: This method works with both installed and uninstalled packages.
sudo aptitude hold [package name] sudo aptitude hold nginx
sudo aptitude unhold [package name] sudo aptitude unhold nginx
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. ....