Hetzner 问题:使用 Ansible 时 /etc/source.list 会被自动覆盖

Hetzner 问题:使用 Ansible 时 /etc/source.list 会被自动覆盖

我正在尝试让 ansible 在 Hetzner debian 专用服务器上正常工作。问题是 hetzner 会以某种方式自动覆盖 /etc/sources.list 文件。

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

E: The repository 'http://mirror.hetzner.de/debian/security buster 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.
E: The repository 'http://mirror.hetzner.de/debian/security buster-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.
E: The repository 'http://mirror.hetzner.de/debian/security buster-backports 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.

显然有东西覆盖了 sources.list 在文件顶部,它甚至显示

# This file is managed remotely, all changes will be lost

有任何想法吗?

# This file is managed remotely, all changes will be lost

# Original APT package sources gathered by Ansible
deb http://mirror.hetzner.de/debian/packages buster main contrib non-free
deb http://mirror.hetzner.de/debian/packages buster-updates main contrib non-free
deb http://mirror.hetzner.de/debian/packages buster-backports main contrib non-free
deb http://mirror.hetzner.de/debian/security buster main contrib non-free
deb http://mirror.hetzner.de/debian/security buster-updates main contrib non-free
deb http://mirror.hetzner.de/debian/security buster-backports main contrib non-free
deb http://deb.debian.org/debian buster main contrib non-free
deb http://deb.debian.org/debian buster-updates main contrib non-free
deb http://deb.debian.org/debian buster-backports main contrib non-free

# Official Debian repositories
# deb http://deb.debian.org/debian buster main contrib non-free
# deb http://deb.debian.org/debian buster-updates main contrib non-free
# deb http://deb.debian.org/debian buster-backports main contrib non-free

# Debian Security repository
deb http://security.debian.org/ buster/updates main contrib non-free

答案1

您确定该消息“此文件是远程管理的,所有更改都将丢失”不是来自 Ansible 吗?
Hetzner 似乎不太可能触碰你的专用服务器,除非你租用了托管系统。如果是 VPS,那可能更合理。

这里也没有致命错误,apt 应该可以正常工作。hetzner URL 似乎已损坏,因此 apt 跳过了它们。无论如何,下面的官方链接仍应使用。

我认为更有可能的是,您将那些 hetzner URL 放入了您的 ansible 配置中,但它们在某种程度上是错误的,因此现在您在从它们获取内容时会遇到错误。

答案2

你可能错过了 buster/updates 上的 /

deb http://mirror.hetzner.de/debian/packages buster main
deb http://mirror.hetzner.de/debian/packages buster-updates main
deb http://mirror.hetzner.de/debian/security buster/updates main

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

工作正常。

相关内容