WSL 系统升级 Debain11 到 12

134 阅读1分钟

问题:镜像源报错

在 WSL Debain 系统中使用 apt update 更新软件包时遇到报错

Reading package lists... Done E: The repository 'http://mirrors.tuna.tsinghua.edu.cn/debian  bullseye-backports Release' no longer has 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.

image-20251102213812008

原因:Debian 11 bullseye 于 2024 年 8 月 结束标准支持,部分仓库可能被归档或不再提供

解决方法:升级系统

升级系统到 Debian 12 bookworm,使用新的镜像仓库链接

执行脚本

# 先在旧仓库更新到最新
sudo apt update && sudo apt full-upgrade
# 调整镜像仓库版本
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
# 在新仓库完整更新
sudo apt update && sudo apt full-upgrade
sudo reboot

修改后的 sources.list

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free

deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free

deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free

deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free

# deb http://security.debian.org/debian-security bookworm-security main contrib non-free
# deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free

进行安装

image-20251102214421823

安装时可能弹出配置确认界面

image-20251102214504066

这个问题是 Debian系统在升级系统库时,弹出的一个配置提示,即是否重启受影响的系统服务,一般建议选择 YES