Skip to content

Instantly share code, notes, and snippets.

@aamsur-mkt
Created October 2, 2020 09:23
Show Gist options
  • Save aamsur-mkt/43c18198e88950328afc0f79447a63a7 to your computer and use it in GitHub Desktop.
Save aamsur-mkt/43c18198e88950328afc0f79447a63a7 to your computer and use it in GitHub Desktop.
Hold or prevent updating of a specific package Linux Ubuntu

Holding

There are four ways of holding back packages: with dpkg, apt, aptitude or dselect.

dpkg

Put a package on hold:

echo "<package-name> hold" | sudo dpkg --set-selections

Remove the hold:

echo "<package-name> install" | sudo dpkg --set-selections

Display the status of your packages:

dpkg --get-selections

Display the status of a single package:

dpkg --get-selections | grep "<package-name>"

apt

Hold a package:

sudo apt-mark hold <package-name>

Remove the hold:

sudo apt-mark unhold <package-name>

Show all packages on hold:

sudo apt-mark showhold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment