2

Ubuntu 22.04.4

What is the proper procedure to remove a gpg key from /usr/share/keyrings?

Recently I had need to add repo "http://repos.azulsystems.com/ubuntu stable main" for which I used gpg instead apt-key to add the repo's public key.

I'm not really sure how to get rid of the key now that I'm done..???

I added the public key as:

$ sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/zulu11jre.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
gpg: keybox '/usr/share/keyrings/zulu11jre.gpg' created
gpg: /tmp/trustdb.gpg: trustdb created
gpg: key B1998361219BD9C9: public key "Azul Systems, Inc. (Package signing key.) <pki-signing@azulsystems.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

I saw the key added to /usr/share/keyrings as expected and continued on with my work. I added the needed repo to a .list file inside my sourced.list.d as:

sudo echo "deb [arch=amd64 signed-by=/usr/share/keyrings/zulu11jre.gpg] http://repos.azulsystems.com/ubuntu stable main" | sudo tee /etc/apt/sources.list.d/zulu11jre.list > /dev/null

I installed the package I needed and finished what I was doing.... Now that I'm done I've removed the package I needed and deleted the .list file from my sources.list.d directory...

I am now curious about what my proper procedure should be for disposing of this gpg key file in /usr/share/keyrings....?

I am not very familiar with using gpg instead of apt-key. Do I just delete this /usr/share/keyrings/zulu11jre.gpg file or is there something more that is needed?

The thing I really found curious about this /usr/share/keyrings/zulu11jre.gpg key is that I do not see it anywhere other than in the directory...

It does not show in apt-key list which makes sense, I think...

gpg --list-keys results nothing however, which I really do not understand since there many Ubuntu key files listed in /usr/share/keyrings.

Why do no keys list when I run gpg --list-keys? How do I properly dispose of gpg keys added using gpg instead of apt-key? Is there a good write-up somewhere other than the man page that will help me better understand gpg as far as adding repos?

Thank you

0 Answers0