53

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) <[email protected]>
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 <[email protected]>
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 <[email protected]>
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:[email protected]>�>([���    �
                                                                                                                                            

�
    �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?

9

5 Answers 5

107

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

3
  • 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 <[email protected]> W: Failed to fetch https://dl.yarnpkg.com/debian/dists/stable/InRelease The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <[email protected]>
    – Rayner
    Feb 5, 2021 at 5: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, 2023 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 May 2, 2023 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

3
  • Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
    – Robycool
    Nov 9, 2021 at 9:06
  • This fixes everything. I wonder why the operating system doesn't just do this automatically? Jan 21, 2022 at 20:35
  • @AndrewKoster yeah would be nice if it did it on it's own. You can set up a cron job to run this every so often as a work around. Apr 29, 2022 at 21:38
6

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
1
  • 1
    Thank, also works under Ubuntu 22.04 (Jammy)
    – bcag2
    Jun 28, 2023 at 12:49
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
1

I get the same error and fixed it using:

sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
2
  • It would be best if you shortly explain what the command you are displaying does: manpages.debian.org/stretch/apt/apt-key.8.en.html
    – Natan
    Oct 18, 2022 at 6: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.
    – Community Bot
    Oct 18, 2022 at 6:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .