Table of Contents

Ubuntu - dpkg - Hold a package

NOTE: Package must be installed to put on hold.

  • Otherwise an error will be returned as follows:
dpkg: warning: package not in status nor available database at line 1: PACKAGE_NAME_HERE
dpkg: warning: found unknown packages; this might mean the available database
is outdated, and needs to be updated through a frontend method;
please see the FAQ <https://wiki.debian.org/Teams/Dpkg/FAQ>

Put a package on hold

echo "[package name] hold" | sudo dpkg --set-selections

Example

Put a bash package on hold.

echo "bash hold" | sudo dpkg --set-selections

Get the status of the packages

dpkg --get-selections [package name]

NOTE: Use the grep command to filter for a single package named bash.

dpkg --get-selections | grep bash

Delete the hold

echo "[package name] install" | sudo dpkg --set-selections

Example

echo "bash install" | sudo dpkg --set-selections