security.debian.org 在 Debian Docker 镜像上“没有发布文件”

security.debian.org 在 Debian Docker 镜像上“没有发布文件”

看起来两者debian:stable-slim目前debian:stable都已损坏(用于更新):

> $ docker run -ti --rm  debian:stable-slim
Unable to find image 'debian:stable-slim' locally
stable-slim: Pulling from library/debian
fc491617b0f1: Pull complete
Digest: sha256:a85c2c0e634946e92a6f4a9a4f6ce5f19ce7c11885bc198f04ab3ae8dacbaffa
Status: Downloaded newer image for debian:stable-slim
root@e610973ac2f8:/# apt update
Ign:1 http://security.debian.org/debian-security stable/updates InRelease
Err:2 http://security.debian.org/debian-security stable/updates Release
  404  Not Found [IP: 151.101.130.132 80]
Get:3 http://deb.debian.org/debian stable InRelease [113 kB]
Get:4 http://deb.debian.org/debian stable-updates InRelease [36.8 kB]
Get:5 http://deb.debian.org/debian stable/main amd64 Packages [8178 kB]
Reading package lists... Done
E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

还有谁遇到过这种情况或找到了解决方法吗?

答案1

我可以通过更改此行来修复此问题:

deb http://security.debian.org/debian-security stable/updates main

deb http://security.debian.org/debian-security stable-security/updates main

你可以通过运行以下命令来实现:

sed -i 's/stable\/updates/stable-security\/updates/' /etc/apt/sources.list

答案2

问题

在 Debian Stretch (9) Docker 镜像上遇到此问题。

运行 apt-get update 时出现以下错误

W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages  404  Not Found [IP: xx]
E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

背景

这尤其与安全回购相关。

这些 repo 定义由 apt 用来获取更新,它们定义在/etc/apt/sources.list

Debian 安全官方建议 -https://www.debian.org/security/

To keep your Debian operating system up-to-date with security patches, please add the following line to your /etc/apt/sources.list file

`deb http://security.debian.org/debian-security bullseye-security main contrib non-free`

回答

在 Dockerfile 中添加此行

RUN echo "deb http://security.debian.org/debian-security bullseye-security main contrib non-free" > /etc/apt/sources.list

RUN apt-get update

其他解决方案

对我来说不起作用的是:

  • 将 repo 更改为 stable-security
  • 使用--allow-releaseinfo-change标志运行 apt - 无法识别与 apt-get update 配对的标志

其他有效方法:

  • 您可以使用 stretch archive repo 而不是使用 bullseye security repo deb http://archive.debian.org/debian stretch main contrib non-free;从安全角度来看,最好坚持使用最新版本的安全性

更新

如果您只是放大安全回购问题,以上内容是正确的。

为什么我们在安全回购中会遇到这些问题?

对我来说,Debian 9 是一个存档的、不受支持、不受维护的版本。

尽管我可以“修复”(绕过)安全存储库,但我对 APT 的依赖存储库还存在其他问题。由于该版本已弃用,这些存储库需要指向存档。

总的来说,这迫使我升级到 Debian 10。在 Debian 10 上我不需要上述修复。

答案3

来自 debian.org...(将“stretch”替换为您当前正在运行的版本)。删除其他相似的行,然后 apt-get update 和 apt-get upgrade。

deb http://archive.debian.org/debian/ stretch main non-free contrib
deb-src http://archive.debian.org/debian/ stretch main non-free contrib

deb http://archive.debian.org/debian-security/ stretch/updates main non-free contrib
deb-src http://archive.debian.org/debian-security/ stretch/updates main non-free contrib

相关内容