microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.4k forks source link

git-from-src-debian.sh errors with 404 #1541

Open JamesHutchisonCarta opened 2 years ago

JamesHutchisonCarta commented 2 years ago

Steps to Reproduce:

  1. Create a new dev container definition with "git": "latest" as the feature
  2. When it gets to the install step for features, it will error with a 404.

Git version doesn't seem to matter. Using a known good version in another dev container it still errors.

This does not affect Codespaces. The reason seems to be that Codespaces masks the issue by skipping the install

#14 [stage-1 2/2] RUN cd /tmp/build-features/local-cache && chmod +x ./install.sh && ./install.sh
#14 1.257 (*) Script: git-from-src-debian.sh latest true
#14 1.259 (*) Skipping. Script already run with same arguments.

Full error output:

 > [3/3] RUN cd /tmp/build-features/local-cache && chmod +x ./install.sh && ./install.sh:
#7 0.304 (*) Script: git-from-src-debian.sh latest true                         
#7 0.319 Skipping apt-get update.                                               
#7 0.346 Reading package lists...                                               
#7 0.924 Building dependency tree...                                            
#7 1.117 Reading state information...
#7 1.315 ca-certificates is already the newest version (20210119).
#7 1.315 curl is already the newest version (7.74.0-1.3+deb11u1).
#7 1.315 libcurl4-openssl-dev is already the newest version (7.74.0-1.3+deb11u1).
#7 1.315 libexpat1-dev is already the newest version (2.2.10-2+deb11u3).
#7 1.315 libexpat1-dev set to manually installed.
#7 1.315 tar is already the newest version (1.34+dfsg-1).
#7 1.315 zlib1g-dev is already the newest version (1:1.2.11.dfsg-2+deb11u1).
#7 1.315 The following additional packages will be installed:
#7 1.315   gettext-base libssl1.1
#7 1.315 Suggested packages:
#7 1.315   gettext-doc autopoint libasprintf-dev libgettextpo-dev libssl-doc
#7 1.346 The following NEW packages will be installed:
#7 1.347   build-essential gettext gettext-base
#7 1.349 The following packages will be upgraded:
#7 1.350   libssl-dev libssl1.1
#7 1.465 2 upgraded, 3 newly installed, 0 to remove and 18 not upgraded.
#7 1.465 Need to get 4,865 kB of archives.
#7 1.465 After this operation, 6,679 kB of additional disk space will be used.
#7 1.465 Get:1 http://deb.debian.org/debian bullseye/main amd64 gettext-base amd64 0.21-4 [175 kB]
#7 1.604 Get:2 http://deb.debian.org/debian bullseye/main amd64 build-essential amd64 12.9 [7,704 B]
#7 1.605 Get:3 http://deb.debian.org/debian bullseye/main amd64 gettext amd64 0.21-4 [1,311 kB]
#7 1.636 Err:4 http://security.debian.org/debian-security bullseye-security/main amd64 libssl-dev amd64 1.1.1n-0+deb11u2
#7 1.636   404  Not Found [IP: 151.101.54.132 80]
#7 1.683 Get:5 http://security.debian.org/debian-security bullseye-security/main amd64 libssl1.1 amd64 1.1.1n-0+deb11u2 [1,558 kB]
#7 2.019 Fetched 3,051 kB in 1s (4,766 kB/s)
#7 2.019 E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl-dev_1.1.1n-0%2bdeb11u2_amd64.deb  404  Not Found [IP: 151.101.54.132 80]
#7 2.019 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
JamesHutchisonCarta commented 2 years ago

It looks like the file name should be libssl-dev_1.1.1n-0+deb11u3_amd64.deb

If anyone is stuck, the workaround is to use "git": "system", (which I suppose is the same as commenting out the line)

Chuxel commented 2 years ago

That error is actually coming from the OS when trying to install needed dependencies to build git. I am not seeing this repro with the default debian image and mcr.microsoft.com/vscode/devcontainers/base a x86_64 mac.

I've seen this happen with old images - Can you try using docker pull to pull the latest version of your base image and retry?

Also, if you haven't already, restart Docker Desktop. I've seen clock-drift in the VM cause things like this to happen as well.

The message you see above is because the default image in Codespaces has already run this particular script, so that's why its skipped.

JamesHutchisonCarta commented 2 years ago

I can confirm doing a pull of the image fixes it.

I wonder if there's a way to change the logic so this doesn't happen?

Chuxel commented 2 years ago

Cleaning out the /var/lib/apt/lists/ folder in your base Dockerfile (rm -rf /var/lib/apt/lists/*) will generally prevent it. We do that in our pre-built images.

Example: https://forums.linuxmint.com/viewtopic.php?t=132196