Outdated documentation

This page is out of date. Please use the main navigation to find the latest documentation.

Occasionally, you may wish to use more recent versions of specific pieces of software. You have the choice of either compiling that software from scratch, or (assuming the version you desire is packaged for another Debian-based distribution) creating a backported package.

Backporting the package makes it easier to share your improvements with other people, and is generally easier to manage when it comes to upgrading. (Just be sure to share the source to your packages, if you upload to a repository.)

Step 1: Get the source of the upstream package

You have two alternative methods.

Alternative 1: Find and download the source manually

Search the Ubuntu packages or Debian packages pages, until you find the relevant package page for the version you want.

At the foot of the page, there is a line mentioning the source packages. Download the three links to the right, which should look something like:

[dsc] [<package>_<version>.orig.tar.gz] [<package>_<version>.diff.gz] 

Put these into a working directory, and run:

dpkg-source -x <package>_<version>.dsc

Alternative 2: Use a deb-src line in sources.list

This is possibly controversial in this context, but done properly there should not be a risk of installing non-free software onto your system.

Edit the file /etc/apt/sources.list and add the relevant deb-src line for the distribution you are backporting from. Important: Note that you add a deb-src line, and not a deb line. Adding a deb line would risk installing packages compiled against different versions of libraries (so they would break), and even worse, you could end up with non-free software.

So, for example:

deb-src http://archive.ubuntu.com/ubuntu/ edgy main universe
deb-src http://archive.ubuntu.com/ubuntu/ edgy-backports main universe

Choose a nearby mirror, it'll be faster. Update:

sudo apt-get update

Then, the following command will fetch the source and unpack it:

apt-get source <package>

You may wish to remove the deb-src line once you are finished.

Step 2: Check and install build dependencies

Under alternative 1, change to the directory the source was unpacked in, and run:


You must then install the packages it lists, using sudo apt-get install <package>.

If you are using alternative 2, then issue the following command:

sudo apt-get build-dep <package>

If it doesn't work

Sometimes, packages will depend on more recent library versions than are available in gNewSense. In this case, you have a few options:

Step 3: Edit the changelog

Before building, in the package source directory, run:

dch -i

This will let you edit the changelog. Add a note that the package is a backport, and note any changes you made to the source.

The -i flag will increment the version number automatically. These version numbers have rules; see the relevant section of the Debian Policy Manual. If the package uses an orig.tar.gz (as opposed to just a tar.gz) upstream source, then using a hyphen ('-') in the suffix will mean your changes get put into a diff.gz file, and are easier to update on the mirrors. One important thing not mentioned there is the use of the tilde character ('~') in the suffix, to force your revision to be less than the corresponding upstream version; this is so that when it comes to an upgrade, the version from the new release will be installed. Look at the Ubuntu backports repository for examples.

This is particularly important if you are uploading the package to a repository for others to use. Incrementing the version number is a good idea in any case, because it will stop the automatic updates system wanting to replace your new packages. At the same time, you want to choose an extension such that the next gNewSense version will still be automatically installed.

Step 4: Build and install the package

Change to the package source directory, if you're not there already. Then run:

fakeroot dpkg-buildpackage

If all goes well, the package should be built in the parent directory. You can then:

cd ..
sudo dpkg -i <package>_<version>.deb

Further reading


UserExperiences/BackportingPackages (last edited 2013-09-04 19:47:12 by FelipeLopez)