How can I downgrade a package to an older version via apt-get
?
Other tools are also acceptable but apt-get
is preferred.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityHow can I downgrade a package to an older version via apt-get
?
Other tools are also acceptable but apt-get
is preferred.
USE
apt-get install «pkg»=«version»
OR
sudo aptitude install «pkg»=«version»
Where «pkg» is the name of the package, and «version» is the version number.
apt-get install pkg=version
apt-get offers removing almost half of all installed packages which of course not what i want to do
– Dfr
Jul 15 '15 at 8:38
aptitude
does a much better job than apt-get
. In my case apt-get
flatly refused the downgrade request, whereas aptitude
pointed out that there were other pkgs which depended on the newer version (and thus needed downgrading at the same time).
– sxc731
Apr 12 '18 at 18:02
If you have the version number, or the target release, apt-get
supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from terminal by typing man apt-get
sudo apt-get install <package-name>=<package-version-number>
OR
sudo apt-get -t=<target release> install <package-name>
is the command to be run. This can be used to down-grade a package to a specific version.
Remark that when using a target release (option -t
), the release priority must greater than 1000 to allow downgrades (see man 5 apt_preferences
) otherwise the currently installed version will be kept.
It has been helpfully pointed out in the comments that
apt-cache showpkg <package-name>
lists all available versions. (h/t Sparhawk)apt-mark hold <package-name>
"holds" the package at the current version, preventing automatic upgrades. (h/t Luís de Sousa )apt-cache policy <package-name>
shows just the installed and available versions
– Michael Lawton
Aug 13 '16 at 20:56
showpkg
does not show the version you are interested in?
– demongolem
Jun 20 '17 at 15:41
bash
to 4.4.18-2ubuntu1
; both aptitude
and apt-get
refuse to do so as they two believe that there is no such a version. Did you find any solution?
– Alish
Aug 23 at 11:16
If you have upgraded software using ppa you can downgrade it by using ppa-purge
. First you have to install ppa-purge
using this code:
sudo apt-get install ppa-purge
Then you can remove the ppa using command
sudo ppa-purge ppa:user/ppa-name
this will automatically downgrade the software to its original version which shipped with Ubuntu.
To downgrade you have to do a command like
sudo apt-get install pkg_name=version
in your terminal.
In the place of version
put the previous version you want to downgrade to.
In my opinion, you should first uninstall or purge the package, like:
sudo apt-get remove <package>
or
sudo apt-get purge <package>
Then, you may download the version you would like to install and keep it in a folder, say abc.deb
in Downloads. Open terminal, move to the folder using cd
command and install the previous version using dpkg
:
sudo dpkg -i abc.deb
Or else, there is a small utility called ppa-purge
if you mean to downgrade packages updated via PPAs.
See this thread: http://www.webupd8.org/2009/12/remove-ppa-repositories-via-command.html
unstable
-> testing
-> stable
not to downgrade individual packages.
– Braiam
Oct 9 '13 at 17:50
This question is old but google led me here and I didn't found simple soulution that don't require manual version passing when downgrading bunch of packages to older release.
So maybe someone who also need that will find useful my solution too.
There is a tool called apt-show-versions
that shows versions installed.
Run $ sudo apt-show-versions -i
if package cache is outdated.
You can easily downgrade all required packages by fine-tuning regex but here it is:
$ sudo apt-get install $(apt-show-versions | grep -P 'newer than version in archive' | awk -F: '{print $1"/'$(lsb_release -cs)'"}')
You shoulld have lsb-release
installed for the latter.
sudo apt-get install -V $(apt-show-versions | grep -F 'newer than version in archive' | awk -F: '{print $1"/'$(lsb_release -cs)'"}')
. I prefer using -F
for grep
here.
– jarno
Sep 15 '19 at 22:24
sudo apt-show-versions -i
first, if the package cache is out of date.
– jarno
Sep 15 '19 at 22:38