I need your advice as I don't know if I hit a bug, or I am misunderstanding something.

On a Debian Lenny, I am trying to prevent the installation of two particular packages, when they are requested as dependencies fromother packages. I am using the same syntax I successfully used in Squeeze, but with no success at all.

On squeeze, the following works as expected:

# cat /etc/apt/preferences.d/local-no-pike.pref
Package: pike7.6-core
Pin: version *
Pin-Priority: -1000

If I try to install pike7.6, which depends on pike7.6-core, apt and aptitude refuse to do so.

On Lenny, the only difference is that there is no support for "fragments" in /etc/apt/preferences.d, and all preferences must be in the /etc/apt/preferences file. But it's not working. E.g., if the file contains:

Package: grub-common
Pin: version *
Pin-Priority: -1000

apt doesn't stop me from installing grub, which depends on grub-common.

I used strace to see if the file is being read, and it is. I was suggested to use some Debug:: options, but they didn't help to pinpoint the problem either. I have google'd a lot with some combinations of "lenny" "prevent" "package" "installation" "pinning" and the like, but nothing nice came out. And of course I read man apt_preferences.

What am I missing here?


1 Answer 1


as a workaround you can prevent a package upgrade by setting it to "hold" in dpkg:

echo "grub-common hold"|dpkg --set-selections

then you can revert this with

echo "grub-common install"|dpkg --set-selections

another option mentioned here: http://lists.debian.org/debian-user/2009/07/msg00477.html

Package: somepackage
Pin: release a=fakerepo
Pin-Priority: 1001

Since "fakerepo" is not a valid release, "somepackage" is never installable.

also may be helpful to check "apt-cache policy grub-common" output

  • Tried already, didn't work
    – bronto
    Commented Oct 4, 2012 at 11:12
  • I added another option, which I never tried...
    – Lluís
    Commented Oct 4, 2012 at 13:02
  • I had tried with apt-cache policy, but could not get anything useful out of it; it really seems that the pinning algorithm is flawed in lenny, and it was fixed in squeeze. As for the fakerepo, I had not tried it. Not sure I can, since we had to implement a different solution due to time constraints
    – bronto
    Commented Oct 4, 2012 at 16:12
  • as I understand you don't need to setup a fake repo, only configure some garbage on the "Pin: release a=xxX" line
    – Lluís
    Commented Oct 4, 2012 at 17:18
  • That was understood :) But we had to work around the problem another way, so I am not sure I'll manage to test with a fakerepo-style line. However, I'll save the suggestion, you never know :) Thanks
    – bronto
    Commented Oct 5, 2012 at 7:08

You must log in to answer this question.

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