Quantcast
Viewing latest article 1
Browse Latest Browse All 10

Downgrade a package in Ubuntu

There are times when you want to use an earlier version of a package in Ubuntu. Perhaps due to a bug in the latest bleeding edge package that is currently in use. Or maybe the behavior has changed in the new version and you want to revert to an older version. How do you go about doing this? There are various ways to re-install an earlier version. And the steps I describe below is one such approach.

Update all packages

First, before you install a new version of any package, update the list of available packages

roshan@ubuntuWorker2:~$ sudo aptitude -y update

Find out the version of the target package currently installed

I’m currently on Ubuntu 9.10 (karmic) and say I want to downgrade upstart package. The version of upstart that comes with karmic is 0.6.3-11. You can find out the version of an installed package using aptitude show <package-name> command

roshan@ubuntuWorker2:~$ aptitude show upstart
Package: upstart
State: installed
Automatically installed: no
Version: 0.6.3-11
Priority: required
Section: admin
Maintainer: Scott James Remnant
Uncompressed Size: 1,245k
PreDepends: libc6 (> 2.10), libc6 (< 2.11), libdbus-1-3 (>= 1.2.16), libudev0,
sysvinit-utils, sysv-rc, initscripts, mountall
Conflicts: startup-tasks, system-services, sysvinit, upstart-compat-sysv,
upstart-job
Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv,
upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
Description: event-based init daemon
upstart is a replacement for the /sbin/init daemon which handles starting of
tasks and services during boot, stopping them during shutdown and supervising
them while the system is running.
Homepage: http://upstart.ubuntu.com/

Find out the versions that are available for installation
Next, we find out the versions of upstart that are available. You can do this via the apt-cache command.

roshan@ubuntuWorker2:~$ apt-cache policy upstart
upstart:
Installed: 0.6.3-11
Candidate: 0.6.3-11
Version table:
*** 0.6.3-11 0
500 http://us.archive.ubuntu.com karmic-updates/main Packages
100 /var/lib/dpkg/status
0.6.3-10 0
500 http://us.archive.ubuntu.com karmic/main Packages

The above output shows an available earlier version 0.6.3-10 that we could use to replace the 0.6.3-11 version.

The above apt-cache policy output is very concise. You can get a little more detail using the apt-cache show command:

roshan@ubuntuWorker2:~$ apt-cache show upstart
Package: upstart
Priority: required
Section: admin
Installed-Size: 1216
Maintainer: Scott James Remnant
Architecture: i386
Version: 0.6.3-11
Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
Pre-Depends: libc6 (>> 2.10), libc6 (<< 2.11), libdbus-1-3 (>= 1.2.16), libudev0, sysvinit-utils, sysv-rc, initscripts, mountall
Conflicts: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job
Filename: pool/main/u/upstart/upstart_0.6.3-11_i386.deb
Size: 510882
MD5sum: 48016435634a00037cfbacae574c5dcb
SHA1: 584a2fb84490d4a87001a572ea719c23f0f7d33c
SHA256: 3112cc23f022f31866a71da4e1d119c85c5b88797aebbd52455246df138d72d8
Description: event-based init daemon
upstart is a replacement for the /sbin/init daemon which handles
starting of tasks and services during boot, stopping them during
shutdown and supervising them while the system is running.
Homepage: http://upstart.ubuntu.com/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Task: minimal

Package: upstart
Priority: required
Section: admin
Installed-Size: 1216
Maintainer: Scott James Remnant
Architecture: i386
Version: 0.6.3-10
Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
Pre-Depends: libc6 (>> 2.10), libc6 (<< 2.11), libdbus-1-3 (>= 1.2.16), libudev0, sysvinit-utils, sysv-rc, initscripts, mountall
Conflicts: startup-tasks, system-services, sysvinit, upstart-compat-sysv, upstart-job
Filename: pool/main/u/upstart/upstart_0.6.3-10_i386.deb
Size: 510756
MD5sum: bab8da73686e9b52ab03b681da887b9d
SHA1: da089820f7fb8a138be2cab4696f93c58ec960e5
SHA256: 29de168725b0399a282ebe304c83282b78301d3e47dfd75d3ad706006261e95d
Description: event-based init daemon
upstart is a replacement for the /sbin/init daemon which handles
starting of tasks and services during boot, stopping them during
shutdown and supervising them while the system is running.
Homepage: http://upstart.ubuntu.com/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Task: minimal

Install an older version

Now that we know we have upstart 0.6.3-10 available, we can go ahead an install it to replace version 0.6.3-11.
We do this using the command aptitude install <package-name>=<version>

roshan@ubuntuWorker2:~$ sudo aptitude install upstart=0.6.3-10
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done
The following packages will be DOWNGRADED:
upstart
0 packages upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 511kB of archives. After unpacking 0B will be used.
WARNING: untrusted versions of the following packages will be installed!

Untrusted packages could compromise your system’s security.
You should only proceed with the installation if you are certain that
this is what you want to do.

upstart

Do you want to ignore this warning and proceed anyway?
To continue, enter “Yes”; to abort, enter “No”: Yes
Writing extended state information… Done
Get:1 http://us.archive.ubuntu.com karmic/main upstart 0.6.3-10 [511kB]
Fetched 511kB in 5s (100kB/s)
dpkg: warning: downgrading upstart from 0.6.3-11 to 0.6.3-10.
(Reading database … 47397 files and directories currently installed.)
Preparing to replace upstart 0.6.3-11 (using …/upstart_0.6.3-10_i386.deb) …
Unpacking replacement upstart …
Processing triggers for man-db …
Setting up upstart (0.6.3-10) …
Installing new version of config file /etc/init/rc-sysinit.conf …

Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initializing package states… Done

As you can see from the output, the package manager downgrades the package. If you want to you can confirm the installed version next.

Verify version

Run aptitude show to check the version of the package installed.

roshan@ubuntuWorker2:~$ aptitude show upstart
Package: upstart
State: installed
Automatically installed: no
Version: 0.6.3-10
Priority: required
Section: admin
Maintainer: Scott James Remnant
Uncompressed Size: 1,245k
PreDepends: libc6 (> 2.10), libc6 (< 2.11), libdbus-1-3 (>= 1.2.16), libudev0,
sysvinit-utils, sysv-rc, initscripts, mountall
Conflicts: startup-tasks, system-services, sysvinit, upstart-compat-sysv,
upstart-job
Replaces: startup-tasks, system-services, sysvinit, upstart-compat-sysv,
upstart-job
Provides: startup-tasks, system-services, upstart-compat-sysv, upstart-job
Description: event-based init daemon
upstart is a replacement for the /sbin/init daemon which handles starting of
tasks and services during boot, stopping them during shutdown and supervising
them while the system is running.
Homepage: http://upstart.ubuntu.com/

Note that the above is one approach to downgrading a package. If you use a GUI, you could use Synaptic Package Manager and pick the version and downgrade.

In the approach described above, if you run aptitude safe-upgrade, the package manager will download and install the candidate version displayed in the apt-cache policy command. In our example case above, that would be upstart 0.6.3-11.
To prevent this from happening, you could set up pinning. See here.

Image may be NSFW.
Clik here to view.

Viewing latest article 1
Browse Latest Browse All 10

Trending Articles