Ubuntu16.04之sudo apt-get update报错终极解决方案

错误起源

想要为新建的ubuntu16.04虚拟机安装一个VLC播放器,于是有了如下操作:

 sudo add-apt-repository ppa:n-muench/vlc
 sudo apt-get update 
 sudo apt-get install vlc

一顿操作猛如虎,apt-get update就报了超多错,出现了如下字样:

Reading package lists... Error!

解决方案

我在网上找到很多解决办法,统统尝试了一遍:

方法1:更新软件源------失败

sudo gedit /etc/apt/sources.list
sudo apt-get update

方法2:删除一些文件------失败           此方法慎用!!!

1 sudo rm /var/lib/apt/lists/* -vf
2 sudo apt-get update

具体解决:
run these two commands and it should get you fixed up.

The first command will remove the damaged list and when you run the second command it will replace it with a new list.

不知道莫名其妙地删掉了些啥,引起其他报错...

方法3:针对“404无法找到”错误,移除找不到的仓库------失败 

sudo apt-get update | grep "Failed"

输入以上命令,出现更新失败的源和包:

W: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/precise/main/source/Sources 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found

移除对应包,再重新sudo apt-get update

sudo add-apt-repository --remove ppa:finalterm/daily

ps:这个方法也失败了!!!哭晕在厕所.....开始产生自我怀疑...

方法4:打蛇打七寸,解铃还须系铃人——找到形成错误的根源,然后重新复现一次错误

我发现,重新添加了一次vlc库,也就是本篇文章最开始的这几条命令

 sudo add-apt-repository ppa:n-muench/vlc
 sudo apt-get update 
 sudo apt-get install vlc

在apt-get update之后,神奇地结果出现了!

只要出现Reading package lists...Done

就算有几个软件源链接读取失败,也不妨碍软件下载

所以...这算是解决了apt-get update 的bug了吗。。好随便噢。。。

但是还是有一些指导意义:当我们遇到困难,不要心烦意乱,一定要冷静思考,仔细想想自己遇到的问题根源在哪,而不是无脑百度(不是说百度不好的意思),一定要结合实际问题来解决,相信自己一定能解决!奥里给~

猜你喜欢

转载自blog.csdn.net/Xinyue_Lu/article/details/106886445