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.


6 Answers 6


Check out ppa-purge Install ppa-purge.


ppa-purge -purge <nameofppa> [-s hostserver]

Hostserver defaults to ppa.launchpad.net.

Here is the link to the manpage for the ppa-purge command Manpage icon for reference.

  • Or you could use my branch of ppa-purge which has many bug fixes and improvements over the ppa-purge in universe repository. See here for more information.
    – jarno
    Nov 20, 2019 at 21:19

Overcoming aptitude's Multiarch Bug for ppa-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 because aptitude cannot handle conflicting dependencies in multiarch packages (that's what the bug is about), and the default behavior of ppa-purge is to use aptitude to downgrade packages.

Fortunately, ppa-purge accepts the -i flag which causes it to prefer apt-get to aptitude as its backend. As documented in the bug report, using apt-get is an effective alternative to manually invoking aptitude, so running ppa-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:

sudo ppa-purge -i ppa:ppaowner/ppaname

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 to ppa.

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 of aptitude. Then I would run:

sudo ppa-purge -i ppa:hydr0g3n/qbittorrent-unstable

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 running ppa-purge -h (or just ppa-purge with no arguments):

ek@Del:~$ ppa-purge -h
Usage: sudo ppa-purge [options] <ppa:ppaowner>[/ppaname]

ppa-purge will reset all packages from a PPA to the standard
versions released for your distribution.

    -p [ppaname]        PPA name to be disabled (default: ppa)
    -s [host]       Repository server (default: ppa.launchpad.net)
    -d [distribution]   Override the default distribution choice.
    -y          Pass -y --force-yes to apt-get or -y to aptitude
    -i          Reverse preference of apt-get upon aptitude.
    -h          Display this help text

Example usage commands:
    sudo ppa-purge xorg-edgers
    will remove https://launchpad.net/~xorg-edgers/+archive/ppa

    sudo ppa-purge -p xorg-testing sarvatt
    will remove https://launchpad.net/~sarvatt/+archive/xorg-testing

    sudo ppa-purge ppa:ubuntu-x-swat/x-updates
    will remove https://launchpad.net/~ubuntu-x-swat/+archive/x-updates

Notice: If ppa-purge fails for some reason and you wish to try again,
(For example: you left synaptic open while attempting to run it) simply
uncomment the PPA from your sources, run apt-get update and try again.

"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 prefer aptitude to apt-get, and the -i flag reverses this preference.

  • The last time when I tried ppa-purge, it did not remove packages that have been deleted from PPAs. Is that still the case?
    – Lekensteyn
    Jul 23, 2012 at 13:08
  • @Lekensteyn Yes, I believe it is still the case that ppa-purge will not remove or downgrade packages that are no longer provided by the PPA being "purged." However, you may want to post a separate question about this, to get a more authoritative or well-documented answer. Jul 23, 2012 at 15:47
  • If the repository is not a PPA hosted in Launchpad, but other non-standard repository, will ppa-purge work?
    – Anwar
    Jan 28, 2015 at 13:26
  • 1
    @Anwar I'm not positive if it will work, but you should be able to try by specifying the full repository URL instead of ppa:username/path. Also the PPA must be ENABLED before you attempt to purge it, even though the script immediately disables after updating the listing of packages to remove, it won't "find" already disabled PPAs.
    – dragon788
    Nov 6, 2017 at 16:37
  • 1
    @Lekensteyn you can try using aptitude search ~o to find orphaned packages with no installation source if you need to purge something that was removed from a PPA (or was installed as a one off via dpkg -i).
    – dragon788
    Nov 6, 2017 at 16:39

This script can list all packages from a particular server/branch (modifying the two declared variables):



apt-cache policy $(dpkg -l | awk 'NR >= 6 { print $2 }') |
  awk -v server="$server" -v branch="$branch" \
    '/^[^ ]/      { split($1, a, ":"); pkg = a[1] }
    nextline == 1 { nextline = 0; if ($2 == server && $3 == branch) print pkg }
    /\*\*\*/      { nextline = 1 }'

if you need to list all packages not coming from a particular server, independently from the branch, replace the next-to-last line with:

nextline == 1 { nextline = 0; if ($2 != server) print pkg }
  • 1
    Not what I'm exactly looking for, this script just displays the all packages from a specific repository entry. By replacing $2 == server && $3 == branch by $2 != server, my question is answered. Please put that in your answer :) (the branch= line can be removed) Note: it's assumed that all packages come from a single repository server.
    – Lekensteyn
    Apr 28, 2011 at 13:13
  • 1
    This script (slightly modified per my last comment) works as expected. The libvpx0 package existed in both the main repo as in the chromium-daily PPA. After removing the repositories from /etc/apt/sources.list.d, I had still a left-over package: libvpx0. I "repaired" this as follows: remove the library with dpkg, ignoring dependencies: sudo dpkg --ignore-depends=libvpx0 --remove libvpx0. Next, install it again from the main repo: sudo apt-get install libvpx0.
    – Lekensteyn
    Apr 28, 2011 at 13:54
  • 1
    @Lekensteyn: probably you could have shortened your work with sudo apt-get install libvpx0=$version_string, supposing the two available packages have different version strings.
    – enzotib
    Apr 28, 2011 at 14:10
  • indeed, that was possible too and maybe better as well.
    – Lekensteyn
    Apr 28, 2011 at 14:24
  • I just needed to check which packages are not installed from the default repos. The command apt-cache policy $(dpkg -l | awk '/^ii/{print $2}') > policy.txt; awk '!/^ /{pkg=$1}check{print pkg, $2;check=0}/\*\*\*/{check=1} ' policy.txt | grep -v archive.ubuntu is a good start (add more grep -v to exclude certain PPAs). Package versions that are not known in any repo show up as /var/lib/dpkg/status.
    – Lekensteyn
    Jan 21, 2014 at 23:12

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.

  1. Open synaptic package manager. If not installed then install it by:

    sudo apt-get install synaptic
  2. 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.

  3. Now select all packages to remove.

    Tips to mark for removal:

    1. 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.

    2. 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 install apt-show-versions. Running apt-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 to apt-get remove:

 for i in `apt-show-versions | grep 'No available' | cut -d' ' -f 1` ; do  sudo apt-get remove -y $i ; done

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.

  • Sounds good, I will give it a try.
    – Lekensteyn
    Apr 28, 2011 at 13:00
  • 3
    The upgrade process itself will also autodisable the PPAs, though I am pretty sure it won't go and remove all the left over packages. Apr 28, 2011 at 13:02
  • @Jorge: I've indeed noticed that the PPA's are disabled (commented out), but it does not remove the packages. I think it's better to remove the packages before a new version from the Ubuntu repositories overwrite the files.
    – Lekensteyn
    Apr 28, 2011 at 13:08
  • I've just tested this and it does not make a distinction between packages from the main repos and a PPA. In my case, it was the libvpx0 package from the chromium-daily PPA. @enzotib's answer did show this package.
    – Lekensteyn
    Apr 28, 2011 at 13:46
  • If you run apt-show-versions as non-root, it needs a sudo apt-show-versions -i to update it's cache and see changes from newly removed repositories / PPAs (otherwise it's only updated via a cron.daily job)
    – Xen2050
    Feb 19, 2019 at 11:50

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.


  • 5
    This removes only package sources, it does not remove the package from those sources.
    – Lekensteyn
    May 9, 2013 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.