Score:1

How do I get rid of virtualbox so it isn't stopping me from updating via GPG error [...] NO_PUBKEY [...]?

lt flag

I've found tons of guides on how to fix the NO_PUBKEY issue, but what I really want is to get rid of VirtualBox because I never got it working and don't need it yet. So I tried to get rid of it via a guide. Here's the full terminal log:

username@username-System-Product-Name:~$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 https://repo.steampowered.com/steam stable InRelease                                                        
Get:3 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]                                        
Hit:4 https://repo.nordvpn.com//deb/nordvpn/debian stable InRelease                                               
Get:5 https://download.virtualbox.org/virtualbox/debian jammy InRelease [4,428 B]                                 
Hit:6 http://security.ubuntu.com/ubuntu jammy-security InRelease                            
Get:7 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Err:5 https://download.virtualbox.org/virtualbox/debian jammy InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
Reading package lists... Done       
W: GPG error: https://download.virtualbox.org/virtualbox/debian jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
E: The repository 'https://download.virtualbox.org/virtualbox/debian jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
username@username-System-Product-Name:~$ sudo apt-get purge virtualbox
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'virtualbox' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.

Okay, how about another guide?:

username@username-System-Product-Name:~$ sudo apt-get purge virtualbox*
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'virtualbox-ext-pack' for glob 'virtualbox*'
Note, selecting 'virtualbox' for glob 'virtualbox*'
Note, selecting 'virtualbox-guest-x11' for glob 'virtualbox*'
Note, selecting 'virtualbox-ose' for glob 'virtualbox*'
Note, selecting 'virtualbox-ose-fuse' for glob 'virtualbox*'
Note, selecting 'virtualbox-guest-additions-iso' for glob 'virtualbox*'
Note, selecting 'virtualbox-guest-modules' for glob 'virtualbox*'
Note, selecting 'virtualbox-guest-utils' for glob 'virtualbox*'
Note, selecting 'virtualbox-guest-utils-hwe' for glob 'virtualbox*'
Note, selecting 'virtualbox-guest-x11-hwe' for glob 'virtualbox*'
Note, selecting 'virtualbox-modules' for glob 'virtualbox*'
Note, selecting 'virtualbox-qt' for glob 'virtualbox*'
Note, selecting 'virtualbox-2.0' for glob 'virtualbox*'
Note, selecting 'virtualbox-2.1' for glob 'virtualbox*'
Note, selecting 'virtualbox-2.2' for glob 'virtualbox*'
Note, selecting 'virtualbox-3.0' for glob 'virtualbox*'
Note, selecting 'virtualbox-3.1' for glob 'virtualbox*'
Note, selecting 'virtualbox-3.2' for glob 'virtualbox*'
Note, selecting 'virtualbox-4.0' for glob 'virtualbox*'
Note, selecting 'virtualbox-4.1' for glob 'virtualbox*'
Note, selecting 'virtualbox-4.2' for glob 'virtualbox*'
Note, selecting 'virtualbox-4.3' for glob 'virtualbox*'
Note, selecting 'virtualbox-5.0' for glob 'virtualbox*'
Note, selecting 'virtualbox-5.1' for glob 'virtualbox*'
Note, selecting 'virtualbox-5.2' for glob 'virtualbox*'
Note, selecting 'virtualbox-6.0' for glob 'virtualbox*'
Note, selecting 'virtualbox-6.1' for glob 'virtualbox*'
Note, selecting 'virtualbox-source' for glob 'virtualbox*'
Note, selecting 'virtualbox-dkms' for glob 'virtualbox*'
Package 'virtualbox-ose' is not installed, so not removed
Package 'virtualbox-ose-fuse' is not installed, so not removed
Package 'virtualbox-6.1' is not installed, so not removed
Package 'virtualbox-6.0' is not installed, so not removed
Package 'virtualbox-5.2' is not installed, so not removed
Package 'virtualbox-5.1' is not installed, so not removed
Package 'virtualbox-5.0' is not installed, so not removed
Note, selecting 'virtualbox-dkms' instead of 'virtualbox-modules'
Package 'virtualbox-2.0' is not installed, so not removed
Package 'virtualbox-2.1' is not installed, so not removed
Package 'virtualbox-2.2' is not installed, so not removed
Package 'virtualbox-3.0' is not installed, so not removed
Package 'virtualbox-3.1' is not installed, so not removed
Package 'virtualbox-3.2' is not installed, so not removed
Package 'virtualbox-4.0' is not installed, so not removed
Package 'virtualbox-4.1' is not installed, so not removed
Package 'virtualbox-4.2' is not installed, so not removed
Package 'virtualbox-4.3' is not installed, so not removed
Package 'virtualbox' is not installed, so not removed
Package 'virtualbox-dkms' is not installed, so not removed
Package 'virtualbox-ext-pack' is not installed, so not removed
Package 'virtualbox-guest-additions-iso' is not installed, so not removed
Package 'virtualbox-guest-utils' is not installed, so not removed
Package 'virtualbox-guest-utils-hwe' is not installed, so not removed
Package 'virtualbox-guest-x11' is not installed, so not removed
Package 'virtualbox-guest-x11-hwe' is not installed, so not removed
Package 'virtualbox-qt' is not installed, so not removed
Package 'virtualbox-source' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.

That doesn't look like it did anything... but let's try updating again just in case:

username@username-System-Product-Name:~$ sudo apt update
Hit:1 https://repo.nordvpn.com//deb/nordvpn/debian stable InRelease
Hit:2 https://repo.steampowered.com/steam stable InRelease  
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:4 https://download.virtualbox.org/virtualbox/debian jammy InRelease [4,428 B]              
Err:4 https://download.virtualbox.org/virtualbox/debian jammy InRelease                        
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
Hit:5 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Reading package lists... Done      
W: GPG error: https://download.virtualbox.org/virtualbox/debian jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
E: The repository 'https://download.virtualbox.org/virtualbox/debian jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Score:2
cn flag

You can easily remove the VirtualBox repository. Either using Software & Updates GUI, or by running

sudo rm /etc/apt/sources.list.d/virtualbox*

This command will work if you installed VB from a deb file. If you manually added the source, you need to find where the source is located, e.g. /etc/apt/sources.list.

DiogenesOfMiami avatar
lt flag
rm: cannot remove '/etc/apt/sources.list.d/virtualbox*': No such file or directory
Score:1
cn flag

This is not about a package named virtualbox (or virtualbox-6.1 or similar), but about the repository offering those packages.

Packages in a repository can be cryptographically signed. To check these signatures, apt needs the public key associated with the repository. When you set up the repository, you didn't properly configure a public key for it. That's what apt is complaining about:

Err:5 https://download.virtualbox.org/virtualbox/debian jammy InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
(...)
W: GPG error: https://download.virtualbox.org/virtualbox/debian jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
E: The repository 'https://download.virtualbox.org/virtualbox/debian jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

You've got two ways to solve it: If you want to keep using Virtualbox from this repository, you need to supply apt with the public key for the repository. Or you can remove the repository, which is what I understand you want to do.

For this, you need to look through the list of repositories your have configured and remove the corresponding entry. It should be either in /etc/apt/sources.list directly, or in an individual file in /etc/apt/sources.list.d, depending how you added the repository originally.

DiogenesOfMiami avatar
lt flag
Okay that took care of it; I deleted the "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" from the bottom of that sources.list file, and everything is back to the way it was. Thank you!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.