GPG key for Yarn has expired,
The GPG key for Yarn has expired, again, it seems like this happened before: https://github.com/devcontainers/images/issues/370
Example from mcr.microsoft.com/devcontainers/python:dev-3.14-bookworm running apt update #18 0.335 Err:4 https://dl.yarnpkg.com/debian stable InRelease #18 0.335 The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging #18 1.061 Reading package lists... #18 1.500 W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging
There is an issue in Yarnpkg about it, I guess this would need to be fixed before the images are recreated https://github.com/yarnpkg/yarn/issues/9216
If you remove yarn you can run apt-get. It seems using v1 or Yarn is not so advisable these days? https://github.com/devcontainers/images/blob/main/src/python/manifest.json#L92-L95
Grab the new key and you should be OK
gpg --keyserver keyserver.ubuntu.com --recv-keys 23E7166788B63E1E
Upstream (https://github.com/yarnpkg/yarn/issues/9216) documents the Yarn repository GPG key expiration issue. Although the key’s expiry has now been extended upstream, the current devcontainer images still embed the old expired key, so apt-get update continues to fail. A new image rebuild that refreshes the keyring is needed for builds to succeed.
@Kaniska244 You seem like an active maintainer of this repository. Could you please trigger a rebuild to fix this issue? Er actually on closer inspection, maybe I should be tagging @abdurriq instead.
For now I have fixed the issue using the following command during the dev-container build process. I am using python:3.13-bookworm
# -----------------------------------------------------------------------------
# Fix yarn signature issue, open bug with microsoft images
# https://github.com/devcontainers/images/issues/1752
# -----------------------------------------------------------------------------
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg \
| sudo gpg \
--batch \
--yes \
--dearmor \
-o /usr/share/keyrings/yarn-archive-keyring.gpg
Will the Monthly Release rebuild the images and refresh the keyring https://github.com/devcontainers/images/pull/1754?
@silva-renan Hey, yes, I am working on the Monthly Release which should hopefully fix this.
A new release has been cut, with some adjustments to the node DevContainer feature to patch this issue; please let us know if there is a reoccurrance of this issue. I will close this issue later on today if there are no futher issues.
@abdurriq in our case we noticed the problem in the python:dev-3.14-bookworm image
@silva-renan Does this still persist? I tested it locally and it seems to be fine now.
@abdurriq Issue persists on GitHub Codespaces with image "mcr.microsoft.com/devcontainers/python:1-3.12"
@JartanFTW Yeah, that makes sense. We are now on version 3- for the Python images (https://github.com/devcontainers/images/tree/main/src/python) -- could you please try to update to the new equivalent image (https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/python/tag/3-3.12) and see that fixes it?
Closing the issue, will reopen if the regression isn't completed fixed. Thank you all for the information and suggestions.
@JartanFTW Yeah, that makes sense. We are now on version
3-for the Python images (https://github.com/devcontainers/images/tree/main/src/python) -- could you please try to update to the new equivalent image (https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/python/tag/3-3.12) and see that fixes it?
Ah, my mistake! I've updated to python:3-3.12 and it's building successfully now. Thanks!
I see this problem in 3-3.14-trixie as well.
The issue seems to have resurfaced with this update. The repo has been signed with a brand new key now. We are checking further on this. cc: @abdurriq
Just curious—is removing /etc/apt/sources.list.d/yarn.list entirely an option here?
Since this GPG issue seems to pop up pretty often, and many of us are using DevContainer Features to handle Node/Yarn anyway, keeping this apt repo by default feels like it causes more headaches than it's worth.
I’m currently just deleting it in my Dockerfile to bypass the error, and it works fine:
FROM mcr.microsoft.com/devcontainers/<image>
# Just removing the list to avoid the apt update failure
RUN rm -f /etc/apt/sources.list.d/yarn.list \
&& apt-get update
@Kaniska244 I'm very sorry about that.
The first update bumped the expiry of the old key. However, someone informed me that the old key uses SHA1 and Debian will stop trusting all SHA1 signed repos on Feb 1.
The second update swapped the key for a brand new one that doesn't use SHA1 any more.
The new key expires in 2030 so it shouldn't be an issue any more. I don't expect Yarn Classic to still be in use four years from now.
Since this GPG issue seems to pop up pretty often,
@fujinoki it doesn't happen often with the Yarn repo - the last time the GPG key was updated was back in 2023. It's a security best practice to not have GPG keys that last forever.
We (Yarn devs) were going to make the updates smoother by bundling the key in a package, but never got around to it, and development of Yarn v1 is finished now (no new work is planned).
@Daniel15 You are right, "pretty often" was an exaggeration. I apologize for that. And thank you for the detailed explanation and the fix.
Hearing that Yarn v1 development is finished makes me wonder if we could explore ways to avoid adding the apt repository in the future. Since the software is no longer evolving, it might be worth reconsidering if we truly need the overhead of an apt repository.
An alternative would be to just download the .deb file and install it using apt install ./yarn.deb, rather than adding the repo.
There's URLs for both a specific version, and for the latest version:
https://classic.yarnpkg.com/downloads/1.22.22/yarn_1.22.22_all.deb
https://classic.yarnpkg.com/latest.deb
A potential issue with that is that it doesn't automatically check for a valid GPG signature (it'd have to be checked manually), but maybe that's OK in some situations.