Maybe you have installed packages from a PPA or an external source (e.g. downloaded a .deb for a package that is available through the Ubuntu repos.).
Then you decide to drop these upgraded versions in favour to the official repositories.
First step is to remove the entries of the sources.list.

Is there a way to downgrade all to the highest available version? I know you can install specific versions with

apt-get install [package]=[version]
But can you downgrade all?

  • Do you mean one command to remove the current PPA applications and then install the ones from the official repository? I would do something like sudo apt-get -y remove package1 package2 package3 && sudo apt-get install package1 package2 package3 - I don't believe there is a single command such as sudo apt-get repoclean for example to do it.
    – kingmilo
    May 30, 2013 at 10:52
  • So I have to get all packages I installed from the repo? There is no upgrading to the highest available version (that is something you can do with openSUSEs zypper).
    – Manuel
    May 30, 2013 at 11:06
  • If you remove the repo and the package is available in the official repository and that package is a higher version than the package that was available in the repo you added then that package will be upgraded to the version available in the official repository.
    – kingmilo
    May 30, 2013 at 11:35
  • 1
    Yes, but what if not? The upgrade is no problem at all, but the downgrade.
    – Manuel
    May 30, 2013 at 14:26

2 Answers 2


A bit late to the party but I found this question when looking for an answer and now I have my own answer to share.

I believe you can do this via the mysterious world of apt_preferences.

Try making a file called /tmp/a_p (or whatever) like so...

Package: *
Pin: release a=*-backports
Pin-Priority: 100

Package: *
Pin: release n=*
Pin-Priority: 1001

Then run:

sudo apt-get -o Dir::Etc::Preferences=/tmp/a_p dist-upgrade

The second section of the file basically does what the OP requested, in that it bumps the priority of all packages in any live repository to make them install even if it means a downgrade.

The first section prevents the second section from triggering the installation of all backports. You may or may not care about or want this. I'd suggest tinkering to see what works. You can use apt-cache -o Dir::Etc::Preferences=/tmp/a_p policy somepkg to see what effect the a_p file is having on specific packages.



Ok, what if found is the script ppa-purge

If you added a PPA and upgraded software, you can remove the repo and in this step downgrade all packages that were upgraded with

ppa-purge [repo name]

Is this usefull for another person?

But it is still open if you can install the highest version available even if the installed version is higher...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .