从 Debian 10 Buster 升级到 Debian 11 Bullseye 安全更新后未找到 404

从 Debian 10 Buster 升级到 Debian 11 Bullseye 安全更新后未找到 404

执行推荐的升级路径,TL;DR:

备份数据,然后

apt update
apt upgrade
apt dist-upgrade
reboot

如果有的话,也禁用所有非主流包。

然后为新发行版准备 APT:

sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*

第一个命令显示错误:

apt update
...
Err:6 http://security.debian.org/debian-security bullseye/updates Release
  404  Not Found
Reading package lists... Done
E: The repository 'http://security.debian.org/debian-security bullseye/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

这是关于 Debian 11 存储库结构的变化。RTFM 需要时间,因此请在此处回答:

对于 Debian bullseye,安全套件现在名为 bullseye-security,而不是 codename/updates,用户在升级时应相应地调整其 APT 源列表文件。

因此再执行一个命令:

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

现在 apt update 可以再次正常工作了,您可以继续升级:

sudo apt update
sudo apt upgrade --without-new-pkgs
sudo apt full-upgrade
reboot

检查系统是否升级:

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:    11
Codename:   bullseye

重启成功后,您可以删除旧内核:

sudo apt purge linux-image-4.19*

还要检查日志文件,查找冲突配置或其他问题的错误消息。

问题列表在这里:https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.html

答案2

如果你按照各种 Debian 更新教程操作,你很可能会得到一个错误的 /etc/apt/source.list

由于大多数“修复”都列出了 sed 命令补丁,如果您的原始 source.list 内容不完全匹配,它们可能无法起作用。

在这种情况下,只需手动编辑 source.list,新的靶心安全线应如下所示

deb http://security.debian.org/debian-security/ bullseye-security main
deb-src http://security.debian.org/debian-security/ bullseye-security main

或者如果你不需要源代码并且想要贡献,那么可以

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

相关内容