root@dusays:~# apt update Err:1http://archive.ubuntu.com/ubuntu bionic InRelease Temporary failure resolving 'archive.ubuntu.com' Err:2http://security.ubuntu.com/ubuntu bionic-security InRelease Temporary failure resolving 'security.ubuntu.com' Err:3http://archive.canonical.com/ubuntu bionic InRelease Temporary failure resolving 'archive.canonical.com' Err:4http://archive.ubuntu.com/ubuntu bionic-updates InRelease Temporary failure resolving 'archive.ubuntu.com' Reading package lists... Done Building dependency tree... Done All packages are up to date. W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com' W: Failed to fetch http://archive.canonical.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.canonical.com' W: Some index files failed to download. They have been ignored, or old ones used instead.
测了一下网络的连通性,没有任何问题,可以与 DNS 服务器正常通信:
1 2 3 4 5 6 7 8 9 10 11
root@dusays:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=1.53 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=1.52 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=1.56 ms 64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=1.57 ms 64 bytes from 8.8.8.8: icmp_seq=5 ttl=118 time=1.55 ms ^C --- 8.8.8.8 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 1.522/1.551/1.575/0.040 ms
又使用杜老师的博客域名做了下测试,果然又报错了,几乎可以确定是 DNS 问题:
1 2
root@dusays:~# ping dusays.com ping: dusays.com: Temporary failure in name resolution
查看一下通用 DNS 服务器配置文件,发现该文件已被 systemd-resolved 服务替代,看来需要激活 systemd-resolved 才可以:
1 2 3 4 5
root@dusays:~# cat /etc/resolv.conf # Dynamic resolv.conf(5) filefor glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILEBY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # 127.0.0.53 is the systemd-resolved stub resolver. # run"systemd-resolve --status" to see details about the actual nameservers.