这就是我的问题。我知道这个问题已经被多次报道过了,但不知何故,它有点不同。
我在虚拟机上使用 Linux Ubuntu 20.04 LTS,并且能够成功安装映像,没有任何问题。
syspass@syspass:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
现在,我尝试更新 repo 以便能够安装一些软件包,我需要这些软件包才能在机器上部署一些系统。但是,由于Connection Error
syspass@syspass:~$ sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Connection failed [IP: 91.189.88.152 80]
Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Connection failed [IP: 91.189.88.152 80]
Err:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Connection failed [IP: 91.189.88.152 80]
Err:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
Connection failed [IP: 91.189.88.152 80]
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Connection failed [IP: 91.189.88.152 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-security/InRelease Connection failed [IP: 91.189.88.152 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
因此,我进行了一些挖掘,发现该 IP 地址确实可以从 VM 访问(注意:出于安全目的,网络上的 ping 被阻止)
syspass@syspass:~$ nslookup archive.ubuntu.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: archive.ubuntu.com
Address: 91.189.88.142
Name: archive.ubuntu.com
Address: 91.189.88.152
Name: archive.ubuntu.com
Address: 2001:67c:1360:8001::23
Name: archive.ubuntu.com
Address: 2001:67c:1360:8001::24
syspass@syspass:/var/tmp$ tracepath -4 -b archive.ubuntu.com
1?: [LOCALHOST] pmtu 1500
1: _gateway (10.8.4.254) 1.047ms
1: _gateway (10.8.4.254) 1.068ms
2: 10.8.6.1 (10.8.6.1) 1.030ms
3: 10.8.5.2 (10.8.5.2) 1.446ms
4: 10.2.240.254 (10.2.240.254) 2.673ms
5: no reply
6: no reply
7: 197.246.5.49 (197.246.5.49) 11.161ms pmtu 1492
7: no reply
8: no reply
9: no reply
10: no reply
11: no reply
12: no reply
13: no reply
14: actiontoad.canonical.com (91.189.88.152) 131.035ms reached
Resume: pmtu 1492 hops 14 back 14
因此,我决定进一步挖掘,发现所需的资源确实可以到达!
syspass@syspass:~$ wget http://archive.ubuntu.com/ubuntu/dists/focal/InRelease
--2020-12-08 09:39:29-- http://archive.ubuntu.com/ubuntu/dists/focal/InRelease
Resolving archive.ubuntu.com (archive.ubuntu.com)... 91.189.88.152, 91.189.88.142, 2001:67c:1360:8001::24, ...
Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.88.152|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 264892 (259K)
Saving to: ‘InRelease’
InRelease 100%[=============================================================>] 258.68K 345KB/s in 0.8s
2020-12-08 09:39:30 (345 KB/s) - ‘InRelease’ saved [264892/264892]
syspass@syspass:~$ curl -vvv http://archive.ubuntu.com/ubuntu/dists/focal/InRelease --HEAD
* Trying 91.189.88.142:80...
* TCP_NODELAY set
* Connected to archive.ubuntu.com (91.189.88.142) port 80 (#0)
> HEAD /ubuntu/dists/focal/InRelease HTTP/1.1
> Host: archive.ubuntu.com
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Tue, 08 Dec 2020 09:42:06 GMT
Date: Tue, 08 Dec 2020 09:42:06 GMT
< Server: Apache/2.4.29 (Ubuntu)
Server: Apache/2.4.29 (Ubuntu)
< Last-Modified: Thu, 23 Apr 2020 17:34:17 GMT
Last-Modified: Thu, 23 Apr 2020 17:34:17 GMT
< ETag: "40abc-5a3f8a874d840"
ETag: "40abc-5a3f8a874d840"
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Content-Length: 264892
Content-Length: 264892
< Cache-Control: max-age=0, proxy-revalidate
Cache-Control: max-age=0, proxy-revalidate
< Expires: Tue, 08 Dec 2020 09:42:06 GMT
Expires: Tue, 08 Dec 2020 09:42:06 GMT
<
* Connection #0 to host archive.ubuntu.com left intact
我的/etc/apt/sources.list文件也在下面,以防万一有帮助:
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu focal main restricted
# deb-src http://archive.ubuntu.com/ubuntu focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu focal universe
# deb-src http://archive.ubuntu.com/ubuntu focal universe
deb http://archive.ubuntu.com/ubuntu focal-updates universe
# deb-src http://archive.ubuntu.com/ubuntu focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu focal multiverse
# deb-src http://archive.ubuntu.com/ubuntu focal multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu focal-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
答案1
经过深入调查,我发现 apt-get 在外围防火墙上被阻止了。允许 apt-get 应用程序的流量后,一切正常。