Backports

De ClissXXI.

A backport is a Debian package that is recompiled for an earlier version of the distribution. For example, there is a backport of the latest version of Postfix [1] that was compiled for Etch, based on packages originally meant for Lenny. Here's a HOWTO / tutorial to get started.

Français/French: Un backport, c'est un paquet Debian recompilé pour une version précédente de la distribution. Par exemple, il y a un backport de la dernière version de Postfix [2] compilé pour Etch, à partir des paquets initialement prévue pour Lenny. Voici un HOWTO / didacticiel pour mettre le pied à l'étrier. Le reste de la page sera en anglais.

Sommaire

[modifier] Motives

You cannot just download the newer .deb from Debian 'testing' and install it :/

[modifier] Where to find backports

There are several repositories for different audiences.

  • backports for Debian Stable
  • Components not included in Debian for various reasons (patent threats, DMCA, etc.)

Check the licenses, you might install non-free components.

Here's a few repositories:

  • backports.org: semi-official backports from Debian 'testing' to Debian 'stable' only
  • Debian Unofficial: has a few backports for components not admitted in Debian
  • apt-get.org: search engine, some of the repositories there are backports
  • [3]: Java OpenJDK+IcedTea 6 backport, with backported dependencies


This documentation covers backports.org in particular.

There are detailed official instructions.

Note: it is not recommended to install all backports at once. Instead you should select only the packages that you need. Unlike in full Debian releases, each backport is tested individually, so they might conflict with each others - but they still use the same backported dependencies.

[modifier] HOWTO backport?

[modifier] pbuilder initial Lenny setup

apt-get install pbuilder cdebootstrap
mkdir -p /usr/src/backports/lenny/debs
(cd /usr/src/backports/lenny/debs && apt-ftparchive packages . | gzip > Packages.gz)
pbuilder --create --basetgz /var/cache/pbuilder/base-lenny-bpo.tar.gz --distribution lenny \
  --othermirror "deb http://security.debian.org/ lenny/updates main|deb file:///usr/src/backports/lenny/debs ./" \
  --bindmounts /usr/src/backports/lenny/debs
# to upgrade: pbuilder --update --basetgz /var/cache/pbuilder/base-lenny-bpo.tar.gz --bindmounts /usr/src/backports/lenny/debs

pbuilder --login --basetgz /var/cache/pbuilder/base-lenny-bpo.tar.gz --bindmounts /usr/src/backports/lenny/debs --save-after-login
echo "deb http://network/mirrors/debian-backports.org lenny-backports main" > /etc/apt/sources.list.d/bpo.list
apt-get update
apt-get --assume-yes --force-yes install debian-backports-keyring
apt-get update
exit

# TODO: --pbuildersatisfydepends doesn't work, why?
#pdebuild --pbuilder cowbuilder --pbuildersatisfydepends /usr/lib/pbuilder/pbuilder-satisfydepends-experimental
# Meanwhile we edit /etc/pbuilderrc manually
PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-experimental

Source packages location (or just use dget):

cat <<EOF > /etc/apt/sources.list.d/squeeze-src.list
deb-src http://ftp.fr.debian.org/debian/ squeeze main
EOF
apt-get update

[modifier] Compilation

Shell variables:

export DEBEMAIL="beuc@beuc.net" 
export DEBFULLNAME="Sylvain Beucler"
export EDITOR="emacs"

Update chroot'd subsystem:

sudo pbuilder --update --basetgz /var/cache/pbuilder/base-lenny-bpo.tar.gz --bindmounts /usr/src/backports/lenny/debs

Edit the source package:

apt-get source $PACKAGE
cd $PACKAGE-*
#sed -i -e "s/Uploaders:\(.*\)/Uploaders:\1, $DEBFULLNAME <$DEBEMAIL>/" debian/control
# debian/control: add new field
# Uploaders: Sylvain Beucler <beuc@beuc.net>
dch --bpo
# Document your changes
# [http://toppapers.org/professional-writers.php essay writers]

Try to compile (unlike pdebuild, you can inspect and fix errors when compilation fails):

pbuilder --login --basetgz /var/cache/pbuilder/base-lenny-bpo.tar.gz --bindmounts /usr/src/backports/
cd /usr/src/backports/$PACKAGE-*
apt-get install pbuilder
/usr/lib/pbuilder/pbuilder-satisfydepends-experimental --continue-fail
apt-get install devscripts fakeroot
debuild -nc  # don't clean so you can try to resume a failed compilation

When everything compiles, do it for real:

pdebuild --debbuildopts '-sa' --buildresult /usr/src/backports/lenny/debs \
  -- --basetgz /var/cache/pbuilder/base-lenny-bpo.tar.gz --bindmounts /usr/src/backports/lenny/debs

(cd /usr/src/backports/lenny/debs && apt-ftparchive packages . | gzip > Packages.gz)

[modifier] Don't's

Don't aptitude -t lenny-backports install debhelper blindly. This will include new helper scripts that may be copied into your packages' postinst/prerm/etc. This is being discussed. I had to stick to v4 when backporting evince.

Don't use apt-src build, since it doesn't care about sources packages, unless you configure APT::Src::BuildCommand accordingly (without the -b option for dpkg-buildpackage). Using debuild -us -uc directly worked well for me.

[modifier] changelog

You now can use (since Lenny) the --bpo option to dch:

dch --bpo

If you need to do it manually (e.g. because the new Debian version is not supported yet), you can use:

yes | dch -D lenny-backports \
  --newversion $(dpkg-parsechangelog | sed -ne 's,^Version: ,,p')~bpo50+1 \
  --force-bad-version -- \
  "Rebuild for Debian Backports <http://www.backports.org/>"

[modifier] Upload

http://backports.org/dokuwiki/doku.php?id=contribute

Most commonly, upload your files (the contents of repo/) somewhere and post about it on backports-users@lists.backports.org. Make sure you included a description of what you did in the debian/changelog.

The page says: Our requirements aren't that high. You need to have a gpg key in the official Debian keyring. Don't get mistaken: only "Debian developpers" get their gpg keys in the keyring, and becoming one is a months-long process. However you may find somebody on the list willing to upload your package.

Workflow:

  • Your package hits testing. backports.org aims at providing a smooth transition between the current Debian stable release and the next one; they don't consider safe to use an unstable package because if may not enter the next stable (while a testing package should) [4]. Fortunately there has been some exceptions.
  • You backport the package.
  • You test the package. It takes time to upload a package to backports.org, so you'd better send a perfect package from the start.
  • You send the package to an authorized member (who will sponsor it), or you upload directly at ftp://backports.org if you have the privileges (requires being part of the Debian GPG keyring i.e. having the "Debian Developer" status)
  • If this is the first time your package is backported (or if your source package introduces new binary packages), it will appear at http://www.backports.org/debian/new.html , and wait for a manual review. Norbert Tretkowski (nobse) or Alexander Wirt (formorer) will do so in a matter of days/weeks. eg: evince was accepted after 1 week, ettercap after 1 day - but I don't know the details.
  • Your package is send to an autobuilder. Your package will be rebuilt no matter what [5].
  • Once the binary package is built, the build logs need to be checked by each buildd admin.
  • Then the binary package is published. There might be a delay between the availability of an architecture-independent .deb and an architecture-dependent .deb that is part of the same source package.

[modifier] Manual configuration

(This is older documentation that does in greater details.)

If you want to backport for your own use, or if you're new to backports, this is for you: your packages may not work on other systems, but you have more flexibility to debug and fix errors.

You need:

  • debootstrap
  • basic compilation tools: aptitude install build-essential
  • sources.list:
##
# Stable and backports repositories
##
deb http://ftp.fr.debian.org/debian etch main
deb http://security.debian.org/debian-security etch/updates main
deb http://www.backports.org/debian/ etch-backports main
deb-src http://ftp.fr.debian.org/debian etch main
deb-src http://security.debian.org/debian-security etch/updates main
deb-src http://backports.org/debian etch-backports main

##
# Testing and unstable repositories
##

# Binaries - uncomment if you need to test 'aptitude install'
#deb http://ftp.fr.debian.org/debian testing main
#deb http://ftp.fr.debian.org/debian unstable main

# Sources - uncomment the one you're backporting from
#deb-src http://ftp.fr.debian.org/debian testing main
deb-src http://ftp.fr.debian.org/debian unstable main

##
# backports in progress
##
deb file:///usr/src/repo ./
  • /etc/apt/preferences:
Package: *
Pin: release a=testing
Pin-Priority: -1

Package: *
Pin: release a=unstable
Pin-Priority: -1
  • Vital packages (apt-src, apt-ftparchive, dch):
aptitude install apt-src apt-utils devscripts fakeroot interdiff
  • Environment variables for Debian tools, in my ~/.bash_profile:
export DEBEMAIL="beuc@beuc.net" 
export DEBFULLNAME="Sylvain Beucler"
export EDITOR="emacs"
  • debsign GPG configuration, if signing packages is needed, in my ~/.devscripts:
DEBSIGN_KEYID="81704B93"
DEBSIGN_PROGRAM="gpg --use-agent"
DEBSIGN_SIGNLIKE="gpg"

[modifier] To search for a missing dependency

In a vanilla install, sarge and backports in sources.list:

aptitude search keyword # search package whose name contain 'keyword'
apt-cache policy packagename # check what versions are available (using sources.list)
rmadison packagename # also check available versions (using qa.debian.org)

[modifier] Testing the build-deps

apt-get build-dep packagename

will download the missing dependencies, if available, and report the first missing one otherwise.

You can alter the build-dep during the creation of the backport, to test whether a modified dependencies list does the trick. apt-get build-dep uses the plain-text /var/lib/apt/lists/ftp.[mirror].debian.org_debian_dists_[distro]_[component]_source_Sources file. You can go quick&dirty and alter that file :) I do not know about a "clean" solution (like feeding apt-get build-dep directly with a debian/control file). You then can test your backported dependencies with:

apt-get -t sarge-backports build-dep packagename

You may also be interested in dpkg-checkbuilddeps: it reports packages that are not installed, though it doesn't tell you whether the build _could_ be installed or not, nor which packages exactly are missing.

[modifier] Making the newly built dependencies available to apt

cd /usr/src
mkdir repo
\mv *-*~bpo*+*.deb *-*~bpo*+*.udeb *-*~bpo*+*.changes *-*~bpo*+*.diff.gz *-*~bpo*+*.dsc repo/
ln -f *.orig.tar.gz repo/
cd repo
apt-ftparchive packages . | gzip -c > Packages.gz
apt-ftparchive sources  . | gzip -c > Sources.gz
cd ..
#echo "deb file:///usr/src/repo ./" >> /etc/apt/sources.list

There's probably a cleaner way to do this using more comprehensive tools but that does the trick for now.

TODO: this doesn't support native packages (w/o .orig.tar.gz)

[modifier] Build the package

You now can build your own backport package. Suppose you backport a package existing in testing branch and use /usr/src/repo as your working folder, after editing sources.list in previous section, you can get the source package by:

mkdir /usr/src/repo
cd /usr/src/repo 
apt-src install PackageName

Change to the source directory and build the binary package:

cd PackageName
debuild

If it goes smooth, you will get the new packages in /usr/src/repo

[modifier] What kinds of packages are accepted at backports.org?

The "contribute" page [6] says:

  • Don’t backport minor version changes without any user visible changes or bugfixes
  • Please only upload package with a noteable userbase. User request for the package maybe an indicator.
  • Reconsider if the package can be installed directly from testing without any recompilation and handled via pinning

I would summarize it by:

  • Packages need zero review/maintenance time from backports maintainers.

I believe there's only 2 backports.org admin, and I let you image what it's like to get several backports to review each day - after a couple years.

So make yourself trusworthy (become a Debian developper), prove that you won't let packages become outdated, work with the package maintainers and have them sponsor your backport, upload your backports to other places first so they can be tested (reference them to apt-get.org), etc.

[modifier] Test your backport

First, install and run your backport on a Stable system.

You can also check what changes you introduced using interdiff (from package patchutils):

gunzip par2cmdline_0.4-8.diff.gz
gunzip par2cmdline_0.4-8~bpo.1.diff.gz
interdiff par2cmdline_0.4-8.diff par2cmdline_0.4-8~bpo.1.diff | less

debdiff will also show you if you mistakenly introduced new files, and will wdiff debian/control (you need to install the wdiff package for that):

aptitude download par2/testing
debdiff par2_0.4-8_i386.deb par2_0.4-8~bpo.1_i386.deb

Run lintian, a package test suite. If you get errors, check whether they already existed in the original package, or if you introduced them yourself:

lintian par2_0.4-8~bpo.1_i386.deb
lintian par2_0.4-8_i386.deb

(if your source packages produces several binary packages, specify the .changes instead)

piuparts is another test suite that actually installs your packages in various ways (instead of inspecting its content), but I have to figure out how to use it accurately for backports.

[modifier] Track your backported packages

After a while, there will be new versions of your backported package in Debian testing. In this case, either:

  • update your backport
  • tell backports-users@list.backports.org that you do not intend to do it (lack of time, not using the package anymore, etc.), but that it would be good if someone did

To be notified of new versions of the package automatically, the simplest way is to subscribe to the PTS (package tracking system). You can do so from the package developer package (eg. [7]).

Alternatively, you can send an e-mail to pts@qa.debian.org telling:

Subject: subscribe your_package your@mail.tld

keyword your_package your@mail.tld = upload-source
quit

The keyword line tells the BTS to only notify you about new releases. You can check the documentation to see what other kinds of notification you can receive (bug reports, etc.).


This script was recently advertised as a way to track the differences between Ubuntu and Debian packages.

MultiDistroTools also contains informations in this regard, generating reports like:

Such tools should be adaptable for use with backports<->testing.

[modifier] Examples

Here are a few sample backports made by Cliss XXI.

Lenny backports:

  • Backport Git: pbuilder-based, from start to finish
  • Backport OpenJDK: idem., a bit more difficult with a backported build-dependency as well as a runtime dependency

Etch backports:

Sarge backports:

[modifier] Troubleshootings

After apt-get update, you get:

W: GPG error: http://www.backports.org etch-backports Release: The following
signatures couldn't be verified because the public key is not available:
NO_PUBKEY EA8E8B2116BA136C

This means you didn't include the backports key, see instructions above.

[modifier] Links

[modifier] Documentation

[modifier] Tools

[modifier] Packages information

[modifier] Other pages at doc.cliss21.org

(French):

[modifier] History

  • Before 2006, extra pinning (packages priorities) configuration was needed, but this is no longer necessary)

[modifier] Note

As the only copyright holder of this documentation, and to avoid any troll, this documentation is dual-licensed GFDL and GNU GPL, current versions or later.

[modifier] TODO

There are new "rules" to take into accounts:

[modifier] Links

  • buildd.net: the computer that builds backports packages
  • [8]: sample URL to check the build status of a package (here the Mercurial package recompiled for Etch)