Block updates of a specific package

If you wanting to block updates of a specific package you can use the command “apt-mark” to put a hold on the package. There are various techniques to disable/lock package from install, upgrade and remove in Debian Linux and its derivatives such as Ubuntu and Linux Mint. The command apt-mark will mark or unmark a software package as being automatically installed and it is used with option hold or unhold.

  1. hold – this option used to mark a package as held back, which will block the package from being installed, upgraded or removed.
  2. unhold – this option used to remove a previously set hold on a package and allow to install, upgrade and remove package.

Example #1: 

To hold a package:
sudo apt-mark hold <package>

To unhold a package:
sudo apt-mark unhold <package>

Example #2

To hold a package:
echo <package> hold | sudo dpkg –set-selections

To unhold a package:
echo <package> install | sudo dpkg –set-selections

You may also want to get the version of package installed on you system which can be done using “dpkg” and “-s” flag.
dpkg -s <package name>