Prevent Package Update

Many times we have a specific server requirement, for example a Nextcloud application would require a specific php version. But when we perform apt update, the php may update to latest version, thus breaking the Nextcloud installtion. So to prevent update of specific packages we can use below commands.

Hold a package:

sudo apt-mark hold <package-name>

Example:

sudo apt-mark hold php8.3*

Remove the hold:

sudo apt-mark unhold <package-name>

Show all packages on hold:

sudo apt-mark showhold

Last updated