浏览这些论坛和其他地方,我发现这是一个常见问题,但提出的解决方案并没有帮助,因此我询问,希望有人能够找到正确的解决方案。
我有一台旧的 IBM M2 服务器,安装了 Ubuntu 20.04。我测试过我可以使用curl
和ping
连接到不同的来源,比如 Google,而且运行良好。我的服务器可以清楚地看到互联网。但是我无法 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.
我没有设置任何代理。此服务器运行的是出厂设置,所以我很困惑为什么apt-get update
(而且apt-get install
似乎也有类似的问题)它就是不工作。
有任何想法吗?
答案1
事实证明,这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
最后:
sudo apt update