How To Downgrade A Package In Ubuntu

Downgrade A Package In Ubuntu

A friend of mine asked me how to downgrade a package to its lower versions. I already know how to downgrade a package in Arch Linux, but I haven’t done downgrading packages in Ubuntu before. After a bit of search in Ubuntu forums, I found that there is an easy way to do this. Read on further to know how can we downgrade package in Ubuntu and its derivatives.

Downgrade A Package In Ubuntu

Let us do this in step by step.

Let us see the currently installed Firefox version.

firefox-version

As you see in the above screenshot, my Firefox version is 50.

Say for example, I want to downgrade this Firefox version to its lower version i.e 45. How can I do that? Easy!

But wait, I don’t know the available older versions in the repositories, how can I find it out?

Run the command from your Terminal to list the available versions in the repositories.

sudo apt-cache showpkg firefox

firefox-version1

The above command will display the available Firefox version.

Let us downgrade Firefox version to 45. To do so, run:

sudo apt-get install firefox=45.0.2+build1-0ubuntu1

Type “y” and hit ENTER key.

Sample output:

Reading package lists... Done
Building dependency tree 
Reading state information... Done
Suggested packages:
 fonts-lyx
The following packages will be DOWNGRADED:
 firefox
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 332 not upgraded.
Need to get 43.2 MB of archives.
After this operation, 6,519 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 firefox amd64 45.0.2+build1-0ubuntu1 [43.2 MB]
Fetched 43.2 MB in 2min 43s (263 kB/s) 
dpkg: warning: downgrading firefox from 50.0+build2-0ubuntu0.16.04.2 to 45.0.2+build1-0ubuntu1
(Reading database ... 224874 files and directories currently installed.)
Preparing to unpack .../firefox_45.0.2+build1-0ubuntu1_amd64.deb ...
Unpacking firefox (45.0.2+build1-0ubuntu1) over (50.0+build2-0ubuntu0.16.04.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160523-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up firefox (45.0.2+build1-0ubuntu1) ...
Please restart all running instances of firefox, or you will experience problems.

downgrade-firefox-version

Note: You should mention the version exactly as shown in the above command. If there is any spelling mistakes, this command will not downgrade the package and will display there is no such package in the repositories.

Restart all running Firefox instances. Now, you will see the Firefox has been downgraded to the older version.

firefox-version2

Alternatively, you can check the Firefox version from Terminal using command:

sudo apt-cache show firefox | grep Version

I want to keep Firefox version 48 forever. I don’t want to upgrade it automatically. How can I do that? It’s easy too. Read the following guide to know how to prevent a package from being automatically upgraded to next available version.

That’s all for today. If you find this guide useful, please share it on your social networks and support OSTechNix.

Cheers!

Thanks for stopping by!

How can I benefit from this blog:

Have a Good day!!

You may also like...

  • If you’re just interested in finding out the available versions, I like ‘apt-cache policy firefox’ better.