ubuntu apt-get install 报错:Reading package lists... Error!【每当浪潮来临的时候,你会不会感到伤心】

症状1>> apt-get install 报错 Reading package lists… Error! E: Encountered a section with no Package: header

症状1>> apt-get update 报错 Err:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease

症状1>> apt-get update 报错 Err:1 国内地址 xenial InRelease

首先说症状1,我想安装某个软件,出这个错误,说明找不到pkgs,得更新一下源

执行命令:
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
如果还解决不了就有可能是症状2/3

症状2,直接换源即可

sudo vi /etc/apt/sources.list
在所有源的最上面添加上国内源

网易源
deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
阿里源
deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

症状3:DNS错误

修改DNS
vi /etc/resolvconf/resolv.conf.d/base
写上
nameserver 8.8.8.8
nameserver 8.8.4.4
保存退出

猜你喜欢

转载自blog.csdn.net/magic_shuang/article/details/106801131