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.
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 & UpdatesThis 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.
|Removing a PPA from Software & Updates|
2. TerminalYou can remove PPA from Terminal too. Remember how you add it?
sudo apt-add-repository ppa:libreoffice/ppaAll you have to do is add --remove argument and run it again:
sudo apt-add-repository --remove ppa:libreoffice/ppaNote 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 editUse 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 directory contents|
- 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 nextAfter changing software sources, you should run:
sudo apt-get updateOtherwise 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.backupYou 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.listUse the command provided by Repogen (the above is not a valid one). After this, update cache and you're done:
sudo apt-get updateYou 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.