I use Debian sarge (testing) on a number of my systems. Some time ago i wanted a package from unstable on my system, so i added my local mirror's unstable repository to my /etc/apt/sources.list. The intent was it would disappear as soon as my install was complete. However, i got distracted and it stayed there and i forgot about it.
Several 'apt-get update && apt-get dist-upgrade's later, i found that i had installed a kernel and an initrd-tools package that broke my system and prevented it booting. Fortunately, i could boot on the old kernel which still existed in grub's menu.list, but it was left with a problem: how could i get back to testing where i wanted to be?
A few quick 'Net searches and i discovered that most people think that downgrading is:
a) not possible,
b) not advisable, or
c) both of the above
However, i found one helpful tip which pointed me to the apt_preferences manual page, which explained many things. The secret is to make the priority of the release i wanted (testing) a higher priority than the installed versions. The way to do this is to pin its priority greater than 1000 with /etc/apt/preferences as follows:
Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 1100
I then ran 'apt-get dist-upgrade', which warned me about the packages i was going to downgrade, and successfully did it for me. (It seems this is not always expected behaviour with downgrades.) I am left with the broken kernel, so i've made it non-default. I expect a newer version will supersede it before sarge goes stable anyway.
To keep my system in the state i want (i was about to say 'in a stable state', but that's not right, since i'm tracking testing at the moment), i've ended up with this /etc/apt/preferences (courtesy of Roderick Schertler's "Using APT with more than 2 sources"):
Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 700
Package: *
Pin: release o=Debian,a=unstable
Pin-Priority: 50
Package: *
Pin: release o=Debian
Pin-Priority: -1
This makes testing my preferred target, even if i use 'apt-get -t unstable ...', and will install software from unstable only if i explicitly specify. If i was trying to track more packages in unstable, this might be a problem, but it seems to work fine for me, who doesn't want the lastest and greatest of most things.
A tool that has proved invaluable in working out the problem and the results of the downgrade process is apt-show-versions. Grep the output for '/stable', '/testing', or '/unstable' to see which of your packages are from which distribution. One caveat however: if both testing and unstable have the same version of a package, it will show as unstable. I haven't found a good way around this yet.
