How to undo sudo add-apt-repository?
Solution 1
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:
- get the keyid from
apt-key list
- delete it via
apt-key del $ID
Solution 2
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/
Solution 3
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.
Sigur
Updated on September 18, 2022Comments
-
Sigur over 1 year
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?
-
Cadoiz over 2 yearsIf somebody is looking for how to do that in (open)SUSE/SLES, you can consider this zypper guide:
zypper removerepo xyz
-
-
Sigur over 11 yearsWhere can I check if it worked? Are there some entries in
source.list
? -
Christopher over 11 years@Sigur Yes! The .list files in /etc/apt/sources.list.d/.
-
Sigur over 11 yearsYour 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 over 11 yearsItem 1 returns
pub 1024R/36FD5529 2010-12-14 uid Launchpad PPA for noobslab
. What is its$ID
? -
sunnysideup over 11 years@Sigur
36FD5529
is the id,1024
is the keylength and the rest is the uid -
Sigur over 11 yearsIt works with
del
instead ofdelete
. -
Mikhail Batcer over 6 yearsStrangely, I'm on 14.04 and there is no -r nor --remove option for me.
-
Andrew about 4 yearsWhy isn't this the accepted answer...
-
Michael about 4 yearsstrange, on 18.04 I had to
sudo apt-get install ppa-purge
-
Michael about 4 yearsalso, i don't know if the ppa-purge succeeded or not because it says nothing about removing anything, but complains about an unrelated ppa not having a release file, after which it says
Warning: apt-get update failed for some reason
-
Konrad Rudolph almost 4 yearsWhy use
grep ^
insteadcat
?