I have a package in Debian that has been manually patched (not ideal, I know) that I must hold at its current version so upgrades don't overwrite the patched changes (I will manually inspect and apply security updates). As I understand it, there are a few ways to approach this:

  • apt-pinning (see apt_preferences(5))
  • aptitude hold
  • dpkg --set-selections
  • setting it with dselect?

I've read that one hold won't affect another (so, for example, using aptitude hold won't prevent apt-get or dselect from upgrading the package). What needs to be done to 100% ensure that Debian's tools will never upgrade the package unless I remove the hold?

  • 1
    Just a comment, 9 years ago someone created a bug in Debian's bug system about how really can hold a package, and seems like there is (or was) some issues using aptitude hold ( LINK: bugs.debian.org/cgi-bin/bugreport.cgi?bug=146207 ) Commented Oct 23, 2011 at 7:31
  • 1
    That someone would be me. :-). Still an open bug, though the people who have recently revived aptitude said they would take a look at it. Commented Aug 2, 2012 at 16:41
  • 1
    Daniel Hartwig wrote to me: "Been aware of this issue with holds since I began working on aptitude. At the moment I have not given it a thorough look as my focus has been on getting multi-arch working. It's age and significance does intimidate me a bit. There is also the matter that aptitude somewhat "interprets" dpkg states on startup to determine what, if any, changes and how they should incorporate in to it's internal state model. Be assured that this one will not be left alone -- I am always mindful of it when looking at related areas of the code." Commented Aug 2, 2012 at 16:42
  • 1
    bugs.debian.org/146207 is supposedly fixed in the version of aptitude uploaded to unstable. Commented Oct 25, 2015 at 16:41

3 Answers 3


aptitude and dpkg have separate hold functions which won't respect each other, unfortunately. So you have to set both if you use both tools:

apt/dpkg: echo $PACKETNAME hold | dpkg --set-selections

aptitude: aptitude hold $PACKETNAME


A better approach in this particular case (patched package) could be to install the patched version in /usr/local. Debian won't touch that.


As far as I know, aptitude hold <package> will be honored by the others unless you explicitly order it upgraded (such as hitting + while the cursor is on the "upgradeable packages" field in aptitude).

  • 3
    Looks like this isn't true, see the comments above.
    – jrdioko
    Commented Aug 2, 2012 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .