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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 5 down vote accepted

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.

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

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

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.