我在尝试使用 apt install 安装 clang 和 libclang-dev 软件包时遇到 404 错误纯操作系统。
运行命令时我看到以下错误消息sudo apt install clang
Err:1 https://repo.pureos.net/pureos amber/main amd64 libclang-common-7-dev amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:2 https://repo.pureos.net/pureos amber/main amd64 libclang1-7 amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:3 https://repo.pureos.net/pureos amber/main amd64 clang-7 amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:4 https://repo.pureos.net/pureos amber/main amd64 libomp5-7 amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:5 https://repo.pureos.net/pureos amber/main amd64 libomp-7-dev amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:6 https://repo.pureos.net/pureos amber/main amd64 llvm-7-runtime amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:7 https://repo.pureos.net/pureos amber/main amd64 llvm-7 amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:8 https://repo.pureos.net/pureos amber/main amd64 llvm-7-dev amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libclang-common-7-dev_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libclang1-7_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/clang-7_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libomp5-7_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libomp-7-dev_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/llvm-7-runtime_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/llvm-7_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/llvm-7-dev_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
libclang-dev 也会发生类似的情况:
Err:1 https://repo.pureos.net/pureos amber/main amd64 libclang1-7 amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:2 https://repo.pureos.net/pureos amber/main amd64 libclang-common-7-dev amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
Err:3 https://repo.pureos.net/pureos amber/main amd64 libclang-7-dev amd64 1:7.0.1-8
404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libclang1-7_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libclang-common-7-dev_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7/libclang-7-dev_7.0.1-8_amd64.deb 404 Not Found [IP: 138.201.228.45 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
正在浏览https://repo.pureos.net/pureos/pool/main/l/llvm-toolchain-7,我可以看到软件包在那里,但它们的名称中都包含“+deb10u2”。例如,如果您查看第一个 404,您会看到 apt 正在尝试查找具有以下名称的包libclang-common-7-dev_7.0.1-8_amd64.deb,但是存储库上的包名为libclang-common-7-dev_7.0.1-8+deb10u2_amd64.deb。
我只在这两个特定的软件包中遇到这个问题,我使用 apt 安装了其他几个软件包,一切正常。
我已经尝试过 apt 建议的解决方案(“也许运行 apt-get update 或尝试使用 --fix-missing?”)。事实上,当我尝试使用 运行时apt install
,--fix-missing
我收到一条额外的错误行,其中显示:“无法更正丢失的包。”
我还尝试使用 apt-get 代替,并且在使用 apt 和 apt-get 安装软件包之前尝试运行干净、更新和升级,但也没有成功。
答案1
您需要做的就是暂时将sources.list
文件移出 APT 目录,运行apt update
(我猜这将刷新缓存的数据),将文件移回并apt update
再次运行。本质上:
$ sudo mv /etc/apt/sources.list /tmp/
$ sudo apt update
$ sudo mv /tmp/sources.list /etc/apt/
$ sudo apt update
现在您应该可以正常获取包了。