69

I ran

sudo add-apt-repository ppa:noobslab/indicators

to install my-weather-indicator but it requires GTK3 and I don't want to proceed further.

So I'd like to undo that command. I've checked my /etc/apt/source.list but I didn't find any line related to it.

What should I do now?

1
  • If somebody is looking for how to do that in (open)SUSE/SLES, you can consider this zypper guide: zypper removerepo xyz
    – Cadoiz
    Commented Nov 30, 2021 at 12:47

3 Answers 3

90

From Ubuntu's manual pages (man add-apt-repository):

-r, --remove Remove the specified repository

So...

sudo add-apt-repository -r ppa:noobslab/indicators

This removes it from the repo list in /etc/apt/sources.list.d/.

Depending on what you are doing, BEFORE you run the above command - If an installed package from that repo is newer than the same package in a standard repo, then manually downgrade with ppa-purge:

sudo ppa-purge ppa:noobslab/indicators

For Debian, just delete the .list file in /etc/apt/sources.list.d/

8
  • Where can I check if it worked? Are there some entries in source.list?
    – Sigur
    Commented Jan 8, 2013 at 0:34
  • 2
    @Sigur Yes! The .list files in /etc/apt/sources.list.d/. Commented Jan 8, 2013 at 0:37
  • Your first suggestion returns You are about to add the following PPA to your system:. The second one returns sudo: ppa-purge: command not found. I still have .list in /etc/apt/sources.list.d/
    – Sigur
    Commented Jan 8, 2013 at 0:44
  • 1
    Strangely, I'm on 14.04 and there is no -r nor --remove option for me. Commented Sep 22, 2017 at 7:40
  • 1
    The command: sudo add-apt-repository -r ppa:noobslab/indicators works perfectly. It's also convenient, as I can recall the previous command of adding the repository just add the -r switch after the command, before the repository name.
    – Yu Shen
    Commented Dec 30, 2018 at 0:50
28

add-apt-repository creates a new file in /etc/apt/sources.list.d for ppa repositories. Besides deleting the appropriate file you also should delete the added gpg key:

  1. get the keyid from apt-key list
  2. delete it via apt-key del $ID
4
  • 1
    Item 1 returns pub 1024R/36FD5529 2010-12-14 uid Launchpad PPA for noobslab. What is its $ID?
    – Sigur
    Commented Jan 8, 2013 at 0:46
  • 2
    @Sigur 36FD5529 is the id, 1024 is the keylength and the rest is the uid Commented Jan 8, 2013 at 0:49
  • 1
    It works with del instead of delete.
    – Sigur
    Commented Jan 8, 2013 at 0:52
  • This above answer is non-working in Debian (which is far superior to Ubuntu). In Debian, you need to edit /etc/apt/sources.list with privileges. sudo nano /etc/apt/sources.list and then just delete the entries and press ^x to exit and y to save changes. Commented Nov 11, 2022 at 3:49
4

If you want to undo add-apt-repository, having used a format like e.g.

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

Use the output displayed by the following command to find the repository you want to delete

grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/*

Example output:

/etc/apt/sources.list:#deb cdrom:[Linux Mint 17.3 _Rosa_ - Release amd64 20151128]/ trusty contrib main non-free /etc/apt/sources.list.d/additional-repositories.list:deb [arch=amd64] https://download.docker.com/linux/ubuntu trusty stable ...

In this example /etc/apt/sources.list.d/additional-repositories.list would have the repository to undo/remove. Edit the file and remove its line.

1
  • Why use grep ^ instead cat? Commented Jul 21, 2020 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .