首页 > 解决方案 > sudo apt-get 更新连接超时

问题描述

在 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 端口已关闭,这是原因吗?

标签: ubuntunetworkingtimeoutrepositoryapt

解决方案


推荐阅读