≡ Menu

Ubuntu Linux Remove/Delete PPAs apt-get command

Over time I have added way too many PPAs using the add-apt-repository command on Ubuntu Linux 16.04 LTS server for testing purpose. How can I delete or remove those PPAs? Is there a command to list all PPAs?

Yes, you can delete or remove a PPA. You must have root privileges to achieve this task.

What is a PPA?

A PPA is an acronym for Personal Package Archive. It is nothing but pre-built binary software repository for apt packages. The author uploads source code and packages are built online using Launchpad.

How to list all installed PPAs

Type the following command:
$ grep ^ /etc/apt/sources.list.d/*
Sample outputs:

Fig.01: Ubuntu Linux list all installed PPAs command

Fig.01: Ubuntu Linux list all installed PPAs command

How to delete/remove PPAs

The syntax is:
sudo add-apt-repository --remove ppa:name/here
To remove PPA named ppa:gluster/glusterfs-3.9. However, before removing PPA delete all packages installed from the same PPA using apt-get command/apt command:
$ apt-get --purge remove glusterfs-server
$ apt-get --purge autoremove

Now delete PPA:
$ sudo add-apt-repository --remove ppa:gluster/glusterfs-3.9
Sample outputs:

 This archive is EOL. Please use a supported version.
 More info: https://launchpad.net/~gluster/+archive/ubuntu/glusterfs-3.9
Press [ENTER] to continue or ctrl-c to cancel removing it

Finally update your repo:
$ sudo apt-get update
Sample outputs:

Hit:1 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial InRelease
Hit:2 http://download.nus.edu.sg/mirror/mariadb/repo/10.1/ubuntu xenial InRelease         
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]                     
Hit:4 http://mirror.lstn.net/mariadb/repo/10.1/ubuntu xenial InRelease                                    
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial InRelease              
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 204 kB in 1s (185 kB/s)    
Reading package lists... Done

Say hello to ppa-purge tool

The ppa-purge tool is nothing but a bash shell script capable of downgrading all packages in a given PPA back to the original Ubuntu versions. It disables a PPA. First install ppa-purge:
$ sudo apt-get install ppa-purge
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  aptitude
The following NEW packages will be installed:
  ppa-purge
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 6,312 B of archives.
After this operation, 24.6 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 ppa-purge all 0.2.8+bzr63 [6,312 B]
Fetched 6,312 B in 0s (24.2 kB/s)
Selecting previously unselected package ppa-purge.
(Reading database ... 92785 files and directories currently installed.)
Preparing to unpack .../ppa-purge_0.2.8+bzr63_all.deb ...
Unpacking ppa-purge (0.2.8+bzr63) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ppa-purge (0.2.8+bzr63) ...

ppa-purge syntax

The syntax is:
$ sudo ppa-purge ppa:repo-name/dirname
For example, remove apt-fast command repo that is used to speed up apt-get on Ubuntu Linux:
$ sudo ppa-purge ppa:saiarcot895/mypp
Sample outputs:

Fig.02: Delete PPAs using ppa-purge script

Fig.02: Delete PPAs using ppa-purge script


To remove https://launchpad.net/~saiarcot895/+archive/ubuntu/myppa you can use following syntax too:
$ sudo ppa-purge -o myppa
$ sudo ppa-purge -o saiarcot895 -p myppa

Where,


	-p [ppaname]		PPA name to be disabled (default: ppa)
	-o [ppaowner]		PPA owner
	-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
Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 3 comments… add one }
  • Ice Alinutza March 9, 2017, 5:54 am

    Good job! But I am inquiring. When I delete a PPA will be deleted and its dependencies? If the answer is “yes”, what happens if those dependencies are used by other PPAs? And they are also deleted? Thank you!

    • Vivek Gite March 9, 2017, 5:22 pm

      Last tool will delete those or you can simply run:
      $ sudo apt-get --purge autoremove

      • Ice Alinutza March 9, 2017, 9:12 pm

        I asked what happens if the dependencies are used by other PPAs? They are erased with erasing that PPA?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: ,