Ubuntu18.04 apt-getupdate 遇到问题解决

#sudo apt-get update
遇到错误
Err:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
Could not resolve ‘mirrors.aliyun.com’
Err:2 http://archive.ubuntukylin.com:10006/ubuntukylin xenial InRelease
Could not resolve ‘archive.ubuntukylin.com’
Err:3 http://mirrors.aliyun.com/ubuntu xenial-security InRelease
Could not resolve ‘mirrors.aliyun.com’
Err:4 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
Could not resolve ‘mirrors.aliyun.com’
Err:5 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease
Could not resolve ‘mirrors.aliyun.com’
Err:6 http://mirrors.aliyun.com/ubuntu xenial-proposed InRelease
Could not resolve ‘mirrors.aliyun.com’
Err:7 http://old-releases.ubuntu.com/ubuntu jaunty InRelease
Could not resolve ‘old-releases.ubuntu.com’
Reading package lists… Done
W: Failed to fetch http://old-releases.ubuntu.com/ubuntu/dists/jaunty/InRelease Could not resolve ‘old-releases.ubuntu.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial/InRelease Could not resolve ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-security/InRelease Could not resolve ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-updates/InRelease Could not resolve ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-backports/InRelease Could not resolve ‘mirrors.aliyun.com’
W: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/xenial-proposed/InRelease Could not resolve ‘mirrors.aliyun.com’
W: Failed to fetch http://archive.ubuntukylin.com:10006/ubuntukylin/dists/xenial/InRelease Could not resolve ‘archive.ubuntukylin.com’
W: Some index files failed to download. They have been ignored, or old ones used instead.
显示为无法解析地址:
检查/etc/resolv.conf,发现之前修改的nameserver总是会被修改为127.0.0.53,无论是改成啥,过段时间,总会变回来。
查看/etc/resolv.conf这个文件
This file is managed by man:systemd-resolved(8). Do not edit.
这说明这个文件是被systemd-resolved这个服务托管的
用命令 sudo vi /etc/systemd/resolved.conf
[Resolve]
DNS=8.8.8.8 223.5.5.5 223.6.6.6
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

修改DNS 如上,保存退出
sudo systemctl restart systemd-resolved.service // 重启systemd-resolved
若更新apt-get 比较快 可以更新 阿里源list

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

之后 就可以
刷新列表了
sudo apt-get update
问题解决

你可能感兴趣的:(linux)