Debian / Ubuntu Linux apt-get: Blacklist a Package From Installing

You can blacklist a package from being installed in Debian or Ubuntu using the apt-mark command. This allows you to prevent a package from being installed, updated, or removed, even if it is specified as a dependency by another package.

Here’s how to blacklist a package:

 
sudo apt-mark hold <package_name>

Replace <package_name> with the name of the package you want to blacklist.

To check the list of blacklisted packages, you can use the following command:

 
apt-mark showhold

This will display a list of all packages that are currently blacklisted.

To remove a package from the blacklist, use the following command:

 
sudo apt-mark unhold <package_name>

Replace <package_name> with the name of the package you want to remove from the blacklist.

Note that the blacklist only applies to the current system and does not affect other systems or users. Additionally, blacklisted packages can still be installed manually using the apt-get install command.

Leave a Comment