Debian – How to reliably “hold” a package in Debian

aptaptitudedebiandpkgpackage-management

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?

Best Answer

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

Related Question