How To 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 downgraded packages in Ubuntu. 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
For the purpose of this tutorial, I am going to downgrade Firefox package.
Let us see the currently installed 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? That’s what you’re going to learn today.
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
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.
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.
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.
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.
Hope this helps.