我正在尝试使用以下命令更新存储库但失败了:
sudo apt-get update
以下是上述命令的输出:
Hit http://dl.google.com stable Release.gpg
Hit http://deb.opera.com stable Release.gpg
Hit http://liveusb.info all Release.gpg
Hit http://dl.google.com stable Release
Hit http://deb.opera.com stable Release
Hit http://liveusb.info all Release
Hit http://dl.google.com stable/main i386 Packages
Hit http://repo.mysql.com wheezy Release.gpg
Hit http://linux.dropbox.com wheezy Release.gpg
Hit http://deb.opera.com stable/non-free i386 Packages
Hit http://liveusb.info all/main i386 Packages
Hit http://security.debian.org wheezy/updates Release.gpg
Get:1 http://http.debian.net wheezy Release.gpg [1,655 B]
Hit http://linux.dropbox.com wheezy Release
Hit http://security.debian.org wheezy/updates Release
Hit http://repo.mysql.com wheezy Release
Hit http://linux.dropbox.com wheezy/main i386 Packages
Hit http://security.debian.org wheezy/updates/main i386 Packages
Get:2 http://http.debian.net wheezy Release [168 kB]
Hit http://repo.mysql.com wheezy/mysql-apt-config i386 Packages
Hit http://security.debian.org wheezy/updates/main Translation-en
Ign http://dl.google.com stable/main Translation-en_US
Ign http://deb.opera.com stable/non-free Translation-en_US
Ign http://dl.google.com stable/main Translation-en
Ign http://liveusb.info all/main Translation-en_US
Ign http://deb.opera.com stable/non-free Translation-en
Ign http://liveusb.info all/main Translation-en
Get:3 http://http.debian.net wheezy/main i386 Packages [5,858 kB]
Ign http://linux.dropbox.com wheezy/main Translation-en_US
Ign http://linux.dropbox.com wheezy/main Translation-en
Get:4 http://http.debian.net wheezy/main Translation-en [3,846 kB]
Ign http://repo.mysql.com wheezy/mysql-apt-config Translation-en_US
Ign http://repo.mysql.com wheezy/mysql-apt-config Translation-en
Err http://http.debian.net wheezy-updates Release.gpg
Cannot initiate the connection to ftp.tr.debian.org:80 (2001:a98:11::100). - connect (101: Network is unreachable) [IP: 2001:a98:11::100 80]
Get:5 http://http.debian.net wheezy-updates Release [124 kB]
Err http://http.debian.net wheezy-updates/main Translation-en
Err http://http.debian.net wheezy-updates/main Translation-en
Get:6 http://http.debian.net wheezy-updates/main i386 Packages [3,397 B]
Err http://http.debian.net wheezy-updates/main Translation-en
Err http://http.debian.net wheezy-updates/main Translation-en
Err http://http.debian.net wheezy-updates/main Translation-en
Cannot initiate the connection to ftp.tr.debian.org:80 (2001:a98:11::100). - connect (101: Network is unreachable) [IP: 2001:a98:11::100 80]
Fetched 10.0 MB in 1min 5s (152 kB/s)
W: Failed to fetch http://http.debian.net/debian/dists/wheezy-updates/Release.gpg Cannot initiate the connection to ftp.tr.debian.org:80 (2001:a98:11::100). - connect (101: Network is unreachable) [IP: 2001:a98:11::100 80]
W: Failed to fetch http://http.debian.net/debian/dists/wheezy-updates/main/i18n/Translation-en Cannot initiate the connection to ftp.tr.debian.org:80 (2001:a98:11::100). - connect (101: Network is unreachable) [IP: 2001:a98:11::100 80]
E: Some index files failed to download. They have been Ignored, or old ones used instead.
以下是我的 /etc/apt/sources.list
# deb cdrom:[Debian GNU/Linux 7 _Wheezy_ - Official Snapshot i386 LIVE/INSTALL Binary 20140716-13:13]/ wheezy contrib main contrib non-free non-free
deb http://http.debian.net/debian wheezy main contrib non-free
deb-src http://http.debian.net/debian wheezy main contrib non-free
deb http://http.debian.net/debian wheezy-updates main contrib non-free
deb-src http://http.debian.net/debian wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src ftp://ftp2.de.debian.org/debian/ wheezy/updates main contrib non-free
## Depôt MultiSystem
deb http://liveusb.info/multisystem/depot all main
# deb http://http.us.debian.org/debian/ wheezy contrib non-free main
答案1
看起来是 ipv6 问题。第一种方法是创建一个文件/etc/apt/apt.conf.d/99force-ipv4
并添加此行Acquire::ForceIPv4 "true";
,这将强制 apt 使用 ipv4。另一种次要方法是添加precedence ::ffff:0:0/96 100
到/etc/gai.conf