Table of Contents

About

Sometimes you need to install a package from the unstable branch due to some features that you really need. In order to do that, we present a short tutorial. We will setup APT to set priorities for the various branches and then update a set of packages to unstable - for this example, we will update the strongSwan and related packages.

Configure Package Priorities

In order to set up priorities, create a new file at /etc/apt/preferences.d/priorities with the following contents:

Package: *
Pin: release l=Debian-Security
Pin-Priority: 1000

Package: *
Pin: release a=stable
Pin-Priority: 995

Package: *
Pin: release a=oldstable
Pin-Priority: 850

Package: *
Pin: release a=testing
Pin-Priority: 750

Package: *
Pin: release a=unstable
Pin-Priority: 50

Package: *
Pin: release a=experimental
Pin-Priority: 1

Next, we amend the debian sources in order to include the unstable repository by editing /etc/apt/sources.list:

# Security
deb     http://security.debian.org/         stable/updates  main contrib non-free
deb     http://security.debian.org/         testing/updates main contrib non-free

# Stable
deb     http://ftp.uk.debian.org/debian/    stable main contrib non-free
deb-src http://ftp.uk.debian.org/debian/    stable main contrib non-free

# Oldstable
deb     http://ftp.uk.debian.org/debian/    oldstable main contrib non-free
deb-src http://ftp.uk.debian.org/debian/    oldstable main contrib non-free

# Testing
deb     http://ftp.uk.debian.org/debian/    testing main contrib non-free
deb-src http://ftp.uk.debian.org/debian/    testing main contrib non-free

# Unstable
deb     http://ftp.uk.debian.org/debian/    unstable main contrib non-free
deb-src http://ftp.uk.debian.org/debian/    unstable main contrib non-free

# Experimental
deb     http://ftp.uk.debian.org/debian/    experimental main contrib non-free
deb-src http://ftp.uk.debian.org/debian/    experimental main contrib non-free

and add the last line for the unstable repository.

After that, we update the sources:

aptitude update

Checking Priorities

We can now check to see what priorities we have for the strongSwan package we want to update by issuing:

apt-cache policy strongswan

and we see the following:

strongswan:
  Installed: 5.2.1-6+deb8u2
  Candidate: 5.2.1-6+deb8u2
  Version table:
     5.3.5-1 0
        100 http://ftp.uk.debian.org/debian/ unstable/main amd64 Packages
 *** 5.2.1-6+deb8u2 0
        500 http://security.debian.org/ jessie/updates/main amd64 Packages
        100 /var/lib/dpkg/status
     5.2.1-6+deb8u1 0
        500 http://ftp.uk.debian.org/debian/ jessie/main amd64 Packages
     4.5.2-1.5+deb7u3~bpo60+1 0
        100 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages

The asterisks denote the current selected priority which is in the Jessie repository.

Upgrading Packages

Now we want to upgrade to the 5.3.5 release of openSwan. In order to do that, we issue:

aptitude install strongswan/testing strongswan-charon/testing strongswan-ikev2/testing strongswan-ike/testing strongswan-libcharon/testing strongswan-starter/testing libstrongswan/testing libstrongswan-extra-plugins/testing libstrongswan-standard-plugins/testing

which will upgrade all openSwan related packages to unstable.