distributions: Signatures couldn't be verified - public key - Ubuntu 20.04 Focal

I did see other mentions of this issue, but they seemed to be related to users running an unsupported distro. However, Ubuntu Focal is listed as supported.

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

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


## Populating apt-get cache...

+ apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
- - -
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
- - -
Hit:6 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:7 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done

## Confirming "focal" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_14.x/dists/focal/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
gpg: WARNING: unsafe ownership on homedir '/home/matthew/.local/share/gnupg'

## Creating apt sources list file for the NodeSource Node.js 14.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x focal main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x focal main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Get:1 https://deb.nodesource.com/node_14.x focal InRelease [4,583 B]
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease                                                                                   
- - -
Err:1 https://deb.nodesource.com/node_14.x focal InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1655A0AB68576280
- - -
Hit:5 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease   
- - -
Hit:7 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:8 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
W: GPG error: https://deb.nodesource.com/node_14.x focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1655A0AB68576280
E: The repository 'https://deb.nodesource.com/node_14.x focal 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

Wish Canonical would provide something newer than version 10.x.x… I had a version that was at least as high as 12 yesterday, and after reinstalling everything I’m not sure how I managed that in the past, I don’t recall using nodesource previously, but npm and n were unable to update me to version 14, hoping I have better luck here.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 23 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I “fixed” it by running the following command before the setup:

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

I got this from the manual installation guide.

So in my dockerfile I have it like this now:

RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash - \
    && apt-get install --yes nodejs

I encountered this issue due to using a non-default umask (umask 0027) as required by the CIS benchmark standard. This caused /usr/share/keyrings/nodesource.gpg to be written with 640 permissions instead of 644, so only root could read it. So it should be reproducible by running umask 0027 before curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -. After running chmod a+r /usr/share/keyrings/nodesource.gpg apt-get update completed successfully.

Just faced the same issue on Ubuntu 20.04.

Solved it by doing the following which is mainly based on the comments above:

curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x focal main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x focal main' >> /etc/apt/sources.list.d/nodesource.list
chmod a+r /usr/share/keyrings/nodesource.gpg
apt update
apt install -y nodejs

I also had the error with Ubuntu bionic.

Err:5 https://deb.nodesource.com/node_12.x bionic InRelease                   
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1655A0AB68576280
Reading package lists... Done
W: GPG error: https://deb.nodesource.com/node_12.x bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1655A0AB68576280
E: The repository 'https://deb.nodesource.com/node_12.x bionic 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

Checked the permissions of /usr/share/keyrings/nodesource.gpg and it was 600. Changing it to 644 fixed the issue.

I had the same issue on Ubuntu-20.04. Tried to install nodejs 12.x Due to strange root settings on my corporate laptop, the permissions for files

/etc/apt/sources.list.d/nodesource.list
/usr/share/keyrings/nodesource.gpg

were wrong (600). Calling

$ sudo chmod 644 /etc/apt/sources.list.d/nodesource.list
$ sudo chmod 644 /usr/share/keyrings/nodesource.gpg

has solved the problem. Feeling pretty angry that somebody’s crooked hands can make our lives really difficult.

Okay, but what’s the issue for me then, @igsu ? I’m on current LTS, certainly not EOL.

Same here,

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

This problem need to be fix, as it is not the apt-key’s problem.

The real fix has been provided by @kosala-almeda:

I also had the error with Ubuntu bionic.

. . .

Checked the permissions of /usr/share/keyrings/nodesource.gpg and it was 600. Changing it to 644 fixed the issue.

So please add a line chmod 644 /usr/share/keyrings/nodesource.gpg into the setup script.

Thanks

@ShockwaveNN We cannot maintain apt-key as it is scheduled for removal:

https://salsa.debian.org/apt-team/apt/-/commit/ee284d5917d09649b68ff1632d44e892f290c52f https://salsa.debian.org/apt-team/apt/-/commit/ee284d5917d09649b68ff1632d44e892f290c52f#d1b035cd43f3c2f65d2be57ba185053090491a35_47_48

Maintaining deprecated tools so that our scripts work on distributions that are already EOL like Debian Jessie and Ubuntu 14.04 is not a good practice, that is way we are moving with the procedure recommended by Debian:

https://wiki.debian.org/DebianRepository/UseThirdParty

We are sorry that it does not work on those distributions but it is a must.

You can follow the manual instructions that still work on the aforementioned distributions.

Same problem with ubuntu 14.04 (I’ve know it’s EOLed, just as info):

FROM ubuntu:14.04

RUN apt-get -y update && \
    apt-get -y install curl

RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
    apt-get -y install nodejs

result:

WARNING: The following packages cannot be authenticated!
  nodejs
E: There are problems and -y was used without --force-yes

And same Dockerfile is fine with 16.04

FROM ubuntu:16.04

RUN apt-get -y update && \
    apt-get -y install curl

RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
    apt-get -y install nodejs