Ubuntu – Holding older version of a package?


I added an apt repository for CRAN (R) to get an older (3.3) version and did

apt-get install r-base-core=3.3.1trusty0

– the one thing i am afraid of now is doing apt-get update/upgrade will blow this version away and my stuff will break. Is there a way to make apt hold this old version and never upgrade it, though upgrade whatever else?

Best Answer

You can use apt-mark for holding a package. The command should be

apt-mark hold <packagename>

From apt-mark

apt 1.2.26 (amd64)
Usage: apt-mark [options] {auto|manual} pkg1 [pkg2 ...]

apt-mark is a simple command line interface for marking packages
as manually or automatically installed. It can also be used to
manipulate the dpkg(1) selection states of packages, and to list
all packages with or without a certain marking.

Most used commands:
  auto - Mark the given packages as automatically installed
  manual - Mark the given packages as manually installed
  hold - Mark a package as held back
  unhold - Unset a package set as held back
  showauto - Print the list of automatically installed packages
  showmanual - Print the list of manually installed packages
  showhold - Print the list of package on hold

See apt-mark(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).

Hope this helps!