Pinning Debian and Ubuntu Packages
Say you've got an Ubuntu Stable system but you need some packages from Ubuntu's old Stable. "Pinning" will allow you to force the system to not update certain packages, but update everything else possible. This is a recipe for doing this. (prerequisites: knowing what
/etc/apt/sources.list
is; and apt-get basics).
This situation happened with the Graphics Lab in Spring '06 term; we needed older 'breezy' for a few GTK libraries, such as libgtkglextmm1-dev, but we want dapper for everything else.
The naiive answer is: set
/etc/apt/sources.list
for dapper, do an update, then set sources.list for breezy and update the problem libraries (and whatever dependencies they have). This will work, but it's not the most intelligent way to do it. The smart way is quite easy to set up.
- add
/etc/apt/apt.conf
with the line APT::Default-Release "dapper";
- make
/etc/apt/sources.list
contain both sets of sources for breezy and dapper (ie, 4 lines for each). Example:
# graphics lab sources.list: both dapper and breezy (for breezy "libgtkglextmm1-dev")
deb ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu dapper main restricted universe multiverse
deb-src ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu dapper main restricted universe multiverse
deb ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu dapper-security main restricted
deb-src ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu dapper-security main restricted
deb ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu breezy main restricted universe multiverse
deb-src ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu breezy main restricted universe multiverse
deb ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu breezy-security main restricted
deb-src ftp://ubuntu-mirror.cscf.uwaterloo.ca/ubuntu breezy-security main restricted
- determine which packages are to be held back. As a first guess, I only chose
libgtkglextmm1-dev
.
- add
/etc/apt/preferences
which has the following three lines for each package to be held back:
Package: libgtkglextmm1-dev
Pin: version 1.0.1-2ubuntu3
Pin-Priority: 1001
The package name and version should be changed to match the currently installed versions.
(See the reference URL for more explanation of chosing versions; they can include '*' for more creative options).
Pin-Priority should be 1001 if you want your choice to never be replaced via apt.
(There's a chance you'll need some experimentation with
apt-get -s install
to find the right packages to pin. You'll know you've got the right set in preferences if
apt-get -s install [package to keep back]
says you've already got the latest package.)
- if you have your proper package versions already installed, that's it.
- otherwise, you'll want to install them with
apt-get -t breezy install [package names]
References
Debian's Reference on Pinning
http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html#s-pin
--
DanielAllen - 15 Aug 2006