我正在尝试使用以下命令更新存储库但失败了:
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
http://http.debian.net不直接提供服务,它只是将您重定向到镜像。它会尝试巧妙地将您发送到“关闭”的镜像。请参阅实际网页http://http.debian.net/了解详情,以及http://rgeissert.blogspot.co.nz/p/httpdebiannet-faq.html了解更多详细信息。
无论哪种方式,问题在于您在尝试时没有与 ftp.tr.debian.org 的 IPv6 连接;可能是镜像已关闭,或者您的 IPv6 网络连接存在问题。
等待一会儿然后重试(希望获得不同的镜像,或者发现瞬态问题已经消失)或者在您的 apt 源中指定一个明确的特定镜像而不是重定向器。
答案2
IPv6
看起来它因为某种原因正在尝试连接:
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)
除非您将此盒子连接到支持 的网络IPv6
,否则它将无法连接到该IPv6
地址。要强制IPv4
,apt-get
请传入选项:-o Acquire::ForceIPv4=true
。
例如:
sudo apt-get -o Acquire::ForceIPv4=true update sudo apt-get -o Acquire::ForceIPv4=true install procps
来源:https://unix.stackexchange.com/a/100887/7688
免责声明: 我不是 Debian 的用户(更熟悉 Ubuntu / RHEL / CentOS),所以我不确定 Debian 为何默认使用IPv6
,但除非大多数 ISP 支持此功能,否则它肯定不会起作用。您可能想弄清楚如何IPv4
暂时将系统设置为首选。我尝试在 Debian Wheezy VM 上设置它,但效果有限。似乎覆盖IPv4
/IPv6
优先级的方法是使用/etc/gai.conf
:
取消注释precedence ::ffff:0:0/96 100
以下行/etc/gai.conf
:
sed -i -e 's|^#precedence ::ffff:0:0/96 100|precedence ::ffff:0:0/96 100|' /etc/gai.conf