Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expired Debian key issue #1575

Closed
waynedixon opened this issue Mar 17, 2021 · 62 comments
Closed

Expired Debian key issue #1575

waynedixon opened this issue Mar 17, 2021 · 62 comments

Comments

@waynedixon
Copy link

After updating the deb.sury.org APT key, per the information on this page (https://www.patreon.com/posts/february-update-47617742) on Debian Stretch, I am receiving the following error:

Hit:5 https://packages.sury.org/php stretch InRelease
Err:5 https://packages.sury.org/php stretch InRelease
The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php stretch InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org
W: Failed to fetch https://packages.sury.org/php/dists/stretch/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org

I updated the APT key on another system, running Debian Buster, and that one worked fine. I also tried manually installing the updated apt.gpg file, and it still shows the same error. So, I think there may be an issue with the signature on the Debian Stretch InRelease file.

@conter86
Copy link

Тоже самое

  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php buster InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: Failed to fetch https://packages.sury.org/php/dists/buster/InRelease  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

Use apt-key list to find the offending expired key, remove it and then add it again, it should look like this:

/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub   rsa3072 2019-03-18 [E] [expires: 2024-02-16]

@DerDanilo
Copy link

DerDanilo commented Mar 17, 2021

The problem still seems to exist. Key was replaced by the updated one. No other key laying around.

Update:
When adding the key from the ubuntu ppa to debian (buster) and removing the ubuntu packages sources, there is no issue downloading from the debian packages again.

Maybe this info is of help to fix this.

LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
rm /etc/apt/sources.list.d/ondrej-ubuntu-php-hirsute.list
apt update && apt upgrade

@waynedixon
Copy link
Author

I checked mine, and there are no expired keys in my list.

@NielsH
Copy link

NielsH commented Mar 17, 2021

Same issue here during apt-get update:

Err:12 https://packages.sury.org/nginx-mainline stretch InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
Err:13 https://packages.sury.org/php stretch InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expired: 2021-03-17]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ expired] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

Appears fixed after re-downloading the gpg key:

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub   rsa3072 2019-03-18 [E] [expires: 2024-02-16]

@themontyhouse
Copy link

themontyhouse commented Mar 17, 2021

Same issue here during apt-get update:

Err:12 https://packages.sury.org/nginx-mainline stretch InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
Err:13 https://packages.sury.org/php stretch InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expired: 2021-03-17]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ expired] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

Appears fixed after re-downloading the gpg key:

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub   rsa3072 2019-03-18 [E] [expires: 2024-02-16]

This fixed it for me
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg worked for me

@stefanux
Copy link

how delete old key (if "apt-key list" shows that the expired key is still in /etc/apt/trusted.gpg):
apt-key del 95BD4743

import new keyring:
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

update package-list:
apt-get update

@waynedixon
Copy link
Author

I re-checked again, and there is a second copy of the expired key in a different location. @stefanux's answer is the solution. Even if you have downloaded the new key, it is best to follow @stefanux's steps. If you run as root, you may need to change the permissions on the downloaded file to 644 for it to be readable.

@oerdnj oerdnj reopened this Mar 17, 2021
@oerdnj
Copy link
Owner

oerdnj commented Mar 17, 2021

I have reopened the issue to prevent duplicates...

@oerdnj oerdnj changed the title Debian Stretch Key issue Debian expired Key issue Mar 17, 2021
@oerdnj oerdnj changed the title Debian expired Key issue Expired Debian key issue Mar 17, 2021
@derjohn
Copy link

derjohn commented Mar 18, 2021

Better Style, use apt-key add

apt-key del 95BD4743; wget -nv -O - "https://packages.sury.org/php/apt.gpg" | apt-key add -

@oerdnj
Copy link
Owner

oerdnj commented Mar 18, 2021

Better Style, use apt-key add

Actually, not really better style:

$ apt-key list
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

@Extronic
Copy link

Same issue here during apt-get update:

Err:12 https://packages.sury.org/nginx-mainline stretch InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
Err:13 https://packages.sury.org/php stretch InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expired: 2021-03-17]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ expired] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

Appears fixed after re-downloading the gpg key:

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub   rsa3072 2019-03-18 [E] [expires: 2024-02-16]

This fixed it for me too.

@tauceti82
Copy link

I still cannot fix the error with the provided steps: deleted the key and reimported it with steps:

apt-key del B188E2B695BD4743
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
apt-get update

but still getting:

Err:4 https://packages.sury.org/php buster InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

apt-key list:
/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
1505 8500 A023 5D97 F5D1 0063 B188 E2B6 95BD 4743
uid [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub rsa3072 2019-03-18 [E] [expires: 2024-02-16]

@indigoxela
Copy link

indigoxela commented Mar 19, 2021

@tauceti82 are you deleting the wrong key?

The suggestion of @stefanux was:

apt-key del 95BD4743

(Then get the new one again.)
That worked without any problems for me on several servers. (Many thanks for sharing the solution, BTW)

@tauceti82
Copy link

@tauceti82 are you deleting the wrong key?

The suggestion of @stefanux was:

apt-key del 95BD4743

That worked without any problems for me on several servers. (Many thanks for sharing the solution, BTW)

I tried both...but the error points at key EXPKEYSIG B188E2B695BD4743 so I deleted this key.
it is the same as 95BD4743 butonly the last 8 digits...so it shouldn't matter

@indigoxela
Copy link

@tauceti82

Your apt-key list output is truncated. It shows the new key. Does the full listing still contain the expired one?

@tauceti82
Copy link

@tauceti82

Your apt-key list output is truncated. It shows the new key. Does the full listing still contain the expired one?

it only contains one entry for /etc/apt/trusted.gpg.d/php.gpg which I already posted

@nboisteault
Copy link

@tauceti82 I did :

apt-key del B188E2B695BD4743
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

and it worked fine.

@tauceti82
Copy link

@tauceti82 I did :

apt-key del B188E2B695BD4743
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

and it worked fine.

thats what I exactly described above what I did and still I get the error :(

@oerdnj
Copy link
Owner

oerdnj commented Mar 19, 2021

Post the full apt-key list output.

@oerdnj
Copy link
Owner

oerdnj commented Mar 19, 2021

For the next transition, I'll prepare something like debsuryorg-archive-keyring package, so the new trust period is updated automatically.

@tauceti82
Copy link

tauceti82 commented Mar 19, 2021

Post the full apt-key list output.

--------------------
pub   rsa2048 2013-09-16 [SC]
      4609 5ACC 8548 582C 1A26  99A9 D27D 666C D88E 42B4
uid           [ unknown] Elasticsearch (Elasticsearch Signing Key) <dev_ops@elasticsearch.org>
sub   rsa2048 2013-09-16 [E]

/etc/apt/trusted.gpg.d/debian-archive-buster-automatic.gpg
----------------------------------------------------------
pub   rsa4096 2019-04-14 [SC] [expires: 2027-04-12]
      80D1 5823 B7FD 1561 F9F7  BCDD DC30 D7C2 3CBB ABEE
uid           [ unknown] Debian Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>
sub   rsa4096 2019-04-14 [S] [expires: 2027-04-12]

/etc/apt/trusted.gpg.d/debian-archive-buster-security-automatic.gpg
-------------------------------------------------------------------
pub   rsa4096 2019-04-14 [SC] [expires: 2027-04-12]
      5E61 B217 265D A980 7A23  C5FF 4DFA B270 CAA9 6DFA
uid           [ unknown] Debian Security Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>
sub   rsa4096 2019-04-14 [S] [expires: 2027-04-12]

/etc/apt/trusted.gpg.d/debian-archive-buster-stable.gpg
-------------------------------------------------------
pub   rsa4096 2019-02-05 [SC] [expires: 2027-02-03]
      6D33 866E DD8F FA41 C014  3AED DCC9 EFBF 77E1 1517
uid           [ unknown] Debian Stable Release Key (10/buster) <debian-release@lists.debian.org>

/etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg
----------------------------------------------------------
pub   rsa4096 2014-11-21 [SC] [expires: 2022-11-19]
      126C 0D24 BD8A 2942 CC7D  F8AC 7638 D044 2B90 D010
uid           [ unknown] Debian Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>

/etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg
-------------------------------------------------------------------
pub   rsa4096 2014-11-21 [SC] [expires: 2022-11-19]
      D211 6914 1CEC D440 F2EB  8DDA 9D6D 8F6B C857 C906
uid           [ unknown] Debian Security Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>

/etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg
-------------------------------------------------------
pub   rsa4096 2013-08-17 [SC] [expires: 2021-08-15]
      75DD C3C4 A499 F1A1 8CB5  F3C8 CBF8 D6FD 518E 17E1
uid           [ unknown] Jessie Stable Release Key <debian-release@lists.debian.org>

/etc/apt/trusted.gpg.d/debian-archive-stretch-automatic.gpg
-----------------------------------------------------------
pub   rsa4096 2017-05-22 [SC] [expires: 2025-05-20]
      E1CF 20DD FFE4 B89E 8026  58F1 E0B1 1894 F66A EC98
uid           [ unknown] Debian Archive Automatic Signing Key (9/stretch) <ftpmaster@debian.org>
sub   rsa4096 2017-05-22 [S] [expires: 2025-05-20]

/etc/apt/trusted.gpg.d/debian-archive-stretch-security-automatic.gpg
--------------------------------------------------------------------
pub   rsa4096 2017-05-22 [SC] [expires: 2025-05-20]
      6ED6 F5CB 5FA6 FB2F 460A  E88E EDA0 D238 8AE2 2BA9
uid           [ unknown] Debian Security Archive Automatic Signing Key (9/stretch) <ftpmaster@debian.org>
sub   rsa4096 2017-05-22 [S] [expires: 2025-05-20]

/etc/apt/trusted.gpg.d/debian-archive-stretch-stable.gpg
--------------------------------------------------------
pub   rsa4096 2017-05-20 [SC] [expires: 2025-05-18]
      067E 3C45 6BAE 240A CEE8  8F6F EF0F 382A 1A7B 6500
uid           [ unknown] Debian Stable Release Key (9/stretch) <debian-release@lists.debian.org>

/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub   rsa3072 2019-03-18 [E] [expires: 2024-02-16]

@Jdogzz
Copy link

Jdogzz commented Mar 19, 2021

I can confirm the same behavior that @tauceti82 is experiencing on my end. I have followed every set of instructions in this thread, including verifying the permissions of the file /etc/apt/trusted.gpg.d/php.gpg as noted in @waynedixon 's response to @stefanux 's solution, and made sure to try rebooting, and no dice. My key file output is as follows after all the instructions:

/etc/apt/trusted.gpg.d/debian-archive-buster-automatic.gpg
----------------------------------------------------------
pub   rsa4096 2019-04-14 [SC] [expires: 2027-04-12]
      80D1 5823 B7FD 1561 F9F7  BCDD DC30 D7C2 3CBB ABEE
uid           [ unknown] Debian Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>
sub   rsa4096 2019-04-14 [S] [expires: 2027-04-12]

/etc/apt/trusted.gpg.d/debian-archive-buster-security-automatic.gpg
-------------------------------------------------------------------
pub   rsa4096 2019-04-14 [SC] [expires: 2027-04-12]
      5E61 B217 265D A980 7A23  C5FF 4DFA B270 CAA9 6DFA
uid           [ unknown] Debian Security Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>
sub   rsa4096 2019-04-14 [S] [expires: 2027-04-12]

/etc/apt/trusted.gpg.d/debian-archive-buster-stable.gpg
-------------------------------------------------------
pub   rsa4096 2019-02-05 [SC] [expires: 2027-02-03]
      6D33 866E DD8F FA41 C014  3AED DCC9 EFBF 77E1 1517
uid           [ unknown] Debian Stable Release Key (10/buster) <debian-release@lists.debian.org>

/etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg
----------------------------------------------------------
pub   rsa4096 2014-11-21 [SC] [expires: 2022-11-19]
      126C 0D24 BD8A 2942 CC7D  F8AC 7638 D044 2B90 D010
uid           [ unknown] Debian Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>

/etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg
-------------------------------------------------------------------
pub   rsa4096 2014-11-21 [SC] [expires: 2022-11-19]
      D211 6914 1CEC D440 F2EB  8DDA 9D6D 8F6B C857 C906
uid           [ unknown] Debian Security Archive Automatic Signing Key (8/jessie) <ftpmaster@debian.org>

/etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg
-------------------------------------------------------
pub   rsa4096 2013-08-17 [SC] [expires: 2021-08-15]
      75DD C3C4 A499 F1A1 8CB5  F3C8 CBF8 D6FD 518E 17E1
uid           [ unknown] Jessie Stable Release Key <debian-release@lists.debian.org>

/etc/apt/trusted.gpg.d/debian-archive-stretch-automatic.gpg
-----------------------------------------------------------
pub   rsa4096 2017-05-22 [SC] [expires: 2025-05-20]
      E1CF 20DD FFE4 B89E 8026  58F1 E0B1 1894 F66A EC98
uid           [ unknown] Debian Archive Automatic Signing Key (9/stretch) <ftpmaster@debian.org>
sub   rsa4096 2017-05-22 [S] [expires: 2025-05-20]

/etc/apt/trusted.gpg.d/debian-archive-stretch-security-automatic.gpg
--------------------------------------------------------------------
pub   rsa4096 2017-05-22 [SC] [expires: 2025-05-20]
      6ED6 F5CB 5FA6 FB2F 460A  E88E EDA0 D238 8AE2 2BA9
uid           [ unknown] Debian Security Archive Automatic Signing Key (9/stretch) <ftpmaster@debian.org>
sub   rsa4096 2017-05-22 [S] [expires: 2025-05-20]

/etc/apt/trusted.gpg.d/debian-archive-stretch-stable.gpg
--------------------------------------------------------
pub   rsa4096 2017-05-20 [SC] [expires: 2025-05-18]
      067E 3C45 6BAE 240A CEE8  8F6F EF0F 382A 1A7B 6500
uid           [ unknown] Debian Stable Release Key (9/stretch) <debian-release@lists.debian.org>

/etc/apt/trusted.gpg.d/php.gpg
------------------------------
pub   rsa3072 2019-03-18 [SC] [expires: 2024-02-16]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ unknown] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
sub   rsa3072 2019-03-18 [E] [expires: 2024-02-16]

The apt-get update results in the same:

Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org buster/updates InRelease                                                                        
Hit:3 https://packages.sury.org/php buster InRelease                                                                             
Ign:4 http://archive.turnkeylinux.org/debian buster-security InRelease
Err:3 https://packages.sury.org/php buster InRelease
  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
Ign:5 http://archive.turnkeylinux.org/debian buster InRelease
Hit:6 http://archive.turnkeylinux.org/debian buster-security Release
Hit:8 http://archive.turnkeylinux.org/debian buster Release
Reading package lists... Done                             
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php buster InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: Failed to fetch https://packages.sury.org/php/dists/buster/InRelease  The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <deb@sury.org>
W: Some index files failed to download. They have been ignored, or old ones used instead.

@Adi-18
Copy link

Adi-18 commented Mar 20, 2021

Same for me. There is no expired key in apt-key list but get the same error.

@oerdnj
Copy link
Owner

oerdnj commented Mar 20, 2021

Has anyone tried removing the key and then listing the active keys? It could be that the new key is masking the expired one, but then apt sees the expired key first.

@tauceti82
Copy link

tauceti82 commented Mar 20, 2021

Has anyone tried removing the key and then listing the active keys? It could be that the new key is masking the expired one, but then apt sees the expired key first.

I removed the key via apt-key del and it was deleted meaning it was not listed in apt-key list and then loaded it again... did not work.
BTW what does this [E] mean???
It is not there in other keys...

03-18 [E] [expires:

@oerdnj
Copy link
Owner

oerdnj commented Mar 21, 2021

The question isn't whether it listed the correct keys, but whether it also listed something else that should not be there.

What I am saying is that you should carefully review all the files and all the keys and remove stuff that should not be there.

I am quite sure that there's some forgotten file that still list the old key and it is causing problems.

I would try removing the php.gpg file and then listing the keys again if something shows up.

It is a local configuration problem and you are the only one who can solve it, we can't administer your installation for you.

@tauceti82
Copy link

The question isn't whether it listed the correct keys, but whether it also listed something else that should not be there.

What I am saying is that you should carefully review all the files and all the keys and remove stuff that should not be there.

I am quite sure that there's some forgotten file that still list the old key and it is causing problems.

I would try removing the php.gpg file and then listing the keys again if something shows up.

It is a local configuration problem and you are the only one who can solve it, we can't administer your installation for you.

Yes I also think that somewhere is a reference to the old key or some bug in apt. If anyone also affected by the problem could get it to work please Post here. I will continue looking...

@oerdnj
Copy link
Owner

oerdnj commented Mar 21, 2021

Is there /etc/apt/trusted.gpg on your system and what keys it contains?

What's output of ls -l /etc/apt/trusted.gpg.d/?

@tauceti82
Copy link

Is there /etc/apt/trusted.gpg on your system and what keys it contains?

What's output of ls -l /etc/apt/trusted.gpg.d/?

gpg --no-default-keyring --keyring /etc/apt/trusted.gpg --list-keys
/etc/apt/trusted.gpg
--------------------
pub   rsa2048 2013-09-16 [SC]
      46095ACC8548582C1A2699A9D27D666CD88E42B4
uid           [ unknown] Elasticsearch (Elasticsearch Signing Key) <dev_ops@elasticsearch.org>
sub   rsa2048 2013-09-16 [E]



~$ ls -l /etc/apt/trusted.gpg.d/
total 68
-rw-r--r-- 1 root root 8132 Apr 23  2019 debian-archive-buster-automatic.gpg
-rw-r--r-- 1 root root 8141 Apr 23  2019 debian-archive-buster-security-automatic.gpg
-rw-r--r-- 1 root root 2332 Apr 23  2019 debian-archive-buster-stable.gpg
-rw-r--r-- 1 root root 5106 Apr 23  2019 debian-archive-jessie-automatic.gpg
-rw-r--r-- 1 root root 5115 Apr 23  2019 debian-archive-jessie-security-automatic.gpg
-rw-r--r-- 1 root root 2763 Apr 23  2019 debian-archive-jessie-stable.gpg
-rw-r--r-- 1 root root 7443 Apr 23  2019 debian-archive-stretch-automatic.gpg-rw-r--r-- 1 root root 7452 Apr 23  2019 debian-archive-stretch-security-automatic.gpg
-rw-r--r-- 1 root root 2263 Apr 23  2019 debian-archive-stretch-stable.gpg
-rw-r--r-- 1 root root 1769 Feb 16 09:43 php.gpg
-rw-r--r-- 1 root root 1769 Feb 16 09:43 php.gpg~

@oerdnj
Copy link
Owner

oerdnj commented Mar 21, 2021

And what happens if you remove both php.gpg and php.gpg~ and then do apt update?

@oerdnj
Copy link
Owner

oerdnj commented Mar 21, 2021

Could you try running apt-key update? The command is deprecated, but perhaps on old system, it could do maintenance on the keyrings...

@tauceti82
Copy link

And what happens if you remove both php.gpg and php.gpg~ and then do apt update?

I already did. When removing the keys apt Update complains that the key could not be found.

@oerdnj
Copy link
Owner

oerdnj commented Mar 21, 2021

This is really a wild shot, but is your time and date correct on the affected machine?

@tauceti82
Copy link

This is really a wild shot, but is your time and date correct on the affected machine?

Yup. Of course checked that also!

@oerdnj
Copy link
Owner

oerdnj commented Mar 21, 2021

There's no "of course" when debugging... ;)

But I am a loss...

Do you have the same checksum on the file?

curl -sSL https://packages.sury.org/php/apt.gpg |sha256sum
b3ea944563435e54bb64f181ee8bc26200985d09164cdc4c1702fc3ef051f19d  -

@tauceti82
Copy link

There's no "of course" when debugging... ;)

But I am a loss...

Do you have the same checksum on the file?

curl -sSL https://packages.sury.org/php/apt.gpg |sha256sum
b3ea944563435e54bb64f181ee8bc26200985d09164cdc4c1702fc3ef051f19d  -

Yes it has the same checksum.
What about the others who also had this problem? Could you fix it?

@derjohn
Copy link

derjohn commented Mar 21, 2021

🤷 Basically I deleted the old key and added the new one. That worked. Could it be that you use some cache or proxy that still has old signatures?

@Jdogzz
Copy link

Jdogzz commented Mar 22, 2021

I still haven't fixed it, but I've found a place where the problem seems to be reproducible with bare minimum configuring for anyone wanting a direct way to see it. I downloaded the VM for Nextcloud V 16.0 ( https://www.turnkeylinux.org/nextcloud ) went through the password configuring process, and immediately found the same behavior when doing apt update afterwards. Following the steps above for fixing the key did not fix the problem. I will cross-post an issue in their bug tracker.

@Jdogzz
Copy link

Jdogzz commented Mar 22, 2021

Ah, I spoke too soon. I was able to fix it in my case and it did turn out to be a key source that apt-key list wasn't listing. As discussed on this page on the Turnkey forums ( https://www.turnkeylinux.org/forum/support/fri-20190329-1841/when-updating-vm-nextcloud-v-151-error ), they store the key at the location /usr/share/keyrings/php-sury.org.gpg . Following the steps outlined on that post fixed the issue for me, essentially identical to the solutions already described here but with replacing the key file at its other location.

@oerdnj
Copy link
Owner

oerdnj commented Mar 22, 2021

Yeah, that was going to be my next suggestion - use strace to look at all the files apt get opens.

@tauceti82
Copy link

Ah, I spoke too soon. I was able to fix it in my case and it did turn out to be a key source that apt-key list wasn't listing. As discussed on this page on the Turnkey forums ( https://www.turnkeylinux.org/forum/support/fri-20190329-1841/when-updating-vm-nextcloud-v-151-error ), they store the key at the location /usr/share/keyrings/php-sury.org.gpg . Following the steps outlined on that post fixed the issue for me, essentially identical to the solutions already described here but with replacing the key file at its other location.

Omg you rock! I also use a turnkey Nextcloud image!!! I will check this ASAP!

@Adi-18
Copy link

Adi-18 commented Mar 22, 2021

Yeah,

wget -O /usr/share/keyrings/php-sury.org.gpg https://packages.sury.org/php/apt.gpg

did the trick for me.

@tauceti82
Copy link

Yeah,

wget -O /usr/share/keyrings/php-sury.org.gpg https://packages.sury.org/php/apt.gpg

did the trick for me.

Yes thank you!!! It also worked for me. Damn that was really hard because it isn't listed with apt-key list. Don't know why turnkey uses different locations. Thanks everyone and especially Ondrej!!!

@DerDanilo
Copy link

@tauceti82 I did :

apt-key del B188E2B695BD4743
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

and it worked fine.

This one works on stretch. Didn't on Buster (for me). Weird.

@tauceti82
Copy link

@tauceti82 I did :

apt-key del B188E2B695BD4743

wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

and it worked fine.

This one works on stretch. Didn't on Buster (for me). Weird.

From the linked turnkey forum Post use this to find out where the pgp key is linked:

You can use grep to check for both the existence of sury.org in the sources.lists and whether or not it's locked to the specific key file, using grep. I.e.:

grep -r sury.org /etc/apt/sources.list*

@vrubiolo
Copy link

vrubiolo commented Apr 2, 2021

Just wanted to let you know that I had the same issue on a Gandi VPS Stretch image and that removing the key and adding it back as suggested here worked for me (adapting the key path to what I had of course).

Expired key shown via apt-key:

/etc/apt/trusted.gpg.d/extra_php_version.gpg
--------------------------------------------
pub   rsa3072 2019-03-18 [SC] [expired: 2021-03-17]
      1505 8500 A023 5D97 F5D1  0063 B188 E2B6 95BD 4743
uid           [ expired] DEB.SURY.ORG Automatic Signing Key <deb@sury.org>

edit: fixed typos

@OverlordDvlp
Copy link

OverlordDvlp commented Apr 15, 2021

on my side I have do this : wget -O /usr/share/keyrings/php-sury.org.gpg https://packages.sury.org/php/apt.gpg
as the content of my repo is:

# DEB.SURY.ORG repo for php

deb [signed-by=/usr/share/keyrings/php-sury.org.gpg] https://packages.sury.org/php/ buster main

And it work fine. Im based on LXC turnkey nextcloud on proxmox environment,

@wdseelig
Copy link

I think I'm in a catch 22 here. I am trying to create a Docker image and find that I cannot RUN apt-get update because of this key issue. I need to run wget in order to get the new key, but I can't install wget until I run apt-get update. Any suggestions?

@oerdnj
Copy link
Owner

oerdnj commented Apr 22, 2021

You know you can copy local files to the image?

@wdseelig
Copy link

Thanks for this. Yes, I know I can copy local files to the image, but I also need to install packages into the image and think I need to be able to run apt-get in order to do that?

@wdseelig
Copy link

I can run wget on my Mac to get one of the keys described in the comments above, but then I would have to figure out a way to pass that to apt-get, wouldn't I?

@wdseelig
Copy link

To be clear about this, I cannot, while doing a Docker build, even execute a RUN apt-get update command because of this key error, and I cannot install wget in order to implement any of the proposed fixes above without running apt-get update.

@wdseelig
Copy link

wdseelig commented Apr 22, 2021

Finally figured this out and am posting this to help anybody else with similar issues.

  1. Navigated to the link above: https://packages.sury.org/php/apt.gpg
  2. This downloaded a file apt.gpg
  3. Renamed this file GoodKey.gpg
  4. Copied GoodKey.gpg into the directory containing the Dockerfile that I'm using to build my image
  5. Added a COPY command in my Dockerfile to put GoodKey.gpg into my container
  6. Modified my Dockerfile RUN command as follows:
    RUN apt-key del B188E2B695BD4743
    && apt-key add GoodKey.gpg
    && apt-get update -yqq
    ... the rest of my apt-get install commands
  7. and that pretty much did it.

Thanks to oerdnj for the hint about copying files into the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests