3 Ways to remove PPAs on Ubuntu

Published on December 24, 2015 . Updated on: -
PPAs (Personal Package Archives) are software repositories used by Ubuntu and some of its derivatives. PPAs provide an easy way for developers to deliver updated software automatically to Linux users by uploading source packages to Launchpad.

Most of the time there's no need to use a PPA, because common software packages are already in the official repositories. But for custom builds, latest versions or simply packages that you can't find in the default repositories you need to use a PPA.

Sometimes, a PPA may not be needed anymore. Maybe the package from PPA has been added or updated also in the default repositories. Or you plan to upgrade the OS to a newer version and the packages for this version weren't yet built in the PPA (to prevent errors in this situation, Ubuntu automatically disables third party PPAs when upgrading). Or the PPA may not be maintained anymore and you get errors when updating apt cache.

3 Ways to remove PPAs on Ubuntu
While each PPA's Launchpad page says how to add it to your system, it doesn't say how to remove it. Here are three ways to remove PPAs from your system without third party software.

1. Software & Updates

This is a GUI applications that is included in Ubuntu and allows you to change automatic updates settings, install drivers and manage PPAs and repositories. If you want to start it from Terminal, the executable name is software-properties-gtk.

software-properties-gtk remove PPA
Removing a PPA from Software & Updates
All you have to do is go to Other Software tab, click a PPA to select it and then click the Remove button. You may need to enter the root password.

2. Terminal

You can remove PPA from Terminal too. Remember how you add it?
sudo apt-add-repository ppa:libreoffice/ppa
All you have to do is add --remove argument and run it again:
sudo apt-add-repository --remove ppa:libreoffice/ppa
Note that this commands supports PPA names as you see in the above command as well as deb lines. For example this is a valid command too (can use it with --remove):
sudo apt-add-repository 'deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu wily main'

3. Manual edit

Use your file manager and go to /etc/apt folder. You should find here, besides other files and folders, a file names sources.list and a folder sources.list.d. Go ahead and open sources.list file with a text editor. Usually this file contains only Ubuntu repos, and you shouldn't have extra repositories here. But if you have, open this file again with a text editor with root permissions (i.e. gksu gedit /etc/apt/sources.list) and comment lines with '#' to disable them and/or delete lines to permanently remove them.

/etc/apt folder contents screenshot
/etc/apt directory contents
You will found .list files for third party repositories in the sources.list.d folder. Each of these files contains a single repository, so in order to disable it, open the file with a text editor with root permissions and comment the line(s). If you want to permanently remove the repo, simply delete the relevant file:
  • from root file manager: run in Terminal gksu nautilus or gksu thunar or gksu nemo depending on what file manager you use. Then go to /etc/apt/sources.list.d folder and delete the file you want.
  • from Terminal: sudo rm /etc/apt/sources.list.d/custom.list && sudo rm /etc/apt/sources.list.d/custom.list.save.
You can delete both the .list file and the .list.save file.

What's next

After changing software sources, you should run:
sudo apt-get update
Otherwise the changes will not be taken into account. Note that Software & Updates automatically prompts you to do this when you try to close it after changing repos. Also, Ubuntu Software Center and Synaptic Package Manager may update apt before installing packages.

Software that was installed from a PPA and is not available in currently enabled repos, will remain installed but will no longer receive updates. Software that is available in other repos, will be rolled-back to the version from that repos upon updating the OS (with sudo apt-get upgrade).

What to do if you have errors in sources.list? If somehow, you messed up the sources.list file, you should see what causes errors by running sudo apt-get update. Most of the time it will complain it can't download packages. Check all repo links for errors (htp instead of http, no space after link and repo name like deb http://ro.archive.ubuntu.com/ubuntu/wily main restricted instead of deb http://ro.archive.ubuntu.com/ubuntu/ wily main restricted).

Errors may be hard to notice, so here's an easy way: regenerate the sources.list file. Go to https://repogen.simplylinux.ch/ and select country, OS release and the repositories you want. When you're done, it will give you a Terminal command. Before that, I recommend backing up old file.
sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup
You should also backup or delete contents of /etc/apt/sources.list.d folder. Now, you can copy and paste the command from Repogen which looks like:
curl https://repogen.simplylinux.ch/txt/sources_XX.txt | sudo tee /etc/apt/sources.list
Use the command provided by Repogen (the above is not a valid one). After this, update cache and you're done:
sudo apt-get update
You should now be able to update and install packages on your OS.

This post showed you three ways to remove unwanted PPAs from your apt configuration. A method for re-generating sources.list is also presented, in case you mess up.

From the same category:

Share this page:


Post a Comment

Please read the comments policy before posting.