Ask Klaus

Ask Klaus

Article from Issue 192/2016
Author(s):

Klaus Knopper answers your Linux questions.

Downgrading Packages

Hi Klaus, how can I select a specific version, possibly an older one, of a package to install in Debian if I want to avoid the newest version of, for example, Chromium from the "unstable" branch?

To see the current available versions of a package, you have to update the package catalog first. I sometimes even delete the old package catalog lists (first line) to make sure all of them get downloaded again,

sudo rm -f /var/lib/apt/lists/*
sudo apt-get update

although this step is optional. The second line does not actually update anything, it just fetches the software catalogs from all Debian branches listed in /etc/apt/sources.list and /etc/apt/sources.list.d/*.

To check for available versions in each Debian branch, the command

apt-cache policy <package-name>

can be helpful. Because it only queries the software catalog, no root permissions are required (Listing 1). On some systems, the command apt-show-versions is installed and shows more verbose information. However, as opposed to apt-cache policy, it is not included in standard Debian.

Listing 1

Chromium Versions

apt-cache policy chromium
chromium:
  Installed:  52.0.2743.116-2
  Candidate:  53.0.2785.92-2
  Version table:
     53.0.2785.92-2 500
        500 http://ftp.debian.org/debian unstable/main i386 Packages
     53.0.2785.89-1~deb8u1 990
        990 http://security.debian.org stable/updates/main i386 Packages
 *** 52.0.2743.116-2 500
        500 http://ftp.debian.org/debian testing/main i386
        100 /var/lib/dpkg/status
Packages
     50.0.2661.94-1~deb8u1 990
        990 http://ftp.debian.org/debian stable/main i386 Packages

The Chromuim version currently installed is 52.0.2743.116-2 from the Debian/testing branch. The apt-get install command would install version 53.0.2785.92-2 from Debian/unstable, so if I would rather use version 53.0.2785.89-1~deb8u1 from the Debian/stable security updates, for example, the command for download and installation would be:

sudo apt-get install chromium= 53.0.2785.89-1~deb8u1

Another option for specifying the branch rather than the specific version number is adding the branch name right after the package name separated by a slash, which is syntactically not supported for branches with a sub-branch like stable/updates. I'll chose the unstable branch here:

sudo apt-get chromium/unstable

If apt-get now complains about dependencies (e.g., packages that Chromium depends on) not being installable, you can also tell apt-get which Debian branch to go for those with the -t switch:

sudo apt-get install -t testing chromium=53.0.2785.89-1~deb8u1

You can specify dependency packages to install in addition to chromium by adding them to the same command line, each with versioning information. In this way, you can possibly resolve more complicated dependencies with mixed-branch versions of installed software:

sudo apt-get install -t testing chromium=53.0.2785.89-1~deb8u1   chromium-l10n=53.0.2785.89-1~deb8u1 libnspr4/unstable

This is what I frequently do in Knoppix to get the newest packages for Xorg and the desktop, yet get the more tested versions for services like apache2 and samba from the stable branch.

To keep the installed version permanently without automatic upgrades, you can put it on "hold" by issuing:

echo chromium hold | sudo dpkg --set-selections

The hold status can be removed again by simply upgrading or downgrading the package anytime later.

Klaus Knopper

Klaus Knopper is an engineer, creator of Knoppix, and co-founder of LinuxTag expo. He works as a regular professor at the University of Applied Sciences, Kaiserslautern, Germany. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Ask Klaus!

    Klaus addresses problems with Wheezy updates, Adobe Flash, dial-up settings, and mountpoint dates.

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of LinuxTag expo. He currently works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

  • Flash Plugins in Linux

    PPAPI, NPAPI, Pepper Flash, Fresh Player – just a lot of gibberish? We check out the background of Flash in Linux and provide tips on how to rule out the worst bugs in the technology.

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of LinuxTag expo. He currently works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

  • Ask Klaus!

    Klaus Knopper answers your Linux questions about Android USB backup.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News

njobs Europe
What:
Where:
Country:
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia