How to block a debian package from being updated

less than 1 minute read

Sometimes you need to stick with an old version of the software for some reason. Maybe the UI has changed and you don’t like it or you want to use an old file formats like in case of KeePassX 0.4.3 (uses .kdb) and KeePassX 2.0.2 (converts .kdb to the backward incompatible .kdbx).

So, how to do that? Well, in case of Debian/Ubuntu based distributions it’s very simple, just run a single command:

sudo apt-mark hold <package>

This way you can run safely sudo apt update && sudo apt-upgrade without risk of the accidental update of your precious legacy package.

If you decide to enable back updates for a previously blocked package use the following command:

sudo apt-mark unhold <package>