最近在玩华为开发板,使用华为源时一直连接不到,报错如下:
(base) root@davinci-mini:~# sudo apt-get update
Hit:1 https://launchpad.proxy.ustclug.org/mozillateam/ppa/ubuntu jammy InRelease
Ign:2 http://mirrors.huaweicloud.com/ubuntu-ports jammy InRelease
Ign:3 http://mirrors.huaweicloud.com/ubuntu-ports jammy-backports InRelease
Ign:4 http://mirrors.huaweicloud.com/ubuntu-ports jammy-proposed InRelease
Ign:5 http://mirrors.huaweicloud.com/ubuntu-ports jammy-security InRelease
Ign:6 http://mirrors.huaweicloud.com/ubuntu-ports jammy-updates InRelease
Ign:2 http://mirrors.huaweicloud.com/ubuntu-ports jammy InRelease
Ign:3 http://mirrors.huaweicloud.com/ubuntu-ports jammy-backports InRelease
Ign:4 http://mirrors.huaweicloud.com/ubuntu-ports jammy-proposed InRelease
Ign:5 http://mirrors.huaweicloud.com/ubuntu-ports jammy-security InRelease
Ign:6 http://mirrors.huaweicloud.com/ubuntu-ports jammy-updates InRelease
Ign:2 http://mirrors.huaweicloud.com/ubuntu-ports jammy InRelease
Ign:3 http://mirrors.huaweicloud.com/ubuntu-ports jammy-backports InRelease
Ign:4 http://mirrors.huaweicloud.com/ubuntu-ports jammy-proposed InRelease
Ign:5 http://mirrors.huaweicloud.com/ubuntu-ports jammy-security InRelease
Ign:6 http://mirrors.huaweicloud.com/ubuntu-ports jammy-updates InRelease
Err:2 http://mirrors.huaweicloud.com/ubuntu-ports jammy InRelease
Could not connect to mirrors.huaweicloud.com:80 (124.70.125.167). - connect (113: No route to host) Could not connect to mirrors.huaweicloud.com:80 (124.70.125.153). - connect (113: No route to host)
Err:3 http://mirrors.huaweicloud.com/ubuntu-ports jammy-backports InRelease
Unable to connect to mirrors.huaweicloud.com:http:
Err:4 http://mirrors.huaweicloud.com/ubuntu-ports jammy-proposed InRelease
Unable to connect to mirrors.huaweicloud.com:http:
Err:5 http://mirrors.huaweicloud.com/ubuntu-ports jammy-security InRelease
Unable to connect to mirrors.huaweicloud.com:http:
Err:6 http://mirrors.huaweicloud.com/ubuntu-ports jammy-updates InRelease
Unable to connect to mirrors.huaweicloud.com:http:
Reading package lists... Done
W: Failed to fetch http://mirrors.huaweicloud.com/ubuntu-ports/dists/jammy/InRelease Could not connect to mirrors.huaweicloud.com:80 (124.70.125.167). - connect (113: No route to host) Could not connect to mirrors.huaweicloud.com:80 (124.70.125.153). - connect (113: No route to host)
W: Failed to fetch http://mirrors.huaweicloud.com/ubuntu-ports/dists/jammy-backports/InRelease Unable to connect to mirrors.huaweicloud.com:http:
W: Failed to fetch http://mirrors.huaweicloud.com/ubuntu-ports/dists/jammy-proposed/InRelease Unable to connect to mirrors.huaweicloud.com:http:
W: Failed to fetch http://mirrors.huaweicloud.com/ubuntu-ports/dists/jammy-security/InRelease Unable to connect to mirrors.huaweicloud.com:http:
W: Failed to fetch http://mirrors.huaweicloud.com/ubuntu-ports/dists/jammy-updates/InRelease Unable to connect to mirrors.huaweicloud.com:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.
试了各种方法一直解决不了,也试过阿里源和清华源等,都不能用,最后发现可能是DNS的问题。
使用root账号登录开发板之后输入:
vim /etc/resolv.conf
按I进行编辑模式,在里面添加192.168.x.x(你登录开发板所用的地址,如192.168.0.2),
nameserver 192.168.10.x
然后按esc,输入:wq,保存退出。
然后执行sudo apt-get update就可以用了。