Ubuntu 18.04 在获取依赖项时抛出 404 错误

Con*_*lan 23 updates package-management apt

我有四个构建服务器,它们最初都设置相同。我们一直在使用它们来交叉编译 C 项目。我也在尝试更新它们以本地编译 C++。我能够在其中安装 g++ 的两台服务器上没有问题,但另外两台给了我 404 错误。

$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  g++-7 libstdc++-7-dev
Suggested packages:
  g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg libstdc++-7-doc
The following NEW packages will be installed:
  g++ g++-7 libstdc++-7-dev
0 upgraded, 3 newly installed, 0 to remove and 5 not upgraded.
Need to get 9,043 kB of archives.
After this operation, 40.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libstdc++-7-dev amd64 7.4.0-1ubuntu1~18.04
  404  Not Found [IP: 91.189.88.149 80]
Err:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 g++-7 amd64 7.4.0-1ubuntu1~18.04
  404  Not Found [IP: 91.189.88.149 80]
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 g++ amd64 4:7.4.0-1ubuntu2.2
  404  Not Found [IP: 91.189.88.149 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-7/libstdc++-7-dev_7.4.0-1ubuntu1~18.04_amd64.deb  404  Not Found [IP: 91.189.88.149 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-7/g++-7_7.4.0-1ubuntu1~18.04_amd64.deb  404  Not Found [IP: 91.189.88.149 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-defaults/g++_7.4.0-1ubuntu2.2_amd64.deb  404  Not Found [IP: 91.189.88.149 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Run Code Online (Sandbox Code Playgroud)

我已经确认所有四个报告相同的版本信息。

$ uname -a
Linux build_server4 4.15.0-48-generic #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic
Run Code Online (Sandbox Code Playgroud)

小智 58

几乎每次我设置一个新盒子时都会遇到这个问题。

sudo apt update在安装软件包之前运行。

  • 在构建 docker 容器时遇到了同样的问题。我意识到 apt update 使用的是过期的 docker 缓存,所以我只使用了“no-cache”并且一切正常。 (3认同)

小智 12

apt-get update如果从 docker 运行并且您的 Dockerfile 中已有该文件,请尝试--no-cache使用缓存清除来运行。