1625

I've added many PPAs using the add-apt-repository command. Is there a simple way to remove these PPAs? I've checked in /etc/apt/sources.list for the appropriate deb lines but they aren't there.

This is on a server system so a command line solution would be great!

Braiam
  • 67,791
  • 32
  • 179
  • 269
David Ashford
  • 17,278
  • 13
    There is a bug on Launchpad (https://bugs.launchpad.net/software-properties/+bug/446216) requesting a --remove argument for the add-apt-repository command. I've submitted a merge request (https://code.launchpad.net/~mac9416/software-properties/add-apt-repo-remove-opt/+merge/30094) to get the feature implemented, but it hasn't yet been accepted. Hopefully you'll have this feature soon though. – crenshaw-dev Jul 29 '10 at 12:42
  • That's great news. It annoyed me a bit that there was no command do undo the adding; a bit like aptitude that only installs! ppa-purge is good but that's not even in the official repos. – David Ashford Jul 30 '10 at 16:55
  • 1
    Related. (In particular, see this answer of mine for getting ppa-purge to work with multarch.) – Eliah Kagan Sep 01 '12 at 14:35
  • 2
    i can advise try to search unnecessary then del(rm -rf) one by one them: grep -i WhatYouWantTosearch /etc/apt/sources.list{,.d/*} – Vladimir Ch Mar 23 '17 at 08:14
  • 3
    With a GUI: sudo synaptic > Configuration > Repositories > PPAs > (select a PPA) > Delete (ot maybe "Remove", not sure of the right translation, I can only check the program options in another language). – Fran Sep 12 '18 at 07:32
  • ls /etc/apt/sources.list{,.d/*} may show lists you missed, as Vladimir Ch pointed out – Pau Coma Ramirez Dec 05 '20 at 12:32

27 Answers27

2031

There are a number of options:

  1. Use the --remove flag, similar to how the PPA was added:

    sudo add-apt-repository --remove ppa:whatever/ppa
    
  2. You can also remove PPAs by deleting the .list files from /etc/apt/sources.list.d directory.

  3. As a safer alternative, you can install ppa-purge:

    sudo apt-get install ppa-purge
    

    And then remove the PPA, downgrading gracefully packages it provided to packages provided by official repositories:

    sudo ppa-purge ppa:whatever/ppa
    

    Note that this will uninstall packages provided by the PPA, but not those provided by the official repositories. If you want to remove them, you should tell it to apt:

    sudo apt-get purge package_name
    
  4. Last but not least, you can also disable or remove PPAs from the "Software Sources" section in Ubuntu Settings with a few clicks of your mouse (no terminal needed).

Joshua Pinter
  • 537
  • 3
  • 11
Burn0ut
  • 20,540
  • 33
    This will remove the PPA from the repository list but if the package is a newer version of one in the standard repos, you have to manually downgrade the package afterwards. ppa-purge (see other answer) does that for you. – Marcel Stimberg Aug 11 '10 at 14:00
  • 31
    I get add-apt-repository: error: no such option: --remove :-/ – Rafa Feb 18 '13 at 14:12
  • 8
    it should be sudo apt-add-repository --remove ppa:repo_name/subdirectory – MountainX Jun 20 '13 at 23:55
  • 1
    -r would do instead of --remove – thameera Mar 04 '14 at 18:13
  • 8
    Similarly, I get add-apt-repository: error: no such option: --remove and add-apt-repository: error: no such option: -r – virtualxtc Apr 30 '14 at 21:54
  • On one PC I do have a --remove flag, on another (same Mint version distro) I don't have teh remove flag!? – Melroy van den Berg May 12 '14 at 11:03
  • 1
    I just get "Cannot add PPA: 'ppa:whatever/ppa'. Please check that the PPA name or format is correct. ". How to deal with it? – Casper May 14 '14 at 11:42
  • 4
    The answer above should be amended with the information provided below in case the --remove flag doesn't work. Specifically, remove the entry in the /etc/apt/sources.list.d directory – user1816847 Aug 12 '14 at 05:35
  • 1
    I go to /etc/apt/sources.list.d and then run rm ppaName, and it is solve my issue. Thanks. – erhun Mar 31 '15 at 19:15
  • People keep using the accepted answer and in cases where the user did not install or upgrade packages from the Third Party Repository disabling it is enought; but in most cases where people have already installed or updated any packages the instructions followed as their are writen will disable the Repository before being able to rollback the packages resulting in the output of : Could not find package list for PPA. – xangua May 27 '15 at 04:05
  • 1
    why is ppa-purge "safer"? – stragu Jul 06 '15 at 02:31
  • 1
    @chtfn It removes packages only aviable on a PPA and downgrades packages to the aviables in Ubuntu Official repository. http://www.webupd8.org/2009/12/remove-ppa-repositories-via-command.html – xangua Jul 10 '15 at 17:50
  • 1
    @xangua So why does this make it "safer" than simply removing the ppa? What issues could arise after only removing a ppa? No security updates on the packages that come from the PPA? – stragu Jul 12 '15 at 12:17
  • 2
    @chtfn I think that's the problem yeah, they'll become outdated. Depends on the package of course, but it could definitely be a problem. – Mark Jul 31 '15 at 10:48
  • 1
    Please consider removing this answer, updating it or adding a disclaimer in bold that it has become outdated in recent distributions. – anol Sep 10 '16 at 23:37
  • Even if you don't remove it as @anol suggests, add a note to say how to determine which is the best course of action. If it depends on the Ubuntu version, or what the package is, please say so, and tell us how to find out. It seems Ubuntu's package management is more complicated than I thought, and it's making my head spin. – Michael Scheper Sep 14 '16 at 21:25
  • E: Unable to locate package ppa-purge – IgorGanapolsky Nov 27 '16 at 19:37
  • Wil sudo add-apt-repository --remove ppa:whatever/ppa remove only repository or an app too? I don't want to downgrade, just to remove KDE backports-landing so I next time don't update beta KDE. – Hrvoje T Dec 12 '16 at 22:00
  • 2
    @Hrvoje T add-apt-repository does not uninstall the app, it only removes the repo so that future updates will not be retrieved/installed. (As with most commands, you can read the manual page by typing man <command>, in this case: man add-apt-repository.) – ColdCold Dec 22 '16 at 11:13
  • 3
    What do I do if my repo starts with https://instead of ppa:? – Aaron Franke Oct 10 '17 at 18:26
  • Cannot access PPA (https://launchpad.net/api/1.0/~ondrej/+archive/php5) to get PPA information, please check your internet connection. – Akira Yamamoto Jan 10 '18 at 08:36
  • I had to follow https://askubuntu.com/a/628772/132098 to get rid of other PPA traces within my Ubuntu installation. – Abdull Feb 14 '18 at 18:04
  • The --remove option isn't available in Ubuntu 14.04 – Francisco Nov 04 '18 at 16:37
  • @Francisco yes, the option was added in software-properties version 0.76 – jarno Nov 19 '19 at 14:48
  • @AaronFranke you could use my branch of ppa-purge for that. It has several bug fixes and improvements to the ppa-purge available from Universe distribution component. Currently I have not managed to package it or create PPA, but maybe someday there may be one here. At the moment you can find the git repository via the link there. In the repository you can find ppa-purge script that you could copy to /usr/local/bin/ and in the debian subdirectory you can find the bash completion file, too, which makes using the command easier. – jarno Nov 19 '19 at 15:07
  • @AaronFranke or you could copy the script to /usr/local/sbin as ppa-purge has traditionally been installed under sbin, which is logical as it is for administration and requires superuser privileges. – jarno Nov 21 '19 at 12:38
  • For myself, I had a PPA in /etc/apt/sources.list.d/ that no longer existed and so this error was coming up. I had to remove that (actually, replace it with an updated repo for ffmpeg that I needed) and then sudo apt-get update worked just fine. – Joshua Pinter Jun 23 '20 at 15:26
  • I had to include the https:// in front of the ppa to remove it successfully – run_the_race Sep 09 '20 at 21:00
  • It's not clear to me exactly how to specify the repositories to remove. for instance, in /var/lib/apt/lists I have deb.nodesource.com_node%5f12.x_dists_bionic_main_binary-amd64_Packages, how do I translate this into a ppa:x/y? – Michael Oct 24 '20 at 21:42
  • @Michael You can not translate it; It is not a PPA. However, I suppose you could remove the source and remove/downgrade the respective packages by using my improved version of ppa-purge available as PPA here. You can use tab completion to select the repository easily. – jarno Jan 01 '21 at 15:27
318

Simply run apt-add-repository again with the --remove option to remove a PPA added via the command-line. For example:

sudo apt-add-repository --remove ppa:kernel-ppa/ppa

Then update with:

sudo apt-get update
ish
  • 139,926
  • will this remove that PPA permanently? – Chirag Aug 07 '12 at 23:11
  • 1
    Yes, permanently. To use it again, you must add manually as if you were doing it for the first time. – ish Aug 07 '12 at 23:17
  • 6
    For the record, the --remove/-r flag was added in 10.10. Source: http://askubuntu.com/a/18202/41756 – Niels Bom Mar 27 '14 at 16:01
  • 6
    As stated above; I'm running 13.10 and I get add-apt-repository: error: no such option: --remove – virtualxtc Apr 30 '14 at 21:56
  • I get add-apt-repository: error: no such option: --remove – amphibient May 15 '14 at 19:46
  • Why this is not the chosen answer? this worked like a charm for me.. the chosen answer gave me a lot of options that I did not ask for, felt like reading Microsoft Support Page. – Clain Dsilva Oct 06 '15 at 04:39
  • 1
    @ClainDsilva It's because you would be stuck on a locally installed version of any packages you may have installed from the PPA. You should always use ppa-purge. – John Scott Oct 11 '15 at 22:18
  • @ClainDsilva: Didn't work for me. At least the chosen answer mentions ppa-purge, which is what I ended up needing to use. This actually makes it more reliable than a Microsoft support page, because those often don't actually include the correct answer. – Michael Scheper Oct 12 '15 at 23:29
  • @MichaelScheper That was exactly my point, they don't actually include the correct answer – Clain Dsilva Oct 13 '15 at 03:32
  • I think @user76204's answer should be used in conjunction with this one. This is because apt-add-repository --remove ppa:kernel-ppa/ppa doesn't actually get rid of the individual .list files and keyrings that are in /etc/apt/sources.list.d and /etc/apt/trusted.gpg.d – Hee Jin Apr 08 '18 at 17:27
252

Alternately, as ppas are stored in /etc/apt/sources.list.d you can find the one you want to remove by entering:

ls /etc/apt/sources.list.d

Then when you have noted the name of that offending ppa (e.g. myppa.list), you can enter:

sudo rm -i /etc/apt/sources.list.d/myppa.list

Take care with rm (hence why I have used the interactive switch so you can confirm your actions. Then run sudo apt-get update afterwards.

This method merely removes the ppa .list file; it does not remove any other files or sort out any other problems caused by the ppa; for that you could use ppa-purge after you have got your update ability back (I know you mentioned this in your question, but I am adding this point for future readers): see here for more information on ppa-purge.

Also take into account that if you previously added the key of the repo as trusted you should remove it:

# list the trusted keys
sudo apt-key list
# remove the key
sudo apt-key del KEY_ID
  • I delete full content of /etc/apt/sources.list.d/ folder and still have 4 bad entries :/ why started to fail that now... – m3nda Jun 12 '15 at 13:11
  • 2
    Note that when listing keys, they will have lines like pub 2048R/5044912E 2010-02-11. In this case, to delete this key, the KEY_ID is 5044912E. See https://askubuntu.com/a/107189/108037. I mention this because apt-key del silently failed with OK when passed 2048R/5044912E as the key ID. – jamesc Jul 09 '18 at 11:01
  • 3
    On Ubuntu 16 and above, when removing the key, the KEY_ID is the last 8 characters of the second line of the pub. for example you see EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796, in this case KEY_ID is D38B4796 so you do: sudo apt-key del D38B4796 – Emmanuel Jan 29 '20 at 05:41
  • still googling this answer, 6 years later https://askubuntu.com/questions/307/how-can-ppas-be-removed#comment584640_173209 – philshem Feb 03 '20 at 09:18
  • This worked for me when add-apt-repository --remove didn't do anything. – Joshua Pinter Jun 23 '20 at 15:27
  • my added problematic ppas not listed in /etc/apt/sources.list.d – Estatistics Dec 19 '22 at 14:13
130

You can use the

sudo ppa-purge ppa:repository-name/subdirectory

command in a terminal.

You will first need to install ppa-purge to use this command. To do so, use sudo apt-get install ppa-purge or click this button:

Install via the software center
(source: hostmar.co)

Find out more about it here.

Glorfindel
  • 971
  • 3
  • 13
  • 20
kone4040
  • 1,917
  • 6
    This won't work for deleted repositories in which case it fails with "Warning: Could not find package list for PPA: repository-name subdirectory". – Lekensteyn Oct 27 '11 at 09:26
  • It's not available for Ubuntu 11.10, or am I wrong? – math Feb 06 '12 at 17:14
  • 10
    Yo, this didn't work for me, but I love the syntax so much I am voting it up anyway. – Conrad.Dean Mar 03 '12 at 02:45
  • @DaveJarvis it's not installed by default on any system =/. I've edited the answer to include information on how to install it. – Alaa Ali Sep 07 '13 at 08:33
  • This didn't work for me, apparently it didn't disable the ppa and then did not actually downgrade the packages. However, it prints out a list of packages, like package-name/distribution. If you manually disable the ppa, and then run apt-get install , apt-get will then automatically downgrade for you, based on the output, I think that's the same that it is doing internally. – Berdir Jan 09 '15 at 10:37
  • I like how this option even gives you auto-completion. So no need to guess what the syntax is if you have an idea of what the name starts with – smac89 Jun 21 '17 at 14:37
  • @smac89 it is further improved in my PPA of ppa-purge, see here for installation instructions. – jarno Jan 01 '21 at 15:01
  • @Berdir I do not recommend that way, because it marks all packages as manually installed, which makes removing of apps more difficult in the future. See the comment above. – jarno Jan 01 '21 at 15:04
52

The answers to this question will help you.

You can manage PPAs in System > Administration > Software Sources or by removing files in /etc/apt/sources.list.d/.

You can also use a package called ppa-purge.

And, as I commented on the question I linked to above,

There is a bug on Launchpad requesting a --remove argument for the add-apt-repository command. I've submitted a merge request to get the feature implemented, but it hasn't yet been accepted. Hopefully you'll have this feature soon though.

crenshaw-dev
  • 31,762
36

Some people might prefer to add and remove repositories via a GUI. As of Ubuntu 10.10, this requires a bit of extra work. An explanation is available on the wiki. In order to try and have all answers for this question available in one place, I will try and summarize the important details here. Be sure to check the wiki (especially once a new version of Ubuntu is released) to ensure that this process is still valid.

First, you will want to re-enable 'Software Sources' in the System->Administration menu. Right click on the Applications/Places/System menu and click 'Edit Menus'.

Click 'Edit Menus'

This will open a window, scroll down and click on 'Administration'. Check the box next to 'Software Sources' and then click the 'Close' button.

Check the box next to 'Software Sources'

Go to System->Administration and you should see 'Software Sources' in the menu.

'Software Sources' now in menu

In the window that opens, click on the 'Other Software' tab at the top.

'Other Software' tab

You should see all of the repositories that you have added (including the PPAs added via add-apt-repository). You can temporarily disable a repository by unchecking the box next to it. To remove a repository permanently, highlight it and click on the 'Remove' button. When you are done, hit the 'Close' button.

As Marcel Stimberg noted earlier:

This will remove the PPA from the repository list but if the package is a newer version of one in the standard repos, you have to manually downgrade the package afterwards. ppa-purge (see other answer) does that for you.

Hopefully, this will help.

nhandler
  • 2,516
  • You don't need to edit the menu, there's an entry for Software Sources in the Software Center menu. – Jorge Castro Dec 29 '10 at 02:25
  • Thanks. It looks like an issue with gksu on my end caused me to not get presented with the Software Sources when I tried that initially. I'll resolve that issue locally and update the answer. – nhandler Dec 29 '10 at 19:16
27

ppa-purge is your friend. It automatically uninstalls whatever you installed via the ppa and then removes the ppa.

Install ppa-purge via:

sudo apt-get install ppa-purge

and the use it like this:

sudo ppa-purge ppa-url

Viola.

Dave
  • 3,647
25

Since Ubuntu Maverick (10.10) add-apt-repository accepts a -r or --remove parameter which removes the PPA in the same way you installed it. :)

So:

Install: sudo apt-add-repository ppa:user/repository

Uninstall: sudo apt-add-repository -r ppa:user/repository

  • 2
    Thanks! I used sudo apt-add-repository -r ppa:user/repository to uninstall a stubborn ppa from New Linux Counter Project. I have tried a lot of command lines and suggestions but none of them was of any help, only yours worked! Thanks! One info: it works in 12.04 LTS too, not only in Maverick. – Cristiana Nicolae Feb 10 '14 at 08:20
  • You're welcome, @CristianaNicolae! I've updated my answer based on your advice, thank you! :) – Paulo Freitas Feb 14 '14 at 11:33
  • I'm running 13.10 and I get add-apt-repository: error: no such option: -r – virtualxtc Jul 31 '14 at 07:33
  • 1
    @virtualxtc I'm currently running Ubuntu 14.04 and it still has options -r and --remove on apt-add-repository command. Thus I think you're using a modified or outdated version of apt-add-repository. This utility is provided by the python-software-properties package, maybe you're using a locked version of it. You can check its source code here: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/trusty/software-properties/trusty/files Those removing options was introduced on revision 47, on late 2010. So they exist since 10.10 and never get changed, as you can see in the source. – Paulo Freitas Jul 31 '14 at 13:03
  • There are a couple other users reporting the same issue, so this lock must be a fairly common thing. Stranger still is that the -r --remove flag options are listed in the man / help files, but still produce the stated error. I'll take a look at my python-software-properties next time I'm in Ubuntu. – virtualxtc Aug 01 '14 at 07:29
20

Run Ubuntu Software Center and from the menu choose "Software Sources" - there you can add/edit/remove repositories.

mrówa
  • 534
14

Run these commands:

sudo add-apt-repository --remove ppa:kernel-ppa/ppa 
sudo apt-get update
krizna
  • 159
11

Depending if add-apt-repository was invoked with a full sources.list line or a ppa it appends the line to /etc/apt/sources.list or a new file in the /etc/apt/sources.list.d/ directory. If it's a ppa it will then import the ppa GPG key into apt's keyring

To reverse the actions done by add-apt-repository you can either manually remove the apt line or use a tool like "Software Sources" to do it and then remove the GPG key using apt-key like so:

"sudo apt-key list" to find out the id for the repository you want to remove and then
"sudo apt-key del id" where is looks like 7FAC5991. The id is the part after the "/" character.

Li Lo
  • 15,894
11

Using add-apt-repository

Note: This solution does not remove/downgrade packages associated with the repository.

The add-apt-repository command has an option to remove a repository, which is specified with -r. You just need to know the PPA you want to send on its way. Use the command below:

sudo add-apt-repository -r ppa:REPOSITORY/HERE

... changing "PPA/HERE" to the PPA you are removing.

Source: HOW TO USE A LAUNCHPAD PPA (ADD, REMOVE, PURGE, DISABLE) IN UBUNTU


Using ppa-purge

Note: This solution will purge PPA, & downgrade all packages from it.

To install use:

sudo apt install ppa-purge

To use ppa-purge you'd do:

sudo ppa-purge ppa:REPOSITORY/HERE

... changing "REPOSITORY/HERE" to the repository you are removing.

Source: REMOVE OR PURGE PPA REPOSITORIES VIA COMMAND LINE [QUICK UBUNTU TIP]


Using Software&Updates

Note: This solution does not remove/downgrade packages associated with the repository.

Search "Software & Updates" (or software-properties-gtk) & launch it then choose tab -> "Other Software". To remove a repository, uncheck it, then click "Close", & lastly "Refresh".

enter image description here

N0rbert
  • 99,918
10

If you are talking about the actual applications installed via a PPA, they will be listed just as any other application and you would uninstall it the same way. The PPAs (repositories) themselves will be listed under the 'Other Software' tab of the Settings->Repositories menu. They can be removed just like any other source.

Screenshot of Synaptic Repository/PPA screen

8

You can use y-ppa-manager

Installation :

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager

Use :

Open Y PPA Manager and select Manage PPAs

enter image description here

Select the PPA you want to remove and click the Remove button

enter image description here

mxdsp
  • 3,818
7

You can manage your repositories in System > Administration > Software Sources

You can also remove them in /etc/apt/sources.list.d/ where you'll find a <repo>-ppa-<distro>.list file You can remove that file or simply comment out the deb line

Marco Ceppi
  • 48,101
7

In Linux Mint there is no --remove or -r switch on add-apt-repository. If you want to remove a repository, you'll have to do it manually. It's not hard:

  1. List all installed repositories.

    ls /etc/apt/sources.list.d
    

    This lists, for example:

    getdeb.list  natecarlson-maven3-trusty.list  official-package-repositories.list
    
  2. Find the name of the repository you want to remove.
    In my case I want to remove natecarlson-maven3-trusty.list.

  3. Remove the repository.

    sudo rm -i /etc/apt/sources.list.d/natecarlson-maven3-trusty.list
    
  4. List all the GPG keys.

    apt-key list
    

    This lists, for example:

    /etc/apt/trusted.gpg
    --------------------
    pub   1024D/437D05B5 2004-09-12
    uid                  Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>
    sub   2048g/79164387 2004-09-12
    
    pub   1024D/FBB75451 2004-12-30
    uid                  Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>
    
    pub   4096R/46D7E7CF 2009-05-15
    uid                  GetDeb Archive Automatic Signing Key <archive@getdeb.net>
    
    pub   1024R/3DD9F856 2011-04-15
    uid                  Launchpad PPA for Nate Carlson
    
  5. Find the key ID for the key you want to remove. The key ID is the part after the /.
    In my case I want to remove the Nate Carlson key, so the ID is 3DD9F856.

  6. Remove the key.

    sudo apt-key del 3DD9F856
    
  7. Update the package lists.

    sudo apt-get update
    

Done!

6

There's a command, add-apt-repository -r.

But deleting the file and re-running sudo apt-get update is also fine.

6

Apart from the solution mentioned already: If you still have software installed from that repository, it is best to revert them to the original version supplied with ubuntu: the one from the ppa will not get (security and other) updates anymore. There is a tool that will do just that: ppa-purge https://packages.ubuntu.com/search?keywords=ppa-purge

johanvdw
  • 1,001
6

It depends. If you've installed a new application from a ppa, then you can uninstall it normally. However, if you've enabled a ppa to get a newer version of a program that you've alredy installed (Firefox 4,newer Xorg drivers,etc), then you need to use a program called ppa-purge.

Ppa-purge is available in the repositories for Maverick and newer. A backport is available for Lucid users. Just install it and then run

sudo ppa-purge ppa:repository-name/directory

The above command will disable the ppa from your software sources and then reinstall the official version of the upgraded application from the Ubuntu repository.

papukaija
  • 2,425
5

You can try those command below and it works very well for me to remove Linux kernel 3.5 (ppa:xorg-edgers/ppa).

sudo apt-get install ppa-purge
sudo ppa-purge ppa:<XXX>/<YYY>
Enze Chi
  • 533
5

OMG!Ubuntu! mentioned that this feature had been added to the 'Tweak' PPA.

Presumably once it's in universe, you'll be able to use it to remove itself :)

Matt
  • 649
5

You can use Ubuntu-Tweak, which makes it very easy to edit ppa. You can delete the ppa's manually or when Ubuntu-Tweak know it just click a button.

Geelu
  • 329
5

Most simple way to delete all of your PPA'a is this:

cd /etc/apt/sources.list.d && sudo rm -i *list*

It will first take you to the directory which contains sources.list.d and then rm (remove) basically all files with word list in their name.

Igor V.
  • 948
4

add-apt-repository now accepts a --remove argument.

https://bugs.edge.launchpad.net/ubuntu/+bug/446216

I proposed adding a rm-apt-repository command as well:

https://code.edge.launchpad.net/~bryceharrington/software-properties/rm-apt-repository/+merge/25988
Bryce
  • 4,710
3

All these answers are fine, but to me the easiest way is still to remove them directly using rm -rf.

Imagine that apt update gives you the following error:

W: Failed to fetch http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists/trusty/main/binary-amd64/Packages  403  Forbidden

Then you can fix it doing something like :

sudo rm -rf /etc/apt/sources.list.d/andrej*
glemiere
  • 346
  • Almost identical to RonJohn's answer but I noticed you don't feel running sudo apt update afterwards is necessary? – WinEunuuchs2Unix Apr 13 '18 at 02:52
  • 1
    It is yes. My example didn’t directly said it, but if your apt update fails showing the error above, then removing the source files will make it work again. So it didn’t feel necessary to specify it in this context ;) I get the confusion though. I will edit, thanks for your comment! – glemiere Apr 13 '18 at 02:58
  • @glemiere some are not from launchpad, eg Err:12 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/3.4 Release, the rm command is still the same? – Dan D. Oct 27 '22 at 08:18
2

Create this function (add it to wherever you store your functions) and then run with the appropriate ppa name:

rmppa()
{
    sudo -- sh -c 'rm /etc/apt/sources.list.d/"$1".list ; apt-get update'
}

rmppa snagglepuss

Add error checking (non-existent parameter, for example) if you desire...

RonJohn
  • 679
0

You can go into directory /etc/apt/sources.list.d and delete the related entries eg.

(note that 2 entries exist for the same entry)

  • sudo trash yann1ck-ubuntu-onedrive-bullseye.list
  • sudo trash yann1ck-ubuntu-onedrive-bullseye.list.save