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.

15 thoughts on “Downgrade and force some packages on Debian to a previous version”

  1. hi
    i have the same problem and i followed your instruction. I also downloaded the last working nvidia-driver deb file (331.67-2)
    Downgrading from snapshost works but when i try to install the deb file i get this http://paste.debian.net/110196/

    am i doing something wrong?
    thanks

    1. njames: Yes, I forgot about the contrib/non-free. I track unstable too on my sources list (with a priority of 500 and testing with a priority of 900) so I could install nvidia-driver from it.

      Just made the modification. Thank you! πŸ™‚

  2. Thanks Thiago! I tried to find something similar for Ubuntu, sadly I haven’t found anything. But I thought that debian doesn’t have it too, because “downgrade is bad”, by Debian’s philosophy. =) That was a total surprize for me that it actually has it! Thanks for it. Aaah, one more argument to move to Debian…

  3. Hi ! now this snapshot is expired and apt won’t apply updates from it. Do you know of any other way to revert to 1.15 ?

    thanks,

    1. @ramon: You can do what HearNothingron suggested. But why do you still need to revert to 1.15? The new nvidia graphics driver with xserver 1.16 support already migrated to jessie.

  4. Many thanx!
    Just tried it with the fglrx-driver and it works!

    However, it tooked apt-get a quite long time to download the package description from snapshots.debian.org. apt-get tries to download .bz2 first, which is missing but the web-server simply blocks instead of returning an error. Hence, apt-get will try it for some time (seams to be minutes) before falling back to .gz. Then it works. So either be patient or configure apt-get to prefer .gz…. Anyhow: Now it works πŸ˜‰

    You saved my day!

  5. Hi guys im rly desperate can you tell me plz how to downgrade nvidia 340.65 driver to 304.125 which is the right one for my GTS 450 VGA ?

  6. Still helpful in 2016, thanks! Downgraded to xorg 7.7+12, because 7.7+13 apparently crashes when I’m running java programs πŸ™ (Or maybe for a different reason, but this one looks the most convincing so far.)

Leave a Reply