最近有搬瓦工的debian9系统的小伙伴发现正常使用升级命令时候,出现了404.
root@default:~# apt-get update Ign:1 http://deb.debian.org/debian stretch InRelease Ign:2 http://deb.debian.org/debian-security stretch/updates InRelease Err:3 http://deb.debian.org/debian stretch Release 404 Not Found Err:4 http://deb.debian.org/debian-security stretch/updates Release 404 Not Found Reading package lists... Done E: The repository 'http://deb.debian.org/debian stretch Release' does no longer 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://deb.debian.org/debian-security stretch/updates Release' does no longer 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.
上面的信息提示debian9系统deb库里不在支持Release文件了,只是换了地方。我们只要更改下源文件即可继续获得文件。
debian 导入了 stretch suite 到archive.debian.org
https://lists.debian.org/debian-devel-announce/2023/03/msg00006.html
所以我通过替换源来修复它。
deb.debian.org到archive.debian.org
security.debian.org
到archive.debian.org/debian-security/
并删除源stretch-updates
,因为它在档案源中不可用:debian stretch archive
命令:
我使用这些 bash 命令进行替换:
将 deb.debian.org 替换为 archive.debian.org:(sudo 可以不复制,如果是以root登陆)
sudo sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
将 security.debian.org 替换为 archive.debian.org/debian-security/:(如果没有可忽略)
sudo sed -i 's|security.debian.org|archive.debian.org/debian-security/|g' /etc/apt/sources.list
删除包含源拉伸更新的行:
sudo sed -i '/stretch-updates/d' /etc/apt/sources.list
修改完成后我们就 可以正常使用 apt-get update升级系统文件了。
最后提示,如果在没特殊需求下,建议升级到debian10或者debian11。