How to exclude a package from being updated on Linux

Packages
Image by Marc Falardeau – CC BY 2.0

Sometimes you prefer not to update a specific package in Linux. This may be because you don’t want to upgrade to a new version with new features but no security updates. Or maybe because upgrading requires a service restart that you want to avoid just yet. This was the case for me recently when a new version of Docker came up and upgrading would have restarted the docker daemon and stopped the running containers.

It is possible to exclude a package from being updated. On Linux RPM systems (RedHat, CentOS, Fedora, etc.) this is the command to install all updates but exclude a specific package (say docker):

On Debian-like systems (Debian, Ubuntu, Mint, etc.) it is slightly more convoluted because you need to hold a package first and then upgrade the system

and remember to remove the hold when you’re ready to upgrade that package too

 

References:

https://access.redhat.com/solutions/10185

https://askubuntu.com/a/18656

Leave a Reply

Your email address will not be published. Required fields are marked *