Skip to content

Did you know?

sudo apt-mark hold keeps a package at its current version during upgrades.

apt-mark showhold lists held packages; apt-mark unhold releases them.

Explained

Sometimes a package must not change, for example a database server you upgrade only in a planned window, or a kernel that a driver depends on. Put the package on hold:

sudo apt-mark hold nginx

apt upgrade now lists it under “packages have been kept back” and leaves it alone. Check and release holds with:

apt-mark showhold
sudo apt-mark unhold nginx

On Fedora and RHEL, the dnf versionlock command does the same; on older dnf versions it needs the python3-dnf-plugin-versionlock package:

sudo dnf versionlock add nginx

A hold also blocks security updates for that package, so treat it as temporary. Write down why you held it, and review your holds after each maintenance window.

Learn more

← All tech tips · Suggest a fix

Back to top