How to Remove Repositories in Ubuntu

Learn how to remove a repository that fails doing apt update, using the terminal in Ubuntu.

1755 views
d

By. Jacob

Edited: 2020-01-19 19:09

A user-added repository that keeps failing doing an apt update can be a very frustrating problem, luckily we can quickly resolve the issue by removing the offending repository.

When adding a repository, the sudo add-apt-repository -r ppa:user/some-repo-name, if we want to remove it again, we should simply call the same command with the --remove option:

sudo add-apt-repository --remove ppa:user/name-of-ppa

If you do not remember which PPA to remove, you can instead attempt a manual removal.

Manually removing a repository

Sometimes you might need to open the sources.list file and comment out, or remove, the offending lines. This can be done using nano in a terminal:

sudo nano /etc/apt/sources.list

Other times you might need to delete the repository in the sources.list.d directory:

sudo rm /etc/apt/sources.list.d/name-of-repo.*

This directory holds sources that are auto-loaded when running an apt update. The directory contains files ending in .save and .list, and both should be removed in order to fix the issue.

Links

  1. Repositories/Ubuntu - help.ubuntu.com

Tell us what you think:

  1. Generate a GPG key that can be used with KWallet.
  2. How to extract and install FileZilla from tar.bz2 in Ubuntu.
  3. About the problem with using sudo with graphical programs in Linux.
  4. Tutorial showing how to configure a VirtualBox Guest VM with HOST-only and NAT adapter, while using the WWW folder from the HOST OS.
  5. My experience with do-release-upgrade is that it rarely breaks anything, so I would say it is generally a safe and reliable way to upgrade Ubuntu.

More in: Ubuntu