![安装包时未找到 404](https://linux22.com/image/1150530/%E5%AE%89%E8%A3%85%E5%8C%85%E6%97%B6%E6%9C%AA%E6%89%BE%E5%88%B0%20404.png)
我有一个到目前为止运行良好的脚本,突然我收到以下消息:
Get:81 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-software-properties all 0.96.20.7 [20.7 kB]
Get:82 http://archive.ubuntu.com/ubuntu xenial/main amd64 python3-pycurl amd64 7.43.0-1ubuntu1 [42.3 kB]
Get:83 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3-software-properties all 0.96.20.7 [20.3 kB]
Get:84 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 software-properties-common all 0.96.20.7 [9452 B]
Get:85 http://archive.ubuntu.com/ubuntu xenial/main amd64 xz-utils amd64 5.1.1alpha+20120614-2ubuntu2 [78.8 kB]
Err:86 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 unattended-upgrades all 0.90ubuntu0.7
404 Not Found [IP: 91.189.88.161 80]
Fetched 23.7 MB in 1s (14.8 MB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/libpython3.5-minimal_3.5.2-2ubuntu0~16.04.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/python3.5-minimal_3.5.2-2ubuntu0~16.04.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/libpython3.5-stdlib_3.5.2-2ubuntu0~16.04.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/python3.5_3.5.2-2ubuntu0~16.04.2_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.32-3ubuntu1.1_amd64.deb 404 Not Found [IP: 91.189.88.161 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/u/unattended-upgrades/unattended-upgrades_0.90ubuntu0.7_all.deb 404 Not Found [IP: 91.189.88.161 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get -y install software-properties-common python-software-properties' returned a non-zero code: 100
看来运行时:
apt-get -y install software-properties-common python-software-properties
某些服务器已关闭。我该如何避免这种依赖关系?这是持续集成服务器的一部分,我希望将来避免这些问题。
注意:我sudo apt update
之前运行过......这实际上是 Dockerfile 的一部分:
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get -y install software-properties-common python-software-properties
RUN apt-get -y install ca-certificates curl
RUN apt-get -y install build-essential git sudo
在第二行构建容器失败。
答案1
根据docker 最佳实践,我应该将更新和安装放在同一个 RUN 行中。这样缓存就会正确更新。
经过这些改变之后,事情开始顺利进行。
答案2
如果您在使用 Docker 时遇到此问题,则可能需要运行 docker build 命令并选择--no-cache
从头开始重新启动它。
答案3
由于某种原因,这些文件已从服务器中删除。
打开一个新的浏览器窗口,在 URL 地址栏中复制/粘贴以下内容,然后按 Enter 键查看:
http://archive.ubuntu.com/ubuntu/pool/main/u/unattended-upgrades/unattended-upgrades_0.90ubuntu0.7_all.deb
http://security.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.32-3ubuntu1.1_amd64.deb
您还可以尝试:
wget http://archive.ubuntu.com/ubuntu/pool/main/u/unattended-upgrades/unattended-upgrades_0.90ubuntu0.7_all.deb
wget http://security.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.32-3ubuntu1.1_amd64.deb
您将得到同样的错误。
您能发布一下内容吗/etc/apt/sources.list
?
cat /etc/apt/sources.list
您只需编辑文件中的 URL 以将 APT 重定向到不同的服务器,然后运行sudo apt update
并重试。
看看当我从我的终端访问其中一个 URL 时会发生什么:
这就是失败的原因。您需要更改服务器引用。