1

I run the Ubuntu 24.04 (pull from docker hub) and try to install some packages.

When I run sudo apt update, it shows the following errors:

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C

Then I try this command:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

or:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 871920D1991BC93C

It show the same error like this:

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

Then try to install gnpug*, but it failed:

# apt install gnupg
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package gnupg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gnupg' has no installation candidate

I already tried many ways by searching on Google, but they did not fix it. Can anyone help on this?


This is the file /etc/apt/sources.list:

root@f3a52a693c74:/etc/apt# cat sources.list
# Ubuntu sources have moved to the /etc/apt/sources.list.d/ubuntu.sources
# file, which uses the deb822 format. Use deb822-formatted .sources files
# to manage package sources in the /etc/apt/sources.list.d/ directory.
# See the sources.list(5) manual page for details.

And this is content of the file /etc/apt/sources.list.d/ubuntu.sources:

## See the sources.list(5) manual page for further settings.
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Ubuntu security updates. Aside from URIs and Suites,

this should mirror your choices in the previous section.

Types: deb URIs: http://security.ubuntu.com/ubuntu/ Suites: noble-security Components: main universe restricted multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Note that i can't install vi or vim. Please help!!!

NotTheDr01ds
  • 22,082

1 Answers1

-1

As APT is unable to find gnupg, your /etc/apt/sources.list configuration file is likely incomplete. Indeed, according to packages.ubuntu.com, gnupg is available for Ubuntu 24.04 through the security repository.

  1. Fix your /etc/apt/sources.list so that the security repository is enabled. See this gist.

  2. Run:

sudo apt update
sudo apt install gnupg
  1. If your package issue are related to official Ubuntu package, this is likely because you did not install gnupg and/or the appropriate keyring packages, in particular ubuntu-keyring.
sudo apt install ubuntu-keyring