ubuntu sudo apt-get更新连接超时[已关闭]

wfveoks0  于 2022-12-17  发布在  其他
关注(0)|答案(1)|浏览(458)

**已关闭。**此问题为not about programming or software development。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
昨天关门了。
Improve this question
在Ubuntu 20.04.3 LTS(GNU/Linux 5.4.0-89-generic x86_64)-数据中心的虚拟机上,我尝试使用apt-get update在我的服务器上安装新包,但无法使用。
我有这个错误:

Err:1 http://archive.canonical.com/ubuntu focal InRelease
  Could not connect to archive.canonical.com:80 (91.189.92.150), connection timed out Could not connect to archive.canonical.com:80 (91.189.92.191), connection timed out Could not connect to archive.canonical.com:80 (91.189.91.15), connection timed out
Err:2 http://la.archive.ubuntu.com/ubuntu focal InRelease
  Could not connect to la.archive.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to la.archive.ubuntu.com:80 (91.189.88.142), connection timed out Could not connect to la.archive.ubuntu.com:80 (91.189.91.39), connection timed out Could not connect to la.archive.ubuntu.com:80 (91.189.91.38), connection timed out
Err:3 http://la.archive.ubuntu.com/ubuntu focal-updates InRelease
  Unable to connect to la.archive.ubuntu.com:http:
Err:4 http://la.archive.ubuntu.com/ubuntu focal-backports InRelease
  Unable to connect to la.archive.ubuntu.com:http:
Err:5 http://la.archive.ubuntu.com/ubuntu focal-security InRelease
  Unable to connect to la.archive.ubuntu.com:http:

我的存储库如下:

deb http://la.archive.ubuntu.com/ubuntu focal main restricted
deb-src http://la.archive.ubuntu.com/ubuntu focal main restricted
deb http://la.archive.ubuntu.com/ubuntu focal-updates main restricted
deb-src http://la.archive.ubuntu.com/ubuntu focal-updates main restricted
deb http://la.archive.ubuntu.com/ubuntu focal universe
deb-src http://la.archive.ubuntu.com/ubuntu focal universe
deb http://la.archive.ubuntu.com/ubuntu focal-updates universe
deb-src http://la.archive.ubuntu.com/ubuntu focal-updates universe
deb http://la.archive.ubuntu.com/ubuntu focal multiverse
deb-src http://la.archive.ubuntu.com/ubuntu focal multiverse
deb http://la.archive.ubuntu.com/ubuntu focal-updates multiverse
deb-src http://la.archive.ubuntu.com/ubuntu focal-updates multiverse
deb http://la.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb-src http://la.archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner
deb http://la.archive.ubuntu.com/ubuntu focal-security main restricted
deb-src http://la.archive.ubuntu.com/ubuntu focal-security main restricted
deb http://la.archive.ubuntu.com/ubuntu focal-security universe
deb-src http://la.archive.ubuntu.com/ubuntu focal-security universe
deb http://la.archive.ubuntu.com/ubuntu focal-security multiverse
deb-src http://la.archive.ubuntu.com/ubuntu focal-security multiverse

我停用IPv6,因为我遇到错误:101网络不可达。为此,我修改了/etc/sysctl.conf并添加了以下行:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

当我ping google时,我得到了这样的回应(我想我没有使用代理,因为172.217.31.78是一个公共地址):

64 bytes from kul08s07-in-f14.1e100.net (172.217.31.78): icmp_seq=1 ttl=115 time=60.1 ms
--- google.com ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7010ms

同样,如果我ping la.archive.ubuntu.com:80(91.189.91.38),我发送的所有包都会收到。
为什么我不能连接到ubuntu仓库?我发现我的端口80被关闭了,是这个原因吗?

insrf1ej

insrf1ej1#

我也遇到过类似的问题,结果发现apt配置中有一个不工作的代理规则,导致了超时问题。检查/etc/apt/apt.conf.d/下的配置文件,查找包含以Acquire::https::ProxyAquire::http::Proxy开头的行的文件(或者只搜索Proxy),如果找到任何行,则暂时将其注解掉。
您可能知道这一点,但是不要忘记在尝试安装命令之前运行apt update
此外,对于源代码,常规的archive.ubuntu.com/ubuntu应该可以正常工作。

相关问题