Tag Archives: linux

Downgrade and force some packages on Debian to a previous version

Today I learned something interesting: How to downgrade and force some packages to stay on that version using apt, without having to manually download and install any .deb.

Why I had to do that? The xserver 1.16 transition hit Debian jessie (the actual testing) today, and since the nvidia proprietary driver isn’t still compatible with it, it got removed. Yes, I know I could have avoid dist-upgrade and apt would hold it until it was safe to do the migration, but I wasn’t really paying attention at the moment (one mistake I’ll for sure never do again =P).

Well, downgrading something that you installed from another release (e.g. unstable, experimental) is easy. You can force it by version (apt-get install foo=1.0 for example) or play with apt preferences. But since the previous version vanished from the repository, I though I would need to download _all_ the xserver-xorg .deb and do a dpkg -i by hand.

That’s when I found Debian snapshots archive.  In that archive you can find any package version if you remember when you last saw it. Knowing that the last good xserver version (good as in “is co-installable with nvidia driver”) was on testing yesterday (2014-07-15), I added this line to my sources.list:

deb http://snapshot.debian.org/archive/debian/20140715T222335Z/ testing main contrib non-free

After an apt-get update I got the information of all packages in that archive. As stated on the snapshots webpage and commented by HearNothingron on the comments above, you might need to run apt-get update with “-o Acquire::Check-Valid-Until=false” to ignore the Valid-Until header, depending on how old the snapshot is.

Now comes the interesting part. I added this to my /etc/apt/preferences:

Package: xserver-*
Pin: origin "snapshot.debian.org"
Pin-Priority: 1001

Because I set a priority of 1001 on all xserver-* packages that comes from the snapshot, it forces that version to be installed even if it ends up in a downgrade (that’s exactly what I needed). All you need to do is hit an apt-get upgrade (maybe dist-upgrad is needed here).

By doing that I was able to downgrade xserver and install the nvidia proprietary driver again. When an update to that driver with xserver 1.16 support comes, I can safely remove that pin and that source and upgrade normally.

I used this for a specific reason, downgrading and keeping xserver 1.15. Obviously you can do the same for any package out there.


Edit 2014-07-20:

For those of you who came here because of the broken nvidia packages, a new driver version with xserver 1.16 support has been uploaded to unstable, as you can see on this nvidia qa page. Its priority is set to high, so it should hit testing in 2 days. When that happens, this workaround can be safely removed.

Talk about Stoq on FISL14

I just came back from FISL14 at Porto Alegre – Brasil, where I gave a talk about Stoq. You can check the video here:


I just want to say thank you to my employer, Async Open Source, for allowing and providing me a way to go to the event. It was really great! Hope I can go again next year and give an even better talk!