images icon indicating copy to clipboard operation
images copied to clipboard

GPG key for Yarn has expired,

Open mfoote-bx opened this issue 10 months ago • 41 comments

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

mfoote-bx avatar Jan 23 '26 16:01 mfoote-bx

Grab the new key and you should be OK

gpg --keyserver keyserver.ubuntu.com --recv-keys 23E7166788B63E1E

Daniel15 avatar Jan 23 '26 18:01 Daniel15

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.

JartanFTW avatar Jan 24 '26 02:01 JartanFTW

@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.

JartanFTW avatar Jan 24 '26 17:01 JartanFTW

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

flazzarini avatar Jan 26 '26 09:01 flazzarini

Will the Monthly Release rebuild the images and refresh the keyring https://github.com/devcontainers/images/pull/1754?

silva-renan avatar Jan 26 '26 13:01 silva-renan

@silva-renan Hey, yes, I am working on the Monthly Release which should hopefully fix this.

abdurriq avatar Jan 26 '26 14:01 abdurriq

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 avatar Jan 28 '26 13:01 abdurriq

@abdurriq in our case we noticed the problem in the python:dev-3.14-bookworm image

silva-renan avatar Jan 28 '26 14:01 silva-renan

@silva-renan Does this still persist? I tested it locally and it seems to be fine now.

abdurriq avatar Jan 28 '26 14:01 abdurriq

@abdurriq Issue persists on GitHub Codespaces with image "mcr.microsoft.com/devcontainers/python:1-3.12"

JartanFTW avatar Jan 28 '26 16:01 JartanFTW

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

abdurriq avatar Jan 28 '26 16:01 abdurriq

Closing the issue, will reopen if the regression isn't completed fixed. Thank you all for the information and suggestions.

abdurriq avatar Jan 28 '26 16:01 abdurriq

@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!

JartanFTW avatar Jan 28 '26 17:01 JartanFTW

I see this problem in 3-3.14-trixie as well.

judgeaxl avatar Jan 29 '26 06:01 judgeaxl

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

v-Kaniska244 avatar Jan 29 '26 06:01 v-Kaniska244

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

fujinoki avatar Jan 29 '26 06:01 fujinoki

@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.

Daniel15 avatar Jan 29 '26 07:01 Daniel15

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 avatar Jan 29 '26 07:01 Daniel15

@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.

fujinoki avatar Jan 29 '26 07:01 fujinoki

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.

Daniel15 avatar Jan 29 '26 08:01 Daniel15