How can PPAs be removed?

  • 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!

    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.

    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.

    Related. (In particular, see this answer of mine for getting `ppa-purge` to work with multarch.)

    i can advise try to search unnecessary then del(rm -rf) one by one them: grep -i WhatYouWantTosearch /etc/apt/sources.list{,.d/*}

    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).

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

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

    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
    

    You can also remove PPAs by deleting the .list files from /etc/apt/sources.list.d directory.

    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).

    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.

    I get `add-apt-repository: error: no such option: --remove` :-/

    it should be `sudo apt-add-repository --remove ppa:repo_name/subdirectory`

    `-r` would do instead of `--remove`

    Similarly, I get `add-apt-repository: error: no such option: --remove` and `add-apt-repository: error: no such option: -r`

    On one PC I do have a --remove flag, on another (same Mint version distro) I don't have teh remove flag!?

    I just get "Cannot add PPA: 'ppa:whatever/ppa'. Please check that the PPA name or format is correct. ". How to deal with it?

    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

    I go to /etc/apt/sources.list.d and then run rm ppaName, and it is solve my issue. Thanks.

    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.

    why is ppa-purge "safer"?

    @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 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?

    @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.

    Please consider removing this answer, updating it or adding a disclaimer in bold that it has become outdated in recent distributions.

    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.

    **E: Unable to locate package ppa-purge**

    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 `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 `, in this case: `man add-apt-repository`.)

    What do I do if my repo starts with `https://`instead of `ppa:`?

    Cannot access PPA (https://launchpad.net/api/1.0/~ondrej/+archive/php5) to get PPA information, please check your internet connection.

    I had to follow https://askubuntu.com/a/628772/132098 to get rid of other PPA traces within my Ubuntu installation.

    The `--remove` option isn't available in Ubuntu 14.04

    @Francisco yes, the option was added in software-properties version 0.76

    @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.

    @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.

  • 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
    

    will this remove that PPA permanently?

    Yes, permanently. To use it again, you must add manually as if you were doing it for the first time.

    For the record, the --remove/-r flag was added in 10.10. Source: http://askubuntu.com/a/18202/41756

    As stated above; I'm running 13.10 and I get `add-apt-repository: error: no such option: --remove`

    I get `add-apt-repository: error: no such option: --remove`

    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.

    @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.

    @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.

    @MichaelScheper That was exactly my point, they don't actually include the correct answer

    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

  • 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
    

    This worked for me, while the accepted answer did not.

    I delete full content of /etc/apt/sources.list.d/ folder and still have 4 bad entries :/ why started to fail that now...

    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.

    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`

  • 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

    Find out more about it here.

    This won't work for deleted repositories in which case it fails with "Warning: Could not find package list for PPA: repository-name subdirectory".

    It's not available for Ubuntu 11.10, or am I wrong?

    Yo, this didn't work for me, but I love the syntax so much I am voting it up anyway.

    @DaveJarvis it's not installed by default on any system =/. I've edited the answer to include information on how to install it.

    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.

    Finally! The answer that worked for me! I hope it gets upvoted to more prominence soon.

    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

  • 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.

    I found it in `Ubuntu Software Center > Edit > Software Sources`.

    The "ppa-purge" link doesn't work. It gives a 404 error.

    FYI in Ubuntu 16.04 the way to find the PPA list is `System Settings -> System -> Software & Updates -> Other Software`

  • 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.

    You don't need to edit the menu, there's an entry for Software Sources in the Software Center menu.

    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.

    More easy and reliable

  • 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.

    The OP did already try ppa-purge.

  • 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

    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.

    You're welcome, @CristianaNicolae! I've updated my answer based on your advice, thank you! :)

    I'm running 13.10 and I get add-apt-repository: error: no such option: -r

    @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.

    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.

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

  • Run these commands:

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

    As stated above; I'm running 13.10 and I get `add-apt-repository: error: no such option: --remove`

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM