Bobcares

How to Delete Repository And GPG Key In Ubuntu

by | Apr 4, 2021

Wondering how to delete Repository And GPG Key In Ubuntu? We can help you.

Ubuntu has four official repositories namely Main, Universe, Restricted, and Multiverse. A repository (repo) is a central place where the developers keep the software packages.

Using the repository keys, we can ensure that we are getting the packages from the right person. However, sometimes we would like to delete a repository along with its GPG key when it’s no longer necessary in our ubuntu systems.

Here at Bobcares, we handle Ubuntu servers of our customers as a part of our Server Management Services.

Today let’s see how our Support Engineers delete the repository and GPG key in Ubuntu.

How to delete repository and GPG key in Ubuntu – Steps to follow

We will see the steps that our Support Engineers follow for deleting the repository and key in Ubuntu.

Deleting a repository in Ubuntu

When we add a repository using ‘add-apt-repository’ command, it will be stored in /etc/apt/sources.list file.

For deleting a software repository from Ubuntu and its derivatives we do the following:

First, open the /etc/apt/sources.list file and look for the repository entry.

We can do this using the following command:

$ sudo nano /etc/apt/sources.list

And simply remove the entry to delete the repository.

After that, we can save and close the file.

However, if we have added PPA repositories, we must look into /etc/apt/sources.list.d/ directory and delete the respective entry.

Alternatively, we can delete the repository using ‘add-apt-repository’ command.

For example, we can delete the Systemback repository using the following command:

$ sudo add-apt-repository -r ppa:nemh/systemback

Finally, update the software sources list using the following command:

$ sudo apt update

Listing Repository keys

‘apt-key’ is used to manage the list of keys used by ‘apt’ to authenticate packages.

Following are the paths where trusted keys are found:

/etc/apt/trusted.gpg – Keyring of local trusted keys; new keys will be added here.
/etc/apt/trusted.gpg.d/ – File fragments for the trusted keys; additional keyrings can be stored here.

We can use the following command to list trusted keys with fingerprints:

$ sudo apt-key list

/etc/apt/trusted.gpg
--------------------
pub rsa4096 2017-12-15 [SCEA]
0A0F AB86 0D48 5603 32EF B581 B754 42BB DE9E 3B09
uid [ unknown] https://packagecloud.io/AtomEditor/atom (https://packagecloud.io/docs#gpg_signing) support@packagecloud.io
sub rsa4096 2017-12-15 [SEA]

pub rsa4096 2016-04-22 [SC]
B9F8 D658 297A F3EF C18D 5CDF A2F6 83C5 2980 AECF
uid [ unknown] Oracle Corporation (VirtualBox archive signing key) info@virtualbox.org
sub rsa4096 2016-04-22 [E]

pub dsa1024 2007-03-08 [SC]
4CCA 1EAF 950C EE4A B839 76DC A040 830F 7FAC 5991
uid [ unknown] Google, Inc. Linux Package Signing Key linux-packages-keymaster@google.com
sub elg2048 2007-03-08 [E]

pub rsa4096 2016-04-12 [SC]
EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796
uid [ unknown] Google Inc. (Linux Packages Signing Authority) linux-packages-keymaster@google.com
sub rsa4096 2019-07-22 [S] [expires: 2022-07-21]

/etc/apt/trusted.gpg.d/numix_ubuntu_ppa.gpg
-------------------------------------------
pub rsa1024 2013-08-13 [SC]
43E0 7612 1739 DEE5 FB96 BBED 52B7 0972 0F16 4EEB
uid [ unknown] Launchpad PPA for Numix Maintainers

/etc/apt/trusted.gpg.d/snwh_ubuntu_ppa.gpg
------------------------------------------
pub rsa1024 2012-06-27 [SC]
D320 D0C3 0B02 E64C 5B2B B274 3766 2239 8999 3A70
uid [ unknown] Launchpad PPA for Sam Hewitt

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
790B C727 7767 219C 42C8 6F93 3B4F E6AC C0B2 1F32
uid [ unknown] Ubuntu Archive Automatic Signing Key (2012) ftpmaster@ubuntu.com

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092
uid [ unknown] Ubuntu CD Image Automatic Signing Key (2012) cdimage@ubuntu.com

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub rsa4096 2018-09-17 [SC]
F6EC B376 2474 EDA9 D21B 7022 8719 20D1 991B C93C
uid [ unknown] Ubuntu Archive Automatic Signing Key (2018) ftpmaster@ubuntu.com

Delete repository keys in Ubuntu

We use “apt-key” command to add the repository keys.

First, we will list the added keys using the following command:

$ sudo apt-key list

This command will list all added repository keys.

/etc/apt/trusted.gpg
--------------------
pub rsa1024 2010-10-31 [SC]
3820 03C2 C8B7 B4AB 813E 915B 14E4 9429 73C6 2A1B
uid [ unknown] Launchpad PPA for Kendek

pub rsa4096 2016-04-22 [SC]
B9F8 D658 297A F3EF C18D 5CDF A2F6 83C5 2980 AECF
uid [ unknown] Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>
sub rsa4096 2016-04-22 [E]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
790B C727 7767 219C 42C8 6F93 3B4F E6AC C0B2 1F32
uid [ unknown] Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092
uid [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub rsa4096 2018-09-17 [SC]
F6EC B376 2474 EDA9 D21B 7022 8719 20D1 991B C93C
uid [ unknown] Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>

From the above output, the long (40 characters) hex value is the repository key.

If we want the APT package manager to stop trusting the key we can delete it using the following command:

$ sudo apt-key del "3820 03C2 C8B7 B4AB 813E 915B 14E4 9429 73C6 2A1B"

Or, we can alternatively specify the last 8 characters:

$ sudo apt-key del 73C62A1B

Finally, we can run the following command to update the repository lists:

$ sudo apt update

[Need Assistance? We are happy to help you!]

Conclusion

In short, we saw the steps that our Support Engineers follow to delete repository and GPG Key In Ubuntu.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Thug

    Thank you, after spending several hours trying to fix my issue, I landed on your page from google and solved it! I took the time to let you know, Thank You Bob, hope you receive this:)

    Reply
    • Hiba Razak

      Thanks for the feedback.We are glad to know that it worked for you ? .

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF