【问题标题】:Unable to install NodeJS 14 or 16 on Ubuntu 18.04.5 LTS due to NO_PUBKEY not found error由于 NO_PUBKEY not found 错误,无法在 Ubuntu 18.04.5 LTS 上安装 NodeJS 14 或 16
【发布时间】:2021-10-24 22:23:56
【问题描述】:

我的目标是安装 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```

【问题讨论】:

  • @php_nub_qq,谢谢,是的,我做了并更新了答案。
  • 我没看懂,你能通过查看我的Update 1来验证我们是否在同一页面上吗?

标签: node.js linux ubuntu


【解决方案1】:

显然releases.parity.io/deb 是无符号的。 This 回答建议您可以将[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

【讨论】:

  • 那么,我要在文件中添加什么?你能帮我看看语法吗?
  • @AviralSrivastava 它在链接的答案中进行了解释,但我也在这里添加了它。
  • 是的,但链接的答案在同一行中还有两个条目,jessemain。我不知道在我的文件中输入什么,如果我不添加任何内容,则会导致语法错误。
  • @AviralSrivastava 你应该已经有了这一行,你不需要添加一个新的条目,只需寻找它。
  • 我不认为完全跳过包签名是答案......这就像接受系统从根本上被破坏......并假装什么都没发生过。
【解决方案2】:

/usr/share/keyrings/ 的 GPG 密钥环可能已损坏 - 这就是不再匹配密钥的原因。您可以创建一个新的密钥环并开始使用 apt-key --keyring 添加回密钥。

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

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

【讨论】:

    猜你喜欢
    • 2017-07-27
    • 2020-04-30
    • 1970-01-01
    • 1970-01-01
    • 2017-11-17
    • 1970-01-01
    • 1970-01-01
    • 2015-01-28
    • 2021-08-18
    相关资源
    最近更新 更多