51

Every time apt update shows error

W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23E7166788B63E1E
E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed.

I tried

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

gpg: invalid key resource URL '/etc/apt/trusted.gpg.d/home:stevenpusser.gpg'
gpg: keyblock resource '(null)': General error
gpg: key 7721F63BD38B4796: 2 signatures not checked due to missing keys

With y-ppa-manager I go the same

gpg: invalid key resource URL '/etc/apt/trusted.gpg.d/home:stevenpusser.gpg'
gpg: keyblock resource '(null)': General error
gpg: key 7721F63BD38B4796: 2 signatures not checked due to missing keys
gpg: key 0FAD31CA8719FCE4: 1 signature not checked due to a missing key
gpg: key 3B4FE6ACC0B21F32: 3 signatures not checked due to missing keys
gpg: key D94AA3F0EFE21092: 3 signatures not checked due to missing keys
gpg: key 871920D1991BC93C: 1 signature not checked due to a missing key

I added this key for my Github authentication,so I am afraid to delete it from list. I can not find it with

apt-key list

/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2016-04-12 [SC]
      EB4C 1BFD 4F04 2F6D DDCC  EC91 7721 F63B D38B 4796
uid           [ unknown] Google Inc. (Linux Packages Signing Authority) <linux-packages-keymaster@google.com>
sub   rsa4096 2019-07-22 [S] [expires: 2022-07-21]

pub   rsa4096 2014-09-08 [SC]
      67CE 018F D19E 3CD4 8189  BC69 2180 17D1 CC5F DB34
uid           [ unknown] Yandex Browser Repository Key <browser@support.yandex.ru>
sub   rsa4096 2014-09-08 [E]

pub   rsa4096 2018-12-04 [SC] [expires: 2021-01-22]
      B44B 85E3 E1A6 386B FC79  D411 9658 E804 4A3A A3D6
uid           [ unknown] Vivaldi Package Composer KEY05 <packager@vivaldi.com>
sub   rsa4096 2018-12-04 [E] [expires: 2021-01-22]

The mentioned file looks like compiled binary(I guess)

�\           #>p�����N��M�����k��2C�2�����5�Z~W?4����dm��}q�Q���ޠE�m�
  !��� 8�GFd]���ǚD�7��X�5�D�LG�E��S��O`{
                                        ��n-��1�<�+�*�լ�ak�,���Na����
D�i�5�NÁ��6��C��f�A�z?NTX��`*��`�c��(����\�]8���a��Sw��Dhome:stevenpusser OBS Project <home:stevenpusser@build.opensuse.org>�>([���    �
                                                                                                                                            

�
    �1ʇ����P�:31'���"�Ȭ��|�����������oH��e�М��\*2�m���YF�;z#a2K�g�*��yA�yQ0T@�{"�'��
}dH�[�y�1�X�_5Y��S�218a0��O��   ���j�4;�Àܶ��6ja�J=��}0�f
�\G{E>{U�u��3ުmEÜ!�c9����F�����
������3��T2�%��1}��v�!u����`TcCh\������q�   ���Lu����0tc�s$�FW��v
    ;0�k�e#�K�s���,�%�O~ܺ<���06%�nP2��s�):

Should I delete it?

How to inspect gpg resources and solve this?

Richard Rublev
  • 827
  • 3
  • 12
  • 25

5 Answers5

104

I had same problem, I just run this command:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

I got it from here: https://www.ubuntuupdates.org/ppa/yarn

nlsn
  • 1,156
  • 1
  • 8
  • 5
  • 1
    This seems to have fixed the error `W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging ` – Rayner Feb 05 '21 at 05:22
  • 1
    Looks like the new way to do this would change your command slightly to: `curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo tee /etc/apt/trusted.gpg.d/dl.yarnpkg.com.asc` – Carl Jan 25 '23 at 17:05
  • I am on Ubuntu 20.04.6 LTS and this answer did solve the exact `GPG error: https://dl.yarnpkg.com/debian stable InRelease:`. Thanks – Pablo Adames May 02 '23 at 17:08
11

You can usually update all of your keys at once using:

sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com

this worked for me

CodeConnoisseur
  • 527
  • 1
  • 5
  • 17
5

For Ubuntu 20.04, above command doesn't work, need to use below one to resolve this error:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
flybeaver
  • 51
  • 1
  • 1
1

Build on @PA-GW's answer, I created a Cronjob that refreshes the keys daily. Hopefully, that helps for the frequently rotating keys, like NodeJS:

17 2 * * * /usr/bin/apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com > /dev/null
stwienert
  • 111
  • 3
0

I get the same error and fixed it using:

sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
  • It would be best if you shortly explain what the command you are displaying does: https://manpages.debian.org/stretch/apt/apt-key.8.en.html – Natan Oct 18 '22 at 06:48
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 18 '22 at 06:48