I am attempting to upgrade a few packages using the apt package manager. However there is a specific package in the list that I don't want to upgrade. In fact I don't want anyone to ever upgrade it. Is there a way from forever blocking any specific packages?

In this case there's a grub update that I don't want to occur ever by myself or any other unix admins. Is this even possible? If so how do I go about doing it.


You need to put the package “on hold”. You do that by issuing

echo 'your-package hold' | dpkg --set-selections


dpkg --get-selections [package pattern]

to see what the current selections are.


echo 'your-package install' | dpkg --set-selections

to make the package upgradeable again.

| improve this answer | |
  • That works perfectly. FYI if you are using apt the solution is using a tool called apt-mark and the syntax is as follows: apt-mark hold ^grub. – Mark D Apr 12 '12 at 17:24

Putting the package on hold at the dpkg level is one approach. Another one is to assign such a high priority to the installed package within apt that it is never upgraded. See man apt_preferences.

| improve this answer | |

With Aptitude, interactively: press = (or select “Hold” from the “Package” menu) on the package line. On the command line:

aptitude hold grub-pc

Since Debian wheezy, you can also use apt-mark hold grub-pc (thanks Mark D).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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