Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
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 ) –  Luciano Facchinelli Oct 23 '11 at 7:31
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. –  Faheem Mitha Aug 2 '12 at 16:41
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." –  Faheem Mitha Aug 2 '12 at 16:42
@FaheemMitha: Thanks for the update. –  jrdioko Aug 2 '12 at 18:05

4 Answers 4

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

share|improve this answer

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).

share|improve this answer
Looks like this isn't true, see the comments above. –  jrdioko Aug 2 '12 at 18:04

Apt pinning will do what you seek.

share|improve this answer
What's its advantage over the other methods? Clearly the OP knew that pinning was an option, but why or how is it better than the other options (or options not given by the OP)? –  0xC0000022L Nov 15 '13 at 19:44

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.