Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Because of bug #693758 I'd like to prevent apt-get upgrade and Update Manager from updating the "libgtk2.0-0" package.

How can this be achieved?

share|improve this question
    
@hhlp: But this question is asking about a package that was never installed. –  Nathan Osman Oct 26 '11 at 18:17
1  
@George Edison - There is also package holding, which allows you to not update the package. so Holding a package basically means you're telling the package manager to keep the current version no matter what. This is useful if more recent version of a currently working program breaks after an update. (you can't hold a package that was never installed also see my question is the same).... i tested that right now - see he said disable packages from the auto-update –  hhlp Oct 26 '11 at 18:41

9 Answers 9

up vote 113 down vote accepted

Now go to Synaptic Package Manager (System > Administration > Synaptic Package Manager)

Click search button and type package name.

When you find package select it and go to Package (in menu) and click Lock Version.

Synaptic menu

and you are done, now that package will not show in update manager and it will not be updated.

There are four ways of holding back packages, with dpkg, apt, aptitude or with dselect.

Using dpkg

Put a package on hold

echo "package hold" | sudo dpkg --set-selections

Remove the hold

echo "package install" | sudo dpkg --set-selections

Displaying the status of your packages

dpkg --get-selections

Displaying the status of a single package

dpkg --get-selections | grep "package"

Using apt

you can hold a package using

sudo apt-mark hold package_name

and remove the hold with

sudo apt-mark unhold package_name

Using aptitude

you can hold a package using

sudo aptitude hold package_name

and remove the hold with

sudo aptitude unhold package_name

Using dselect

With dselect, you just have to enter the [S]elect screen, find the package you wish to hold in its present state, and press = or H. The changes will go live immediately after you exit the [S]elect screen.

share|improve this answer
3  
This also works to prevent a package from being installed. When installing devscripts, a lot packaged are pulled as Recommended packages. As I don't need a mailserver (postfix), I could disable the installation of it by running echo postfix hold | sudo dpkg --set-selections before running sudo apt-get install devscripts. This hold action persists only for this installation, after the installation the selections are reset. –  Lekensteyn Aug 20 '11 at 10:47
3  
Also worth pointing out, package holds do break upgrades and patches sometimes by creating a situation where there is no legal solution apt can calculate to a dependency. If package foo has a == < or <= dependency on libbar, then apt will refuse to upgrade libbar as well as foo. Over time, these cascading dependencies may grow to block a large number of updates, including important security updates. You'll need to either remove the hold and let the upgrade happen, or rebuild the packages you are holding against newer versions of its dependencies if this happens. –  Stephanie Aug 2 '12 at 5:22
2  
Just a note: apt-mark doesn't support hold in version 0.7.25 (Ubuntu Lucid) –  Joril Apr 2 '13 at 7:30
1  
This is especially useful when trying to hold back graphics drivers. For ATI users, apt-mark hold fglrx fglrx-amdcccle fglrx-dev && aptitude hold fglrx fglrx-amdcccle fglrx-dev. –  earthmeLon Apr 18 '13 at 20:41
    
Currently synaptic and aptitude only lock packages within those programs. "Anything else that does package upgrades (read: Update Manager, apt-get, aptitude, etc) ignores this." From this question. –  holocronweaver Jul 18 at 12:16

I am even older school =)

To put a package "foo" on hold echo “foo hold” | dpkg --set-selections In your case we are going to put wine on hold:

sudo -i
echo “wine hold” | dpkg --set-selections

To remove hold

sudo -i
echo “wine install” | dpkg --set-selections
share|improve this answer

Preventing a package from being installed is called "package holding" and it is very simple to do:

echo package_name hold | dpkg --set-selections

...where *package_name* is the name of the package you want to prevent from installation.

Note: the above command assumes root privileges. In other words, you will probably need to type sudo su before running it.

share|improve this answer
    
Perfect this was the answer. Thank you. –  asoundmove Feb 5 '11 at 3:38

Install synaptic using sudo apt-get install synaptic.

Run using gksudo synaptic and on the search box locate the package you want to lock, ie: gedit

enter image description here

From the package menu select Lock version:

enter image description here

And that is all, the version currently installed at the time of the lock will stay installed even during upgrades.

share|improve this answer
4  
Please look at "Lock version is not as clever as it sounds. It's supposed to do what it says on the tin, lock the version... But it only locks it within Synaptic. Anything else that does package upgrades (read: Update Manager, apt-get, aptitude, etc) ignores this. This is probably buggy behaviour so I would expect this to be fixed in time." from askubuntu.com/questions/9607/what-does-lock-version-do. What is the current state? If something is locked in Synaptic, will other package managers "honor" the lock? –  user25656 Dec 22 '11 at 12:09
2  
vasa1: As of version 0.75.13, still no :( Same problem with aptitude. –  syockit Nov 17 '12 at 7:25

I was looking for the same thing and after a lot of research I found that using the following syntax you can forbid one specific version but allow the next update:

Package: compiz-plugins-main
Pin: version 1:0.9.7.0~bzr19-0ubuntu10.1
Pin-Priority: -1

This goes into the /etc/apt/preferences file.

share|improve this answer
    
This is a much better way than preventing updates indefinitely –  Eero Aaltonen Sep 30 '13 at 10:31
    
With this method, I think, chances are bigger to prevent ubuntu 'adware' like ubuntu one or the amazon icon from being reinstalled with the next release upgrade... –  Daniel Alder Jan 10 at 21:29

I synaptic you can freeze the version of a specific package I'm not a 100% sure as to whether this will amend apt-get but it will definately stop update manager.

To freeze a package select it in synaptic then open the package menu and select freeze version.

Hope this helps

edit: This question 16668 deals with a similar situation

share|improve this answer

Everything you ever wanted to know about "holding" and "pinning" packages to specific versions: https://help.ubuntu.com/community/PinningHowto

share|improve this answer

After reading https://bugs.launchpad.net/ubuntu/+source/aptitude/+bug/75332 (see also bug 158981 -- I cannot post 3 links) and https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/72806

the summary is that hold at apt-get / aptitude level is not triggering hold status in dpkg (see bug 72806 especially) and update-manager reads status from dpkg.

workaround is run as root echo "package hold" | dpkg --set-selections

share|improve this answer

If you have Synaptic installed you can select the package and use the menu Package -> Lock Version to prevent it being updated.

You can install Synaptic with sudo apt-get install synaptic. I personally find it more useful than the Software Center... then again, I'm fairly old school. :)

share|improve this answer

Your Answer

 
discard

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.