参考至官方文档https://www.debian.org/releases/trixie/release-notes/upgrading.zh_CN.html

为了方便,未严格按照文档进行

Debian13 已经出来有些时日了,正好在2025年的最后一天给随身WIFI升级到 Debian13 尝鲜。

1.备份

这里不过多赘述。直接使用 miko service tool 进行全盘备份,若后期出问题方便恢复。

2.升级前准备

为了安全考虑,建议全程使用 tmuxscreen 操作,防止因意外断开连接而导致更新中断。

2.1 一些注意事项

根据官方文档你应该:

只保留官方源,并删除“bookworm-backports”条目

移除过时的软件包、移除非 Debian 软件包

检查并升级手动禁止更新的包

清理配置文件残留

等一系列注意事项......

为了方便(我偷点懒),有些内容就略过了。若设备内有重要数据,请严格依照官方文档处理。

2.2 升级到最新的小版本更新

sudo apt update
sudo apt upgrade
sudo apt full-upgrade

2.3 检查并调整 apt 源

修改 /etc/apt/sources.list 配置文件,将原来的 bookworm 源改为为 trixie 源(官方教程其实推荐使用DEB822 格式的配置文件)

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

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware

# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware

如果你在 /etc/apt/sources.list.d 有其它源,记得更改。

3.升级

根据官方文档,先进行最小系统升级

sudo apt upgrade --without-new-pkgs

升级期间会提示是否要自动重启服务,输入“yes”并回车。

可能会询问你是否使用新版配置文件或保留旧版,视情况选择。

完成后继续执行

sudo apt full-upgrade

4. 一些问题

升级过程中我甚至连上文的步骤都没完全遵守,随便就盲目开干了,导致出了点小问题。

尽可能在重启之前解决。

4.1 配置文件

过程中提示是否使用新配置文件,我选择了用新配置文件,等更新结束之后要再重新配置一遍。

我主要遇到以下几个软件包的提示:zramtoolscronopenssh

配置文件分别为 /etc/default/zramswap 、/etc/crontab 、/etc/ssh/sshd_config

原有的旧文件会重命名加上.dpkg-old的后缀,对比新旧文件再改一次即可

4.2 恢复意外卸载的软件包

这里踩了一个坑,更新的时候把 mobian-tweaks-common 这个软件包给卸了。

没了这个会导致 USB 网络共享不会自动生效,电脑若想连接就只能用并不怎么好用的 adb shell ......

之前的 mobian 源失效,粗暴地给 mobian 源加了个注释,眼不见心不烦。

添加回来也容易,执行

sudo curl -L http://repo.mobian-project.org/mobian.gpg -o /etc/apt/trusted.gpg.d/mobian.gpg
echo "deb http://repo.mobian-project.org/ trixie main non-free" | sudo tee /etc/apt/sources.list.d/mobian.list

最后把软件包安装回来即可

sudo apt install mobian-tweaks-common

mobian-tweaks-common的依赖 mobile-tweaks-common 有个sh脚本在 /etc/profile.d/mobile-tweaks-mali.sh,会导致如下报错:

grep: /sys/class/drm/card?/device/of_node/compatible: 没有那个文件或目录

直接把脚本内所有内容用#注释,避免报错

5.尾声

成功升级 Debian13 ,别忘了重启

sudo reboot
Debain13.webp

经计算存储占用并未增加多少(占用多是因为装了其它软件),总之,安全下车!