Howto roll back packages or install specific versions

Firstly, we need to find what lower versions of our package are available to us, we use the following command:

apt-cache showpkg sun-java6-jdk

This will produce output similar to the following:

Package: sun-java6-jdk
Versions:
6-14-0ubuntu1.9.04 (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jaunty-proposed_multiverse_binary-amd64_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jaunty-proposed_multiverse_binary-amd64_Packages
MD5: cb47d4c49fa7317c472613b7010ef9d8
6-13-1 (/var/lib/apt/lists/au.archive.ubuntu.com_ubuntu_dists_jaunty_multiverse_binary-amd64_Packages)
Description Language:
File: /var/lib/apt/lists/au.archive.ubuntu.com_ubuntu_dists_jaunty_multiverse_binary-amd64_Packages
MD5: cb47d4c49fa7317c472613b7010ef9d8
Reverse Depends:
sun-java6-source,sun-java6-jdk 6-14-0ubuntu1.9.04
sun-java6-javadb,sun-java6-jdk 6-14-0ubuntu1.9.04
sun-java6-demo,sun-java6-jdk
sun-java6-demo,sun-java6-jdk 6-14-0ubuntu1.9.04
libnb-java2-java,sun-java6-jdk
libnb-java2-java,sun-java6-jdk
sun-java6-source,sun-java6-jdk 6-13-1
sun-java6-javadb,sun-java6-jdk 6-13-1
sun-java6-demo,sun-java6-jdk
sun-java6-demo,sun-java6-jdk 6-13-1
glassfishv2-bin,sun-java6-jdk
glassfishv2,sun-java6-jdk
Dependencies:
6-14-0ubuntu1.9.04 - sun-java6-bin (5 6-14-0ubuntu1.9.04) libc6 (0 (null)) libx11-6 (0 (null)) debconf (18 0.5) debconf-2.0 (0 (null)) sun-java6-demo (0 (null)) sun-java6-doc (0 (null)) sun-java6-source (0 (null))
6-13-1 - sun-java6-bin (5 6-13-1) libc6 (0 (null)) libx11-6 (0 (null)) debconf (18 0.5) debconf-2.0 (0 (null)) sun-java6-demo (0 (null)) sun-java6-doc (0 (null)) sun-java6-source (0 (null))
Provides:
6-14-0ubuntu1.9.04 - java6-sdk java5-sdk java2-sdk java2-compiler java-sdk java-compiler
6-13-1 - java6-sdk java5-sdk java2-sdk java2-compiler java-sdk java-compiler
Reverse Provides:

There are two versions available in the repository. As we can see the java version we are looking for (6-13-1) is here. However it is worth noting that had we wanted to downgrade several versions back, we would be out of luck as older versions are no longer in the repository.

Now that we see the version that we want we need to do the following to downgrade:

sudo aptitude install sun-java6-jdk=6-13-1

This will produce something along the lines of:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following packages are BROKEN:
sun-java6-jdk
0 packages upgraded, 0 newly installed, 1 downgraded, 0 to remove and 2 not upgraded.
Need to get 17.7MB of archives. After unpacking 1925kB will be freed.
The following packages have unmet dependencies:
sun-java6-jdk: Depends: sun-java6-bin (= 6-13-1) but 6-14-0ubuntu1.9.04 is installed.
The following actions will resolve these dependencies:
Remove the following packages:
sun-java6-fonts
sun-java6-plugin
Downgrade the following packages:
sun-java6-bin [6-14-0ubuntu1.9.04 (jaunty-proposed, now) -> 6-13-1 (jaunty)]
sun-java6-jre [6-14-0ubuntu1.9.04 (jaunty-proposed, now) -> 6-13-1 (jaunty)]
Score is 188
Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
sun-java6-bin sun-java6-jdk sun-java6-jre
The following packages will be REMOVED:
sun-java6-fonts{a} sun-java6-plugin{a}
0 packages upgraded, 0 newly installed, 3 downgraded, 2 to remove and 2 not upgraded.
Need to get 50.7MB of archives. After unpacking 4096kB will be freed.
Do you want to continue? [Y/n/?] Y

If we now run:

java -version

We get:

java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)

Which is the downgraded java that we were after, sweet!

/var/customers/webs/cw01/wiki/data/pages/debian/rolling_back_packages.txt · Last modified: 2011/05/09 08:44 by wadmin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki