所以我刚刚对 Linux Mint 20 进行了全新安装,但这个问题在 Linux Mint 19.3 中也存在。每次我尝试从软件管理器执行apt-get update
或apt-get upgrade
什至下载软件时,都会出现错误。当我尝试更新更新管理器推荐的内容时,发生了同样的事情。
我发现如果我sudo apt-get update/upgrade
在每次失败的尝试后继续运行该命令,我可以升级或更新。由于每次更新/升级都以一定的百分比停止,当我再次运行该命令时,它会从相同的百分比继续,并通过执行几次更新/升级最终完成。
这是我尝试从软件管理器下载 VLC 时遇到的错误。它首先说:
Failed to download package files
Check your Internet connection.
详细信息是:
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/s/sdl-image1.2/libsdl-image1.2_1.2.12-12_amd64.deb Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.88.152), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.88.142), connection timed out [IP: 91.189.88.142 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/s/sidplay-libs/libsidplay2_2.1.1-15ubuntu2_amd64.deb Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) [IP: 91.189.88.142 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/libs/libspatialaudio/libspatialaudio0_0.3.0+git20180730+dfsg1-2build1_amd64.deb Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) [IP: 91.189.88.142 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/s/srt/libsrt1_1.4.0-1build1_amd64.deb Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) [IP: 91.189.88.142 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/libs/libssh2/libssh2-1_1.8.0-2.1build1_amd64.deb Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) [IP: 91.189.88.142 80]
Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/p/pupnp-1.8/libupnp13_1.8.4-2ubuntu2_amd64.deb Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Cannot initiate the connection to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) [IP: 91.189.88.142 80]
...等等。
error 随处可见的两个具体误差值是2001:67c:1360:8001::23
和91.189.88.152
。我的机器现在使用的软件源是:
(Main) http://packages.linuxmint.com
(Focal) http://archive.ubuntu.com/ubuntu
我尝试将焦点源更改为许多不同的源,但没有成功。我什至搞乱了之前source.list
的文件/etc/apt/source.list.d
,并且由于许多问题而不得不重新安装 Linux。所以我真的不知道在这里该怎么办,并且发现很多其他人也有同样的问题。
答案1
这看起来像是 IPv6 堆栈配置错误。 Linux 认为它有 IPv6 并尝试使用它(实际上更喜欢它)进行连接。
您可以强制apt-get
使用 IPv4 添加-o Acquire::ForceIPv4=true
。例如:
$ sudo apt-get -o Acquire::ForceIPv4=true update
如果您想让该选项永久存在,您可以将其添加到 中的文件中/etc/apt/apt.conf.d/
,例如内部/etc/apt/apt.conf.d/99only-ipv4
:
Acquire::ForceIPv4 "true";