Can't upgrade on Debian 12.5: "Connection failed" to packages.microsoft.com
Does this issue occur when all extensions are disabled?: N/A
- VS Code Version: 1.87.2-1709912201
- OS Version: Debian 12.5
Steps to Reproduce:
sudo apt updatesudo apt -y upgrade
The package fails to download, with the following error:
Connection failed [IP: 2620:1ec:bdf::69 443]
E: Failed to fetch https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb Connection failed [IP: 2620:1ec:bdf::69 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
It turns out apt was able to fetch exactly 32 MiB of the package:
$ sudo ls -l /var/cache/apt/archives/partial
total 32768
-rw-r--r-- 1 root root 33554432 Mar 12 14:20 code_1.87.2-1709912201_amd64.deb
If I remove that file and retry, there's more evidence in the apt output of progress being made, but it still fails at exactly 32 MiB.
wget is able to complete the download, because it will attempt to resume when the connection is dropped. However, if prevented from doing so (with -t1), we can see that wget downloads of this file are terminated at exactly 72 MiB:
$ wget -t1 https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb
--2024-03-13 20:13:16-- https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb
Resolving packages.microsoft.com (packages.microsoft.com)... 2620:1ec:bdf::69, 2620:1ec:46::69, 13.107.246.69, ...
Connecting to packages.microsoft.com (packages.microsoft.com)|2620:1ec:bdf::69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 99932898 (95M) [application/octet-stream]
Saving to: ‘code_1.87.2-1709912201_amd64.deb’
code_1.87.2-1709912201_amd6 75%[==============================> ] 72.00M 37.8MB/s in 1.9s
2024-03-13 20:13:18 (37.8 MB/s) - Connection closed at byte 75497472. Giving up.
For comparison, curl is able to fetch exactly 32 MiB, just like apt:
$ curl https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb > somefile
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
33 95.3M 33 32.0M 0 0 32.5M 0 0:00:02 --:--:-- 0:00:02 32.5M
curl: (92) HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2)
$ ls -l somefile
-rw-r--r-- 1 dave dave 33554432 Mar 13 20:15 why
The curl and wget commands are reproducible from other machines, including an old RaspbianOS machine.
Chrome is able to download the entire file without issue, as far as I can tell -- if it's retrying, it doesn't say so. I tried changing user-agents with wget and curl, including pasting Chrome's user-agent, and there's no difference.
Chrome is about the same size, and upgraded today on the same machine with no issues from apt. I tried fetching the Chrome Debian package with wget and curl and also had no problems. I also have no trouble with either wget or curl fetching the initial download -- e.g. if I open https://code.visualstudio.com/ and click the "deb" button, I get a link to https://vscode.download.prss.microsoft.com/dbazure/download/stable/863d2581ecda6849923a2118d93a088b0745d9d6/code_1.87.2-1709912201_amd64.deb which works fine from wget and curl. It's also exactly the same file, so it's only an issue with packages.microsoft.com.
However, other versions don't seem to have this issue. The previous build at https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709911730_arm64.deb downloads fine with wget. It was slower at first, so I tried again, and it was just as fast as the current version.
You can see why I'm not including extensions or bisecting, as this isn't an issue with vscode itself, but with the Debian repository at packages.microsoft.com that vscode wants to update from.
I can confirm this and I'm having the same issue.
Ign:1 https://packages.microsoft.com/repos/code stable/main amd64 code amd64 1.87.2-1709912201
Get:1 https://packages.microsoft.com/repos/code stable/main amd64 code amd64 1.87.2-1709912201 [99.9 MB]
Err:1 https://packages.microsoft.com/repos/code stable/main amd64 code amd64 1.87.2-1709912201
Error reading from server. Remote end closed connection [IP: 13.107.246.73 443]
Fetched 10.6 MB in 10s (1,114 kB/s)
E: Failed to fetch https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb Error reading from server. Remote end closed connection [IP: 13.107.246.73 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Same here as well, with apt 2.4.11 on both Ubuntu 22.04 and downstream Pop!_OS 22.04.
I have the same issue on Ubuntu 20.04.
This is my band-aid workaround.
cd /var/cache/apt/archives
sudo wget https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb
sudo apt install code
I am having the same issue. I tried to use @garaemon 's trick and I got the same error. Not really sure whats going on
Can confirm. OS version Debian 12 with KDE
Also having this issue on Debian 12. @garaemon's workaround worked for me.
I'm having this issue for a days now in my Pop! OS 22.04 LTS. I tried to use @garaemon solution and it's working for me for now. I don't know what occurs on this error that causes my system to unable to upgrade my updates. I tried several solution but I don't have a clue on whats going on with those error fetch packages.
Can confirm on Ubuntu 22.04.04.
$ cat /etc/apt/sources.list.d/vscode.list
deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main
Same here, uninstalled, reinstalled with official instructions, failed to fetch due to failed connection (and then it shows me an IPV6 address)
Same here for ubuntu 20.04 lts
E: Failed to fetch https://packages.microsoft.com/repos/code/pool/main/c/code/code_1.87.2-1709912201_amd64.deb Connection failed [IP: 13.107.213.57 443]
Sometime within the past few days, this error was resolved for both my Ubuntu and Pop!_OS boxes. I did not try the workaround nor any other hack; the apt fetch just started working.
I had the same problem, after shutting down my wireguard tunnel all working fine
❯ curl -vvvv https://packages.microsoft.com
* processing: https://packages.microsoft.com
* Trying 13.107.246.44:443...
* Connected to packages.microsoft.com (13.107.246.44) port 443
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=packages.microsoft.com
* start date: May 16 05:33:26 2024 GMT
* expire date: May 11 05:33:26 2025 GMT
* subjectAltName: host "packages.microsoft.com" matched cert's "packages.microsoft.com"
* issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 03
* SSL certificate verify ok.
* using HTTP/2
* h2 [:method: GET]
* h2 [:scheme: https]
* h2 [:authority: packages.microsoft.com]
* h2 [:path: /]
* h2 [user-agent: curl/8.2.1]
* h2 [accept: */*]
* Using Stream ID: 1
> GET / HTTP/2
> Host: packages.microsoft.com
> User-Agent: curl/8.2.1
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200
< date: Sat, 01 Jun 2024 23:37:44 GMT
< content-type: text/html
< content-length: 2504
< strict-transport-security: max-age=31536000; includeSubDomains
< x-content-type-options: nosniff
< x-azure-ref: 20240601T233744Z-164d49668c69mpvtcmhn6th7ts00000003v000000000ryzy
< cache-control: public, max-age=15552000
< x-fd-int-roxy-purgeid: 66946190
< x-cache: TCP_HIT
< accept-ranges: bytes
<
<html>
<head><title>Index of /</title></head>
<body bgcolor="white">
<h1>Index of /</h1>
<hr><pre>
<a href="alma/">alma/</a>
<a href="amazonlinux/">amazonlinux/</a>
<a href="azurelinux/">azurelinux/</a>
<a href="cbl-mariner/">cbl-mariner/</a>
<a href="centos/">centos/</a>
<a href="clamav/">clamav/</a>
<a href="config/">config/</a>
<a href="debian/">debian/</a>
<a href="docs/">docs/</a>
<a href="fedora/">fedora/</a>
<a href="info/">info/</a>
<a href="keys/">keys/</a>
<a href="opensuse/">opensuse/</a>
<a href="repos/">repos/</a>
<a href="rhel/">rhel/</a>
<a href="rocky/">rocky/</a>
<a href="sles/">sles/</a>
<a href="ubuntu/">ubuntu/</a>
<a href="yumrepos/">yumrepos/</a>
</pre><hr></body>
* Connection #0 to host packages.microsoft.com left intact
</html>
Thanks for documenting the exact byte counts and package URL. Closing this as no longer reproducible on the tested IPv4 path. I used Debian 12.5 amd64, its original APT 2.6.1, and the same packages.microsoft.com/repos/code package from the report—not the alternate download service.
- APT upgrade, 1.87.1 → 1.87.2: With an empty package cache and retries disabled, APT installed
code=1.87.2-1709912201. One HTTPS GET returned HTTP 200 and all 99,932,898 bytes, with no resume request. The SHA-256 matched the signed APT index. - Original curl and wget checks: HTTP/2 curl with zero retries and
wget -t 1both downloaded the complete package, past the reported 32 MiB and 72 MiB cutoffs. The IPv4 address from another March 2024 failure also served the full file with a valid certificate and matching hash. - Current Insiders: The same APT client downloaded and installed
1.149.0-insider(ece165ef): 287,621,406 bytes, one HTTP 200, matching the signed index.
To recheck without installing or downgrading VS Code: With the official Microsoft APT repository configured and its package lists up to date, run these from an empty, writable directory:
apt-get -o Acquire::Retries=0 download code=1.87.2-1709912201
wc -c code_1.87.2-1709912201_amd64.deb
sha256sum code_1.87.2-1709912201_amd64.deb
Expected: 99932898 bytes and SHA-256 3340b2649e486adfde2452418599acb64c1dc3998087d715d244f10302a89b94.
IPv6 DNS is tracked separately in #212682. That report concerns resolving update.code.visualstudio.com with an IPv6-only DNS resolver, before a download starts. Here, packages.microsoft.com had already resolved and the transfer stopped partway through. The original reporter used IPv6; this test host could not establish IPv6 connections to either Microsoft or an unrelated Debian mirror, so this is not verification of that route or a claim about the historical cause. An affected user also reported recovery without a workaround in March 2024.
If a fresh download still stops partway through, please share the APT error, the byte count, and whether it used IPv4 or IPv6 so we can reopen. The recording below shows the Debian replay.
https://github.com/user-attachments/assets/b4c9f7a1-0eb4-422a-994a-ee241c3da75c