179

I would like to run the reverse of this command to remove the non-compatible repository in Debian 8.1

sudo add-apt-repository -y ppa:nemh/systemback

where the command add-apt-repository is in the package software-properties-common. I could not find the systemback entry in /etc/apt/sources.list.

How can you run the reverse of the command?

1 Answers1

282

To remove a repository, you have to do two things:

  • Remove it from sources.list.

    If it was added by add-apt-repository then you will find it in its own file in /etc/apt/sources.list.d, not in the main sources.list.

     sudo rm /etc/apt/sources.list.d/nemh-systemback-precise.list
    
  • Optional: Stop trusting the key

    Use apt-key list to list trusted keys. Look for an entry like "Launchpad PPA for Kendek" in this case. Then use apt-key del to delete it:

     sudo apt-key del 73C62A1B
    

As mentioned in the comments by @SeF, you can use the following command:

sudo add-apt-repository -r <the repo you want to remove>
Celada
  • 44,132
  • 22
    Note: the short key id is no longer shown when you use the apt-key list command, but it is actually the last 8 characters of the long key that is shown. – Mike Nakis Apr 06 '19 at 10:04
  • 108
    The command is sudo add-apt-repository -r <the repo you want to remove>. – SeF Oct 04 '19 at 08:00
  • 10
    I think @SeF you should make your comment an actual answer as that should be the accepted answer to this question. As a comment, albeit with high vote count, it is not given the attention it deserves. – Timo Apr 17 '21 at 19:46
  • 2
    Thanks @Timo, unfortunately no new answers are allowed for this old question. – SeF Apr 18 '21 at 21:02
  • 1
    Oh I see this has been flagged as a duplicate – Timo Apr 20 '21 at 05:20
  • Why does this have 262 likes? It doesn't even work. – Wolfpack'08 Nov 11 '22 at 03:43
  • In Debian, sudo nano /etc/apt/sources.list and delete the entry. The solution mentioned above is non-working in Debian, which is an objectively far superior OS to Ubuntu. – Wolfpack'08 Nov 11 '22 at 03:52