Home > Net >  Unable to install NodeJS 14 or 16 on Ubuntu 18.04.5 LTS due to NO_PUBKEY not found error
Unable to install NodeJS 14 or 16 on Ubuntu 18.04.5 LTS due to NO_PUBKEY not found error

Time:10-25

My objective is to install NodeJS. This is the command I am running:

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

It fails because of the following error:

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

Full stack trace is available appendix A.

I tried to resolve this key issue and ran following commands:

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

The result is some signatures not checked due to missing keys, full stack trace is available as Appendix B.

Then, when I try to update my system with the command, sudo apt-get update, I get the error: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B. Full stack trace is available as Appendix C.

How do I resolve gpg key error in order to install NodeJS14 or higher?

Appendix 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

Appendix 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 <[email protected]>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

Appendix 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.

Update 1: Adding -k to curl:

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

It did not change anything:

## 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```

CodePudding user response:

Apparently releases.parity.io/deb is unsigned or something. This answer suggests that you can add [trusted=yes] to /etc/apt/sources.list in order to avoid facing this error.

I couldn't advise on how secure that is.

EDIT:

Search for the line that starts with

deb https://releases.parity.io/deb

and change it to

deb [trusted=yes] https://releases.parity.io/deb

There are other alternatives mentioned in the linked answer that might also be worth checking out.

Update 1: adding [trusted=yes] in the correct file

The file /etc/apt/sources.list.d/parity.list has the line: deb [signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb release main. This line should be modified to make it work: deb [trusted=yes,signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb release main

CodePudding user response:

Likely a GPG keyring at /usr/share/keyrings/ had been corrupted - that's why no key matches anymore. You could create a new keyring and start adding back the keys with apt-key --keyring.

Maybe try requesting through port :80 (no clue why this works):

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