服务器上的 Ubuntu 20.04:“apt-get update”报告失败。无法访问 archive.ubuntu.com

Omn*_*Owl 2 server updates apt networking

浏览这些论坛和其他地方,我发现这是一个常见问题,但是提出的解决方案没有帮助,因此我希望有人能够找到正确的解决方案。

我有一台安装了 Ubuntu 20.04 的旧 IBM M2 服务器。我已经测试过我可以使用curl和ping到不同的来源,例如谷歌,效果很好。我的服务器可以清楚地看到互联网。但我无法 ping 通 ubuntu 服务器。

我尝试过ufw启用和禁用,两种方式都是一样的。

当我尝试时出现以下错误sudo apt-get update:

sudo apt-get update
Err:1 http://dk.archive.ubuntu.com/ubuntu focal InRelease
  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable) Could not connect to dk.archive.ubuntu.com:80 (130.225.254.116), connection timed out

Err:2 http://dk.archive.ubuntu.com/ubuntu focal-updates InRelease
  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable)

Err:3 http://dk.archive.ubuntu.com/ubuntu focal-backports InRelease
  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable)

Err:4 http://dk.archive.ubuntu.com/ubuntu focal-security InRelease
  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable)
Reading package lists... Done

W: Failed to fetch http://dk.archive.ubuntu.com/ubuntu/dists/focal/InRelease  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable) Could not connect to dk.archive.ubuntu.com:80 (130.225.254.116), connection timed out

W: Failed to fetch http://dk.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable)

W: Failed to fetch http://dk.archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable)

W: Failed to fetch http://dk.archive.ubuntu.com/ubuntu/dists/focal-security/InRelease  Cannot initiate the connection to dk.archive.ubuntu.com:80 (2001:878:346::116). - connect (101: Network is unreachable)

W: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)

我没有设置任何类型的代理。该服务器正在运行开箱即用的设置,因此我很困惑为什么apt-get update(并且似乎也apt-get install有类似的问题)不起作用。

有任何想法吗?

Omn*_*Owl 5

事实证明,这dk.archive.ubuntu.com是直接无法访问的。我尝试了计算机和服务器等等。因此,在 ping 几个不同的存档后,我手动编辑/etc/apt/sources.list并切换了我的设置以使用en.archive.ubuntu.com服务器,这解决了我的问题。

以下命令会自动将dk.archive.ubuntu.com存档更改为en.archive.ubuntu.com存档:

sudo sed -i 's/dk.archive.ubuntu.com/en.archive.ubuntu.com/g' /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

最后:

sudo apt update
Run Code Online (Sandbox Code Playgroud)