Ubuntu – Remove all packages installed from a PPA

aptlaunchpadppapurge

I have installed LibreOffice 4 using PPA. I was using LibreOffice 3, then I had upgraded to LibreOffice 4, because I was somewhat eager to try a new version.

Now since I found that LibreOffice 4 has some issues, including handling my native language, I want to move back to LibreOffice 3.

This question How to downgrade from LibreOffice 4.0 to 3.6? has already some answers which has some similarity with my above mentioned issue, but it does not solve my problem. This question talks about downgrading from a specific version of LibreOffice, namely from 4.0 to 3.6. The solutions mentioned are not the ones I am looking for. They will work, but the solutions suggest either downloading .deb files for LibreOffice 3.6 or adding PPA for them. Furthermore, some of the answers put out-of-proportion~(applicable for the solution, however) stress on use of synaptic, not general command-line-solution.

I want a general solution without using PPA or downloading .deb files. All I want is to move back from the (higher) PPA version to the (lower) official version.

Anyway, in order to accomplish this, I removed the LibreOffice config directory from my home and then purged LibreOffice from my machine.

sudo apt-get purge libreoffice-*

Then I removed the relevant PPA's using the sudo apt-add-repository --remove command. And then ran sudo apt-get update.

Now, when I try to install LibreOffice using the command

sudo apt-get install libreoffice

I get an avalanche of output about unmet dependencies, something like,

The following packages have unmet dependencies:
 libreoffice : Depends: libreoffice-core (= 1:3.5.7-0ubuntu4) but it is not going to be installed
(snipped)

If I dig the issue further, by using the command,

sudo apt-get install libreoffice-core

I get

The following packages have unmet dependencies:  libreoffice-core :
Depends: libreoffice-common (> 1:3.5.7) but it is not going to be
installed
                Depends: libexttextcat0 (>= 2.2-8) but it is not going to be installed
                Depends: ure (>= 3.5.7~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

Could you please tell me how do I install LibreOffice 3 in my machine?

I am using Ubuntu 12.04 LTS.


EDIT

Before receiving the accepted answer, I was wondering, at this very moment, if I take a fresh computer, and install Ubuntu 12.04, LibreOffice installation will work without a hitch. Then why I can not install LibreOffice in my 12.04 machine today from simple command line? Then the accepted answer clarified everything. I need to use ppa-purge so that this resets all packages from a PPA to the standard versions released for my distribution. Basically it is like a way to restore my system back to the way it was before my installed packages from a PPA. This article further elaborates the idea.

The above mentioned answer worked perfectly for me. Actually, this was an education for me since it taught me how do downgrade a package that was added via PPA. And I realized that the answer actually teaches us to "move from PPA installation of a package to official lower version package."


Best Answer

You need the ppa-purge utility to downgrade all the packages installed by the PPA and disable the PPA.

Since you have removed the PPA from your sources list, you have to add it back.

Then, run:

sudo apt-get install ppa-purge
sudo ppa-purge ppa:<your_ppa_name_here>

Then you can install LibreOffice 3 from the official repositories.

Regards.