首先需要更新你当前的 Debian 12 系统:

apt update && apt full-upgrade -y && apt --purge autoremove -y && apt autoclean && apt clean

然后更新 apt 源,替换 bookworm 为 trixie:

sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/*.list
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/*.sources

如果有提示类似 sed: can't read /etc/apt/sources.list.d/*.sources: No such file or directory 的错误,忽略即可。

然后再次执行更新系统:

apt update && apt full-upgrade -y && apt --purge autoremove -y && apt autoclean && apt clean

期间会遇到多次需要手动选择的停顿,一路 enter 即可。

更新完毕使用 reboot 命令重启系统。

查看最新的系统版本:

lsb_release -a

你会看到已经更新至最新的 Debian 13 系统:

No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 13 (trixie)
Release:    13
Codename:    trixie