0

I am running Ubuntu 14.04 and have let it get quite out of date with packages that need updating.

There are a couple of packages I don't want to upgrade like tomcat, php etc.. but I am not sure how I can run a blanket apt-get upgrade to upgrade everything except those packages. Most of the documentation and suggestions I can find only explain how to update specific packages, not the other way around..?

Thanks

Pelly
  • 23
  • 5

2 Answers2

3

What you want is "package pinning" -- essentially, telling apt, "I want to keep this package at this version". For a simple single-package pin, add this to /etc/apt/preferences (or in a new file in /etc/apt/preferences.d):

Package: tomcat8
Pin: version 8.0.14-1
Pin-Priority: 1001

Specify the package name you want, and the version you want to pin it to, and make sure the Pin-Priority is over 1000. Then the package will basically never, ever move from its current version.

You can do trickier things, like pinning to a release (trusty rather than trusty-updates, for example), selecting lots of packages with a glob pattern, and only letting packages update if they're security updates. See apt_preferences(5) for all the gory details.

womble
  • 96,255
  • 29
  • 175
  • 230
  • In /etc/apt I don't seem to have a "preferences" file to edit. I do however have a (preferences.d) folder. If I put a file in there what do I call it? Thanks – Pelly Nov 24 '15 at 05:29
  • Per `apt_preferences`(5): "Note that the files in the /etc/apt/preferences.d directory are parsed in alphanumeric ascending order and need to obey the following naming convention: The files have either no or "pref" as filename extension and only contain alphanumeric, hyphen (-), underscore (_) and period (.) characters. Otherwise APT will print a notice that it has ignored a file, unless that file matches a pattern in the Dir::Ignore-Files-Silently configuration list - in which case it will be silently ignored." – womble Nov 24 '15 at 05:31
1

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

Ref: Exclude packages from apt-get upgrade

A T
  • 397
  • 1
  • 4
  • 15