ubuntu源更新问题的坑

源更新问题我遇到的报错误

以下这两种错误应该都是源出现问题了。
(1)在执行sudo apt-get update的时候报错:

获取:3 http://1.1.1.2/ac_portal/proxy.html?template=disclaimer&tabs=pwd&vlanid=0&url=http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease [2,250 B]
错误:3 http://1.1.1.2/ac_portal/proxy.html?template=disclaimer&tabs=pwd&vlanid=0&url=http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
  明文签署文件不可用,结果为‘NOSPLIT’(您的网络需要认证吗?)
  E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

(2)在执行sudo apt-get install package的时候报类似于这种错误:


获取:1 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.2 [103 kB]
错误:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.2
  Hash 校验和不符
获取:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2 [5,164 kB]
忽略:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates/main i386 vim-runtime all 2:7.4.1689-3ubuntu1.2  

源更新问题我的解决方案

  一定要提前检查ubuntu的版本,这一步很重要,不同版本的ubuntu使用的更新内容有差别。 我就是因为没有这一步,试了网上的好多解决方案都没有成功。比较根据清华源的使用帮助添加链接描述来看:
  16.0.4 LTS对应的sources.list为(请注意网址后的xenial,14.0.4 LTS使用的是trusty,18.0.4LTS使用的是bionic,每个版本的是不一样的,而网上的解决方法各种版本的都有):

# 14.0.4 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse

# 16.0.4 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse

#18.0.4 LTS
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

具体的解决方案

# 检查ubuntu的版本,这一步很重要,不同版本的ubuntu使用的更新内容有差别.
 ~$: cat /etc/issue
 Ubuntu 16.04.5 LTS \n \l
# 备份默认source.list
 ~$: sudo cp /etc/apt/sources.list  /etc/apt/sources.list_save

# 换源
sudo vim /etc/apt/sources.list
# 将源文件里的内容全部替换为如下内容:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# 更新
 ~$: sudo apt-get update

至此,这个问题就解决了。这也太坑了。

学习资料

Guess you like

Origin blog.csdn.net/PAN_Andy/article/details/105053890