本文主要是介绍ubuntu18.04 apt update失败问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题现象
Err:1 http://us.mirrors.ustc.edu.cn/ubuntu bionic InReleaseConnection failed [IP: 202.141.176.110 80]Err:2 http://us.mirrors.ustc.edu.cn/ubuntu bionic-updates InReleaseConnection failed [IP: 202.141.176.110 80]Err:3 http://us.mirrors.ustc.edu.cn/ubuntu bionic-backports InReleaseConnection failed [IP: 202.141.176.110 80]Hit:4 http://security.ubuntu.com/ubuntu bionic-security InReleaseReading package lists... DoneBuilding dependency treeReading state information... Done186 packages can be upgraded. Run 'apt list --upgradable' to see them.W: Failed to fetch http://us.mirrors.ustc.edu.cn/ubuntu/dists/bionic/InRelease Connection failed [IP: 202.141.176.110 80]W: Failed to fetch http://us.mirrors.ustc.edu.cn/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 202.141.176.110 80]W: Failed to fetch http://us.mirrors.ustc.edu.cn/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 202.141.176.110 80]W: Some index files failed to download. They have been ignored, or old ones used instead.
看了某大佬的博客,发现是ubuntu的源有问题,更换成阿里云的源,果然可以使用了
具体步骤:1.sudo vi /etc/apt/sources.list ,(保险起见备份该文件)替换内容如下
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse#centos源(放心使用):deb http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiversedeb http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiversedeb http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiversedeb http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiversedeb http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiversedeb-src http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiversedeb-src http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiversedeb-src http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiversedeb-src http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiversedeb-src http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse
2.保存,退出,重新sudo apt update
/etc/resolv.conf 里面添加这个服务地址
nameserver 127.0.0.53
或者 nameserver 8.8.8.8
18.10版本可以使用下面的源
# 默认注释了源码镜像以提高 apt update 速度(未认证)
deb http://old-releases.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-backports main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-security main restricted universe multiverse# 预发布软件源(可有可无)
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse~
https://blog.csdn.net/weixin_38707040/article/details/97133100?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
这篇关于ubuntu18.04 apt update失败问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!