124

Possible Duplicate:
How to prevent updating of a specific package?
Keep the Ubuntu package version I'm using now

Is it possible to upgrade all packages except a given package? Is there something like apt-get upgrade --exclude package_to_exclude?

2 Answers2

205

To hold a package:

In short: sudo apt-mark hold <package>

or

echo <package> hold | sudo dpkg --set-selections

To unhold a package:

In short: sudo apt-mark unhold <package>

or

echo <package> install | sudo dpkg --set-selections
Fadi
  • 103
Zoke
  • 9,476
  • 1
    I get the following error: `Usage: apt-mark [options] {markauto|unmarkauto} packages...

    apt-mark: error: first argument must be 'markauto', 'unmarkauto' or 'showauto'`

    – Olivier Lalonde Jan 30 '12 at 04:25
  • Strange. It works for me. Just tried it using sudo apt-mark hold unity-greeter – Zoke Jan 30 '12 at 04:28
  • I think this error has to do with the Ubuntu version. Versions prior to 12.04 don't support apt-mark hold – user733211 Jun 07 '13 at 10:48
  • 1
    Once the package should be updated again, use the unhold parameter. – Markus Junginger Nov 05 '14 at 05:57
  • 9
    Also, sudo apt-mark showhold will show that it is now on hold. (Note: that isn't showhole, that's a Netflix error state.) – flickerfly Oct 31 '16 at 17:30
  • 2 things work noticing: 1. You can specify many packages: apt-mark package1 package2 ... 2. Holded packages also works with apt-get upgrade if someone's still using it ;) – Konrad Gałęzowski Feb 03 '17 at 07:21
7

Check out "Introduction to Holding Packages" in the Ubuntu's Pinning Howto

Sergey
  • 43,665