plan-downgrade.pl

As of 08 October 2019, this page and related content is no longer maintained. Content is preserved as-is for reference, archival, and historical reasons. Use at your own peril.

Know it

Ever needed to downgrade a Debian package that has versioned dependencies? I have. plan-downgrade.pl is a script to make my life easier - it can find a set of packages needed for a downgrade.

plan-downgrade.pl has two modes of operation: version dependency finder and snapshot timestamp resolver. Dependency finder finds versioned packages that are needed for downgrade. This is the default mode. Snapshot timestamp resolver can be used to find Debian snapshot archive timestamp for requested version and to list all available version for a package.

Note that you’re using this script at your own risk. It worked for me when I wanted to downgrade X.org, but it may not work for your use case. If it breaks your installation, you get to keep both pieces. Think before you act and know what you’re doing.

This script is written in Perl and it depends on a few (Debian) packages. Obviously it depends on Perl, but also on the following.

Get it

Download/view the script.

Use it

perl plan-downgrade.pl PACKAGE=VERSION ...
perl plan-downgrade.pl --find-snapshots PACKAGE=VERSION ...

Basically, downgrading a Debian package is trivial. All you need is a package name and version. Unfortunately, in real life things may not be as straightforward. Naturally you’ll need the old packages, either from local cache or from a repository. Debian snapshot archive can help with old packages, but you’ll still have to worry about versioned dependencies as apt-get nor aptitude take care of this for you. This is where plan-downgrade.pl steps in.

Here’s an example of plan-downgrade.pl in action the way I use it. In reality I downgraded to 2:1.10.4-1, but I didn’t want to upgrade to the latest just to be able to make a real-life example here. Note that I use mixture of aptitude and apt-get. This way I don’t mark downgraded packages as manually installed for aptitude.

% perl plan-downgrade.pl --find-snapshots xserver-xorg-core=2:1.9.5-1
Using architecture: amd64

Package: xserver-xorg-core
Retrieving available versions for xserver-xorg-core...
Retrieving timestamps for xserver-xorg-core=2:1.9.5-1...

Snapshot repositories:
20110326T085552Z  http://snapshot.debian.org/archive/debian/20110326T085552Z/

[edit /etc/apt/sources.list.d/snapshot.list]

% sudo aptitude -o Acquire::Check-Valid-Until=false update
[snip]

% sudo apt-get -V install $(perl plan-downgrade.pl xserver-xorg-core=2:1.9.5-1)
Investigating xserver-xorg-core=2:1.9.5-1...
Investigating xserver-xorg-video-voodoo=1:1.2.4-2...
Investigating xserver-xorg-video-vmware=1:11.0.3-2...
Investigating xserver-xorg-video-vesa=1:2.3.0-5...
Investigating xserver-xorg-video-tseng=1:1.2.4-2...
Investigating xserver-xorg-video-trident=1:1.3.4-2...
Investigating xserver-xorg-video-tdfx=1:1.4.3-4...
Investigating xserver-xorg-video-sisusb=1:0.9.4-2...
Investigating xserver-xorg-video-sis=1:0.10.3-3...
Investigating xserver-xorg-video-siliconmotion=1:1.7.5-1...
Investigating xserver-xorg-video-savage=1:2.3.2-3...
Investigating xserver-xorg-video-s3=1:0.6.3-4...
Investigating xserver-xorg-video-rendition=1:4.2.4-2...
Investigating xserver-xorg-video-r128=6.8.1-5...
Investigating xserver-xorg-video-openchrome=1:0.2.904+svn916-3...
Investigating xserver-xorg-video-neomagic=1:1.2.5-2...
Investigating xserver-xorg-video-mach64=6.8.2-5...
Investigating xserver-xorg-video-intel=2:2.14.0-4...
Investigating xserver-xorg-video-i128=1:1.3.4-2...
Investigating xserver-xorg-video-glint=1:1.2.5-2...
Investigating xserver-xorg-video-fbdev=1:0.4.2-4...
Investigating xserver-xorg-video-dummy=1:0.3.4-2...
Investigating xserver-xorg-video-cirrus=1:1.3.2-4...
Investigating xserver-xorg-video-radeon=1:6.14.0-1...
Investigating xserver-xorg-input-mouse=1:1.7.0-1...
Investigating xserver-xorg-input-kbd=1:1.6.0-1...
Investigating xserver-xorg-input-evdev=1:2.6.0-2...
Investigating xserver-xorg=1:7.6+4...
Investigating xserver-xorg=1:7.6+8...
Investigating xserver-xorg-video-nvidia=285.05.09-1...
Investigating nvidia-glx=285.05.09-1...
Reading package lists... Done
Building dependency tree
Reading state information... Done
nvidia-glx is already the newest version.
xserver-xorg-video-nvidia is already the newest version.
xserver-xorg is already the newest version.
The following extra packages will be installed:
   libxcb-aux0 (0.3.6-1)
Suggested packages:
   xfonts-scalable (1.0.3-1)
   firmware-linux (0.33)
Recommended packages:
   libgl1-mesa-dri (7.11-6)
The following NEW packages will be installed:
   libxcb-aux0 (0.3.6-1)
The following packages will be DOWNGRADED:
   xserver-xorg-core (1.10.4-1 => 1.9.5-1)
   xserver-xorg-input-evdev (2.6.0-2+b1 => 2.6.0-2)
   xserver-xorg-input-kbd (1.6.0-3 => 1.6.0-1)
   xserver-xorg-input-mouse (1.7.1-1 => 1.7.0-1)
   xserver-xorg-video-cirrus (1.3.2-4+b1 => 1.3.2-4)
   xserver-xorg-video-dummy (0.3.4-2+b1 => 0.3.4-2)
   xserver-xorg-video-fbdev (0.4.2-4+b1 => 0.4.2-4)
   xserver-xorg-video-glint (1.2.5-2+b1 => 1.2.5-2)
   xserver-xorg-video-i128 (1.3.4-2+b1 => 1.3.4-2)
   xserver-xorg-video-intel (2.15.0-3 => 2.14.0-4)
   xserver-xorg-video-mach64 (6.9.0-1 => 6.8.2-5)
   xserver-xorg-video-neomagic (1.2.5-2+b1 => 1.2.5-2)
   xserver-xorg-video-openchrome (0.2.904+svn920-1 => 0.2.904+svn916-3)
   xserver-xorg-video-r128 (6.8.1-5+b1 => 6.8.1-5)
   xserver-xorg-video-radeon (6.14.2-1 => 6.14.0-1)
   xserver-xorg-video-rendition (4.2.4-2+b1 => 4.2.4-2)
   xserver-xorg-video-s3 (0.6.3-4+b1 => 0.6.3-4)
   xserver-xorg-video-savage (2.3.2-3+b1 => 2.3.2-3)
   xserver-xorg-video-siliconmotion (1.7.5-1+b1 => 1.7.5-1)
   xserver-xorg-video-sis (0.10.3-3+b1 => 0.10.3-3)
   xserver-xorg-video-sisusb (0.9.4-2+b1 => 0.9.4-2)
   xserver-xorg-video-tdfx (1.4.3-4+b1 => 1.4.3-4)
   xserver-xorg-video-trident (1.3.4-2+b1 => 1.3.4-2)
   xserver-xorg-video-tseng (1.2.4-2+b1 => 1.2.4-2)
   xserver-xorg-video-vesa (2.3.0-7 => 2.3.0-5)
   xserver-xorg-video-vmware (11.0.3-2+b1 => 11.0.3-2)
   xserver-xorg-video-voodoo (1.2.4-2+b1 => 1.2.4-2)
0 upgraded, 1 newly installed, 27 downgraded, 0 to remove and 107 not upgraded.
Need to get 4,995 kB of archives.
After this operation, 1,081 kB of additional disk space will be used.
Do you want to continue [Y/n]?