How do you add Debian experimental repo to Ubuntu, for those understanding the risks associated?

Sorry for this long answer, but the previous answers are all erroneous in one way or another, so I hope this attempt to be a bit of help to everyone.

Besides "experimental", Debian has several streams of packages that it calls "distribution". And every such distribution has its very own name. The current stable distribution was just released and is called "buster". Before that, now referred to as "oldstable" was "stretch", before that was oldoldstable "jessie". The 5/2013 released "wheezy" still sees another year of long-term support (https://wiki.debian.org/LTS). The one that is under current development is always called "testing", and it also always has a name that testing will be known to at the time it is released, this is "bullseye" now. There is also a distribution to which developers upload new packages, which is "unstable" and runs under the permanent name "sid". Packages uploaded to sid are auto-transferred to testing if there was no critical bug assigned to it during the first days (the uploader says how many days) of presence in unstable. For non-critical machines it is perfectly fine to run testing or unstable. The "unstable" refers to packages changing a lot, not to "software that crashes".

Experimental is kind of special in that

  • it only has the name "experimental", no assignment to a toy story character
  • it has a dual use as an ever lasting repository for packages that are not considered ready for the general public to use and
  • as a temporary store for packages while the release is finalised and new uploads are put on hold ("freeze").
  • packages are auto-removed from experimental when newer versions of a software appear on unstable

Debian developers typically expect users of testing or unstable to be the ones that install packages from experimental. Users of stable are likely to need updates to libraries. A recent version of Ubuntu should be fine with installing Debian packages from experimental directly, you would indeed just add

 deb http://httpredir.debian.org/debian/ experimental main contrib non-free

to your /etc/apt/sources.list but this is not what I tend to recommend. It depends a bit on the number of packages that are dragged in by the update and the dependencies on specific versions of libraries. If it is too many that apt-get suggests to install, then stop the installation if you fear a negative effect on your other binaries.

Instead, I suggest that you compile the software yourself. You may add

 deb-src http://httpredir.debian.org/debian/ experimental main contrib non-free

to sources.list (instead or in addition to the prior mentioned line describing a source for binary packages) and after apt-get update do

 apt-get build-dep wantedpackagename # installs build dependencies
 apt-get source --compile wantedpackagename # fetches source and builds

If the right version is downloaded you see at the time of the download. For binaries, have not tried with apt-get source, to retrieve from the experimental section you may also from Ubuntu need to specify "-t experimental" as additional flags to apt-get install. With apt-cache show wantedpackagename you see all versions of the package available to the system.

When building from source, there is absolutely no risk at all to damange your system since you leave all libraries at the version that your regular distribution already offers. There should hence be no side-effects. If the build fails, then it may already fail because the build dependencies could not be matched upfront. With build dependencies matched, a failed build you may decide to report to the package maintainer to improve his build instructions and possibly continue working on the package together. It is common for a package maintainer to be very happy about constructive feedback, so do not be shy.


If you already understand the risks associated with this, then you can follow these steps:

  1. sudo touch /etc/apt/apt.conf.d/debian_repos.conf
  2. sudo nano /etc/apt/apt.conf.d/debian_repos.conf
  3. add your repo (eg. deb http://deb.debian.org/debian/ oldstable main contrib non-free)
  4. CTRL + X
  5. Y
  6. apt-get update
  7. sudo apt-get install (packagename)

I would heartily recommend that you do not do this, because of stability; security and conflicting updates.

To pin the default distro updates, create a file sudo touch /etc/apt/preferences.d/unstable and paste the following inside:

Package: *
Pin: release v=12.04, l=Ubuntu
Pin-Priority: 1000

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

Save & close.

This should only install updates from the debian repo, if they are not found in the Ubuntu repos first.

Sources:

  • Adding Debian Sid as Package Repository?
  • http://jaqque.sbih.org/kplug/apt-pinning.html
  • https://serverfault.com/questions/126920/is-adding-the-debian-repository-to-my-apt-source-list-dangerous-on-ubuntu
  • is it possible to use Debian repositories in Ubuntu?
  • https://help.ubuntu.com/community/Repositories/CommandLine