For a smooth upgrade from 10.04 to 10.10, I would like to remove all packages which are not in the default repositories (e.g. chromium PPA and third-party repositories). What is the easiest way (preferably CLI) to find and remove these packages?
Edit: this question is not restricted to PPA's, I have a x2go repository as well, so I'm looking for a generic command to remove packages belonging to a certain repository. For PPA's, the question How can PPAs be removed has great answers.
Check out ppa-purge .
Usage:
Hostserver defaults to
ppa.launchpad.net
.Here is the link to the manpage for the
ppa-purge
command for reference.Overcoming
aptitude
's Multiarch Bug forppa-purge
Normally, as Vadim Rutkovsky and Takkat have explained, running
ppa-purge
with default syntax is an effective way to remove all packages provided by a PPA, properly downgrading them to versions provided in other configured software sources whenever possible.However, as Takkat has pointed out, bug 831768 prevents
ppa-purge
from working properly to remove multiarch packages (like 32-bit packages installed on 64-bit systems). This is becauseaptitude
cannot handle conflicting dependencies in multiarch packages (that's what the bug is about), and the default behavior ofppa-purge
is to useaptitude
to downgrade packages.Fortunately,
ppa-purge
accepts the-i
flag which causes it to preferapt-get
toaptitude
as its backend. As documented in the bug report, usingapt-get
is an effective alternative to manually invokingaptitude
, so runningppa-purge
with the-i
flag should be an effective workaround for removing/downgrading all packages provided by a PPA, including multiarch packages.How To Do It
Here's the syntax:
As usual (same as when the
-i
flag is not used):ppaowner
is replaced with the owner of the PPA./ppaname
is optional. If present,ppaname
is replaced with the name of the PPA. If not, it defaults toppa
.For example, suppose I had the PPA for unstable builds of qBittorrent installed, and I wanted to remove it completely, automatically downgrading qBittorrent to whatever version is available through my other software sources using
apt-get
behind the scenes instead ofaptitude
. Then I would run:Where It's Documented
For some reason, a few useful options for
ppa-purge
are not documented in its manual page, including-i
. But you can get information about them by runningppa-purge -h
(or justppa-purge
with no arguments):"Reverse preference of apt-get upon aptitude" is a bit cryptic. By looking at the relevant piece of the source code (
ppa-purge
is just a shell script, after all), we can see that this means that the default behavior is to preferaptitude
toapt-get
, and the-i
flag reverses this preference.This script can list all packages from a particular server/branch (modifying the two declared variables):
if you need to list all packages not coming from a particular server, independently from the branch, replace the next-to-last line with:
Here is GUI ways to do so. Hope it would help for those who don't prefer CLI. The steps are simple and easy to follow.
Open synaptic package manager. If not installed then install it by:
When opened click on Origin button on down-left. It will list all the repositories on top-left side. Select the particular repository for which packages are to be removed. It will list all the packages under that repository. Click the first field i,e S or Installed Version field to show the installed packages first.
Now select all packages to remove.
Tips to mark for removal:
Select first package then hold Shift key and again select the last package to select all. Then right click on the square box and select mark for removal or mark for complete removal.
or Select any packages and press Ctrl+A to select all. Then right click on the square box and chose mark for removal or mark for complete removal.
That's it. It will remove without any problem. I've also attached the image to make it more clear. Hope it would help. :)
To at least find them, start by disabling the PPA's and run
apt-get update
. Then installapt-show-versions
. Runningapt-show-versions | grep 'No available'
will then give you a list of all your installed packages that cannot be found in your configured repositories. With some command-line magic you can probably strip out the package names only and pass them toapt-get remove
:Note that this will go through the list returned from
apt-show-versions
and remove them one by one. Depending on what it finds, this could uninstall something unintended due to dependencies, so check it first.I found use of ppa-purge to be difficult.
Open Synaptic Package Manager under System, then select Settings, Repositories.
Remove the ones you don't want.
Done!