E: 无法下载 https://download.docker.com/linux/ubuntu/dists/Xenial/stable/binary-amd64/Packages 404 Not Found

在ubuntu16.04上安装Docker Engine时出错

在ubuntu16.04上安装Docker Engine时出错,在官网https://docs.docker.com/engine/install/ubuntu/
链接: https://docs.docker.com/engine/install/ubuntu/.
使用以下命令后

 echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

接着往下面运行

sudo apt-get update

时出现以下报错

E: 无法下载 https://download.docker.com/linux/ubuntu/dists/Xenial/stable/binary-amd64/Packages 404 Not Found

部分终端中的信息如下:

命中:1 http://packages.osrfoundation.org/gazebo/ubuntu xenial InRelease
命中:2 https://mirrors.ustc.edu.cn/ubuntu xenial InRelease                     
命中:3 https://mirrors.ustc.edu.cn/ubuntu xenial-updates InRelease     
命中:4 https://mirrors.ustc.edu.cn/ubuntu xenial-backports InRelease   
命中:5 https://mirrors.ustc.edu.cn/ubuntu xenial-security InRelease    
命中:6 http://packages.ros.org/ros/ubuntu xenial InRelease            
命中:7 http://ppa.launchpad.net/thopiekar/mt7601/ubuntu xenial InRelease
命中:8 http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu xenial InRelease
忽略:9 https://download.docker.com/linux/ubuntu Xenial InRelease               
命中:10 http://ppa.launchpad.net/zarquon42/meshlab/ubuntu xenial InRelease
忽略:11 https://download.docker.com/linux/ubuntu Xenial Release
忽略:12 https://download.docker.com/linux/ubuntu Xenial/stable amd64 Packages
忽略:13 https://download.docker.com/linux/ubuntu Xenial/stable all Packages
忽略:14 https://download.docker.com/linux/ubuntu Xenial/stable Translation-zh_CN
忽略:15 https://download.docker.com/linux/ubuntu Xenial/stable Translation-zh
忽略:16 https://download.docker.com/linux/ubuntu Xenial/stable Translation-en
忽略:17 https://download.docker.com/linux/ubuntu Xenial/stable amd64 DEP-11 Metadata
忽略:18 https://download.docker.com/linux/ubuntu Xenial/stable DEP-11 64x64 Icons
忽略:12 https://download.docker.com/linux/ubuntu Xenial/stable amd64 Packages
忽略:13 https://download.docker.com/linux/ubuntu Xenial/stable all Packages
忽略:14 https://download.docker.com/linux/ubuntu Xenial/stable Translation-zh_CN
忽略:15 https://download.docker.com/linux/ubuntu Xenial/stable Translation-zh
忽略:16 https://download.docker.com/linux/ubuntu Xenial/stable Translation-en
忽略:17 https://download.docker.com/linux/ubuntu Xenial/stable amd64 DEP-11 Metadata
忽略:18 https://download.docker.com/linux/ubuntu Xenial/stable DEP-11 64x64 Icons
忽略:12 https://download.docker.com/linux/ubuntu Xenial/stable amd64 Packages
忽略:13 https://download.docker.com/linux/ubuntu Xenial/stable all Packages
忽略:14 https://download.docker.com/linux/ubuntu Xenial/stable Translation-zh_CN
忽略:15 https://download.docker.com/linux/ubuntu Xenial/stable Translation-zh
忽略:16 https://download.docker.com/linux/ubuntu Xenial/stable Translation-en
忽略:17 https://download.docker.com/linux/ubuntu Xenial/stable amd64 DEP-11 Metadata
忽略:18 https://download.docker.com/linux/ubuntu Xenial/stable DEP-11 64x64 Icons
忽略:12 https://download.docker.com/linux/ubuntu Xenial/stable amd64 Packages

从中可以看出是由于https://download.docker.com此网站添加到了软件源列表中,访问它时,从而引起的报错,那么再把它从软件源列表中删除掉,找一篇博客,照着重新从头再安装一次Docker Engine就好了。

一、先用常规解决办法

1、在“设置”里的软件与更新中将https://download.docker.com此网站前面的对勾取消掉或者直接将此网站“删除”,发现仍然报同样的错误,说明没有彻底清理干净。

2、参考其他博客,采用编辑修改source.list的方法,发现由于上一步的操作,source.list中已经没有此网站,也就无从改起。

3、参考其他博客,将目录下var/lib/apt/lists下的以download.docker开头的两个文件删除,提升权限并使用强制删除命令删除

sudo su
rm -f download.docker.com_linux_ubuntu_dists_xenial_stable_binary-amd64_Packages 
rm -f download.docker.com_linux_ubuntu_dists_xenial_InRelease

接着往下面运行

sudo apt-get update

仍然报错…

说明还有没有删掉的。

二、漏网之鱼(仍没有删掉的两个文件)

etc/apt/sources.list.d中存在两个文件 docker.list以及docker.list.save,仿照前面的操作将其强制删除即可。

sudo su
rm -f docker.list
rm -f docker.list.save

三、结果

做完以上操作之后,再次运行

sudo apt-get update

没有报错,问题解决。

yyd@yyd-linux:/etc/apt/sources.list.d$ sudo apt-get update
命中:1 https://mirrors.ustc.edu.cn/ubuntu xenial InRelease
命中:2 https://mirrors.ustc.edu.cn/ubuntu xenial-updates InRelease             
命中:3 https://mirrors.ustc.edu.cn/ubuntu xenial-backports InRelease           
命中:4 https://mirrors.ustc.edu.cn/ubuntu xenial-security InRelease            
命中:5 http://ppa.launchpad.net/thopiekar/mt7601/ubuntu xenial InRelease       
命中:6 http://packages.ros.org/ros/ubuntu xenial InRelease                     
命中:7 http://packages.osrfoundation.org/gazebo/ubuntu xenial InRelease        
命中:8 http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu xenial InRelease
命中:9 http://ppa.launchpad.net/zarquon42/meshlab/ubuntu xenial InRelease      
正在读取软件包列表... 完成  
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐