How to completely remove a third-party repository from Ubuntu

Suppose you added a third-party repository of DEB packages in your Ubuntu and you now want to completely remove it, by either downgrading the packages to the official version in Ubuntu or removing them altogether. How do you do that?

Well, if it was a Personal Package Archive (PPA), you would simply use ppa-purge. ppa-purge is not pre-installed in Ubuntu, so we install it with

sudo apt update
sudo apt install ppa-purge

Here is the help for ppa-purge:

$ ppa-purge
Warning:  Required ppa-name argument was not specified
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)
    -o [ppaowner]        PPA owner
    -s [host]        Repository server (default:
    -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 -o xorg-edgers
    will remove

    sudo ppa-purge -o sarvatt -p xorg-testing
    will remove

    sudo ppa-purge [ppa:]ubuntu-x-swat/x-updates
    will remove

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.

Here is an example of ppa-purge that removes a PPA:
Suppose we want to completely uninstall the Official Wine Builds PPA. The URI of the PPA is shown on that page in bold, and it is ppa:wine/wine-builds.

To uninstall this PPA, we run

$ sudo ppa-purge ppa:wine/wine-builds
Updating packages lists
PPA to be removed: wine wine-builds
Package revert list generated:
wine-devel- wine-devel-amd64- wine-devel-i386:i386- winehq-devel-

Disabling wine PPA from
Updating packages lists
PPA purged successfully
$ _

But how do we completely uninstall the packages of a third-party repository? Those do not have a URI that is similar to the format that ppa-purge needs!

Let’s see an example. If you have an Intel graphics card, you may choose to install their packaged drivers from For Ubuntu 16.04, the download page is  Yes, they provide a tool that you run on your system and performs a set of checks. Once those checks pass, it adds the Intel repository for Intel Graphics card drivers. You do not see a similar URI from this page, you need to dig deeper after you installed them to find out.

The details of the repository are in /etc/apt/sources.list.d/intellinuxgraphics.list and it is this single line

deb xenial main #Intel Graphics drivers

How did we figure out the parameters for ppa-purge? These parameters are just used to identify the correct file in /var/lib/apt/lists/ For the case of the Intel drivers, the relevant files in /var/lib/apt/lists are


The important ones are the *_Packages files. The important source code line in ppa-purge that will help us, is


therefore, we select the parameters for ppa-purge accordingly:

-s   for   ${PPAHOST}
-o gfx               for   ${PPAOWNER}
-p ubuntu            for   ${PPANAME}

Now ppa-purge can remove the packages from such a PPA as well, by using these parameters:

sudo ppa-purge -s -o gfx -p ubuntu

That’s it!

Leave a Reply

%d bloggers like this: