Debian

How to Remove PPA Repository from Command Line on Debian?

PPA (Personal Package Archive) are a special kind of repository that allows users to install packages from an external source, which are not available in the official system repository. By adding the PPA repository to the official repository list, the users will be able to install the package from the “apt” command. However, adding an erroneous repository interrupts the installation of a package on the system. Further, adding too many unused repositories will slow down the update process. So, it’s better to remove these repositories to fix the issues.

This article is a detailed guide to remove PPA repository from the command line in Debian.

Remove PPA Repository from Command Line on Debian?

There are multiple methods to remove PPA repository from the command line on Debian. However, before getting into that it is better to know the ways to list the installed PPA repositories in your Debian.

List Installed PPA Repository on Debian

To list the installed PPA repository in your Debian system, run the below-written command and as an output, it will display a list of all installed PPA repositories:

apt policy

You can also use the following command to display the PPA repository list from the apt/sources directory:

sudo grep -rhE ^deb /etc/apt/sources.list*

Another useful way to find the names of installed repositories is by listing the content of /etc/apt/sources.list.d directory:

cd /etc/apt/sources.list.d

Then use the ls command to view the installed repositories on Debian:

ls

Remove PPA Repository from Command Line

To remove any repository, you must know its exact name of it and you can find the repository name from any of the above-mentioned methods.

Now to remove the desired repository, you can use any of the below-mentioned methods:

Method 1

First run the following command to get the root access:

sudo su -

This method to remove PPA repository is by using the “–remove ppa” command along with the name of PPA repository. The syntax to use the command is shown below:

add-apt-repository --remove ppa:<ppa_repository name>

For example:

add-apt-repository --remove ppa:jonathonf/nimlang

Method 2

Another method to remove PPA repository from the command line on Debian is by using the below-written rm command that manually removes the PPA repository from the /etc/apt/sources.list.d location on Debian, where usually all the PPA repositories are present:

rm /etc/apt/sources.list.d/<ppa_list_file>

But to run the above command, it is mandatory to use the exact name of the PPA repository, so for that, you can list the names of PPA repositories by using the below-mentioned command:

ls /etc/apt/sources.list.d/

After that, you can remove any PPA repository from the following command:

sudo rm /etc/apt/sources.list.d/jonathonf-ubuntu-ffmpeg-4-lunar.list

And to verify, that the repository has been removed, run the below-mentioned list command again, and you will see that the desired repository is being removed:

ls /etc/apt/sources.list.d/

Conclusion

PPA repositories allow Debian users to install packages that are not present in the official system repository. However, if a repository is causing trouble in updating the packages, it’s better to remove it using either “add-apt-repository –remove” command or through the “rm” command along with the name of the PPA file.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.