Apt-Pinning on Debian & Ubuntu

If you have ever patched a software package, for example Postfix using this tutorial, then you probably noticed that on the next apt-get update, apt reports that the package needs updated. Of course we don’t want apt to update the package we just patched so in comes the package hold. You probably know there are multiple ways you can accomplish this task, however working a lot with Debian and Ubuntu, I like to use techniques that work on both systems. Below I will show you how to put packages on hold using the dpkg system. To set a package on hold, you can run the command below. Replace ‘postfix’ with the package(s) you wish to hold.

To remove a package from hold, you can run the command below. Replace ‘postfix’ with the package(s) you wish to unhold.

To see what the next version of the package is, use apt-cache policy packagename.

Did you find this article useful? Why not share it with your friends?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.