由于NO_PUBKEY未找到错误,无法在Ubuntu 18.04.5 LTS上安装NodeJS 14或16



我的目标是安装NodeJS。这是我正在运行的命令:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

由于以下错误而失败:

W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B

全栈跟踪在附录a中可用。

我试图解决这个关键问题,并运行以下命令:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B1FE9FFD0787F8B

结果是由于缺少密钥而未检查一些签名,完整的堆栈跟踪可作为附录b。

然后,当我尝试使用命令sudo apt-get update更新系统时,我得到错误:The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B。完整的堆栈跟踪可在附录c中获得。

如何解决gpg密钥错误,以便安装NodeJS14或更高版本?

<标题>附录A
root@vultr:~# curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
## Installing the NodeSource Node.js 16.x repo...

## Populating apt-get cache...
+ apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:2 https://releases.parity.io/deb release InRelease [1,468 B]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:2 https://releases.parity.io/deb release InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
E: The repository 'https://releases.parity.io/deb release 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.
Error executing the command, exiting
<标题>附录B
Executing: /tmp/apt-key-gpghome.bZCjA8xQN8/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3B1FE9FFD0787F8B
gpg: key FF0812D491B96798: 3 duplicate signatures removed
gpg: key FF0812D491B96798: 8 signatures not checked due to missing keys
gpg: key FF0812D491B96798: "Parity Security Team <security@parity.io>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
附录C

Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:2 https://releases.parity.io/deb release InRelease [1,468 B]
Hit:3 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Err:2 https://releases.parity.io/deb release InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
Hit:4 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
E: The repository 'https://releases.parity.io/deb release 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.

更新1:将-k添加到curl:

root@vultr:~# curl -k -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

它没有改变任何东西:

## Installing the NodeSource Node.js 16.x repo...

## Populating apt-get cache...
+ apt-get update
Get:1 https://releases.parity.io/deb release InRelease [1,468 B]
Hit:2 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Err:1 https://releases.parity.io/deb release InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:4 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Reading package lists... Done
W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
E: The repository 'https://releases.parity.io/deb release 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.
Error executing command, exiting```

显然释放。parity。Io/deb是未签名的。这个答案建议您可以将[trusted=yes]添加到/etc/apt/sources.list,以避免遇到此错误。

我不知道这有多安全。

编辑:

搜索以

开头的行
deb https://releases.parity.io/deb
并将其更改为
deb [trusted=yes] https://releases.parity.io/deb

链接答案中提到的其他选项也值得一试。

更新1:在正确的文件

中添加[trusted=yes]

文件/etc/apt/sources.list.d/parity.list有这样一行:deb [signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb release main。应该修改这一行以使其工作:deb [trusted=yes,signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb release main

可能/usr/share/keyrings/的GPG密匙环已经损坏-这就是为什么没有密钥匹配了。您可以创建一个新的密匙环,并开始用apt-key --keyring添加密钥。

也许可以尝试通过端口:80请求(不知道为什么会这样):

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3B1FE9FFD0787F8B