运行 apt-get update 时出现 503 错误。Curl 运行正常

运行 apt-get update 时出现 503 错误。Curl 运行正常

我一直在尝试让 apt-get update 适用于使用 Ubuntu 的 20.04 LTS ISO 构建的开箱即用的 Ubuntu 20.04 映像。我不断收到各种 URL 的 503 错误,但 curl 对它们工作正常(200)。我没有使用代理,而且由于 curl 可以正常工作,防火墙似乎不是问题。我进行了一些 tcpdump 来显示正在发生的事情,如下所示。我遗漏了什么吗?

sudo apt-get update
Err:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
  503  Service Unavailable [IP: 91.189.91.39 80]
Err:2 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
  503  Service Unavailable [IP: 91.189.91.39 80]
Err:3 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
  503  Service Unavailable [IP: 91.189.91.38 80]
Err:4 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
  503  Service Unavailable [IP: 91.189.91.38 80]
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal/InRelease  503  Service Unavailable [IP: 91.189.91.39 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  503  Service Unavailable [IP: 91.189.91.39 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  503  Service Unavailable [IP: 91.189.91.38 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal-security/InRelease  503  Service Unavailable [IP: 91.189.91.38 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Curl 工作得很好:

我不得不省略 http,因为我无法在这里发布超过 8 个链接,但它确实存在于我实际运行的 curl 命令中。

curl us.archive.ubuntu.com/ubuntu/dists/focal/InRelease

... 省略输出

tcpdumps

卷曲:

10.10.9.77.36902 > 91.189.91.81.80: Flags [P.], cksum 0x826f (incorrect -> 0x1566), seq 1:114, ack 1, win 502, options [nop,nop,TS val 3647906169 ecr 2825603914], length 113: HTTP, length: 113
        GET /ubuntu/dists/focal/InRelease HTTP/1.1
        Host: in.archive.ubuntu.com
        User-Agent: curl/7.68.0
        Accept: */*

 91.189.91.81.80 > 10.10.9.77.36902: Flags [.], cksum 0x864a (correct), seq 1:1371, ack 114, win 509, options [nop,nop,TS val 2825603964 ecr 3647906169], length 1370: HTTP, length: 1370
        HTTP/1.1 200 OK
        Date: Thu, 26 Oct 2023 14:21:54 GMT
        Server: Apache/2.4.52 (Ubuntu)
        Last-Modified: Thu, 23 Apr 2020 17:34:17 GMT
        ETag: "40abc-5a3f8a877d7a3"
        Accept-Ranges: bytes
        Content-Length: 264892
        Cache-Control: max-age=0, proxy-revalidate, s-maxage=3300
        Expires: Thu, 26 Oct 2023 14:21:54 GMT
        

apt-get:

10.10.9.77.40174 > 91.189.91.38.80: Flags [P.], cksum 0x82b3 (incorrect -> 0x0190), seq 1:225, ack 1, win 502, options [nop,nop,TS val 1453901342 ecr 2918323520], length 224: HTTP, length: 224
        GET /ubuntu/dists/focal/InRelease HTTP/1.1
        Host: us.archive.ubuntu.com
        Cache-Control: max-age=0
        Accept: text/*
        If-Modified-Since: Thu, 23 Apr 2020 17:34:17 GMT
        User-Agent: Debian APT-HTTP/1.3 (2.0.9) non-interactive

10:13:09.797156 IP (tos 0x0, ttl 61, id 12836, offset 0, flags [none], proto TCP (6), length 1416)
    91.189.91.38.80 > 10.10.9.77.40174: Flags [P.], cksum 0x1f11 (correct), seq 1:1377, ack 225, win 502, length 1376: HTTP, length: 1376
        HTTP/1.1 503 Service Unavailable
        Content-Type: text/html; charset=UTF-8
        Content-Length: 2241
        Connection: close
        P3P: CP="CAO PSA OUR"
        Expires: Thu, 01 Jan 1970 00:00:00 GMT
        Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
        Pragma: no-cache

答案1

这是防火墙问题,抱歉我在发帖前没搞清楚。也许这篇文章对遇到同样问题的人有帮助。谢谢大家!

相关内容