banner Debian GNU/Linux

Debian In the Mix

There ain't no problem that I can't fix
'cause I can do it in the mix


Wen playing with Debian, occasionaly you'll find that the packages you need are not in the 'stable' repository, but in 'testing'. Or not available at all from debian, and you'll have to get them elsewhere. Just adding additional sources to 'sources.list' may result in a complete update of your system. If that's what you intended, fine. If you want to control which packages are added from 'other' repositories, here's how.

/etc/apt/sources.list

whatever source your desired package comes from, apt can not get it unless the location is mentioned in /etc/apt/sources.list. So, if youre running 'stable' and need something from 'testing', you'll have to add an entry for 'testing' in sources/list

/etc/apt/apt.conf

As mentioned before, adding a source to sources.list can cause your entire system to get updated, if the packages in the newly added source are newer than the once you have installed. If you want to avoid that, you need tell apt what it should consider as your default release of Debian : create a /etc/apt/apt.conf and add a line like

		APT::Default-Release "version";
	

where version is the version of Debian you want to use as the main distribution. The versions you can use are stable, testing and unstable. To install packages from another version, then, you must use APT in the following way:


     	apt-get -t testing install apache2
	

It says : I use stable, but 'apache2' should come from 'testing'.

On this configuration, the default-release 'stable' in apt.conf will prevent apt-get upgrade from upgrading everything to testing (which has newer packages with higher version numbers), while the -t switch allows you to select certain packages from testing or unstable.

Dependencies

In a mixed system, how do dependencies get resolved ? If you're running "stable" as default, but install package "foo" from testing, where will the dependencies for "foo" come from ? From testing - meaning that you get a lot more "testing" packages than you'd expect ? Or from "stable" - where possible the versions of the dependencies are not suitable for a (newer) package in "testing" ?


	## A/ this syntax tries to install apache from testing - with dependencies resolved in the default release. 
	apt-get install apache2 /testing

	## B/ this syntax tries to install apache from testing - with dependencies resolved in testing 
	apt-get -t testing install apache2 
	

Scenario A will fail if the dependencies for apache2 from testing can not be resolved by packages in stable. Scenario B might pull in a truckload of libraries and assorted packages from testing into your stable system.

/etc/apt/preferences

'preferences' is the file that lists your preferred source for a given package. It will most likely contain an entry that says that you still want to use 'stable' by default. apt.conf takes care of that as well, but in preferences you can pin a priority to it to fine-tune the mix.

You order your preferences with the pin-priority. However, the pin-priority also controls the conditions that have to be met for a pinned package to be upgraded. (See links to advanced info, below)The aim is to control which package will come from where, but you can also pin the dependencies and control the behaviour during upgrades, force downgrades, or pin packages to a specific version.

Ubuntu ?

As Ubuntu is based on Debian, the same apt mechanisms should apply. Hence, it should be possible, using apt pinning, to create a mixed system with packages from multiple releases, eg a Dapper Drake system with packages updated from Edgy and Feisty repositories. However, it is quite possible that packages in newer releases depend exclusively on other packages in that release, and are uninstallable on previous releases for that exact reason. You'd have to resort to backported packages, or try to modify the dependencies (eg leave out version requirements and see if they work. Sometimes, they do).

Advanced or more elaborate info

show dependensies of package dpkg -s package | grep ^Depends:

Koen Noens
June 2006