Ubuntu apt update无论使用什么源都出现类似的错误
下面是清华源执行后的情况
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security InRelease
Ign:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security InRelease
Ign:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security InRelease
Ign:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Err:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy InRelease
Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable) Could not connect to mirrors.tuna.tsinghua.edu.cn:443 (101.6.15.130), connection timed out
Err:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates InRelease
Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
Err:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-backports InRelease
Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
Err:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security InRelease
Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
Err:5 http://security.ubuntu.com/ubuntu focal-security InRelease
Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out
Ign:6 http://us.archive.ubuntu.com/ubuntu focal InRelease
Ign:7 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Ign:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:6 http://us.archive.ubuntu.com/ubuntu focal InRelease
Ign:7 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Ign:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Ign:6 http://us.archive.ubuntu.com/ubuntu focal InRelease
Ign:7 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Ign:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Err:6 http://us.archive.ubuntu.com/ubuntu focal InRelease
Could not connect to banjo.canonical.com:80 (91.189.91.38), connection timed out Could not connect to kazooie.canonical.com:80 (91.189.91.39), connection timed out Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
Err:7 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
Err:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy/InRelease Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable) Could not connect to mirrors.tuna.tsinghua.edu.cn:443 (101.6.15.130), connection timed out
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-updates/InRelease Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-backports/InRelease Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
W: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-security/InRelease Cannot initiate the connection to mirrors.tuna.tsinghua.edu.cn:443 (2402:f000:1:400::2). - connect (101: Network is unreachable)
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal/InRelease Could not connect to banjo.canonical.com:80 (91.189.91.38), connection timed out Could not connect to kazooie.canonical.com:80 (91.189.91.39), connection timed out Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to us.archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Cannot initiate the connection to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead
解决方法:
-
添加如下内容
sudo vim /etc/resolv.conf
添加下面3行
nameserver 8.8.8.8
nameserver 127.0.0.1
options edns0
2. 输入Esc,:wq,保存并退出
3. 重启networking
sudo /etc/init.d/networking restart
执行更新命令
sudo apt-get update
本文来自博客园,作者:睿张,转载请注明原文链接:https://www.cnblogs.com/ruizhang0822/p/18593391
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步