前提条件
当前系统为 Debian 12并且升级到最新,计划升级到 Debian 13。
注意事项
- 升级完成后,建议重启系统以应用所有变化:
sudo reboot。 - 如果遇到依赖冲突,参考 Debian 官方升级指南(https://www.debian.org/releases/trixie/release-notes/upgrading.en.html )。 第三方源可能需单独处理。
- 按照自己需要备份 /etc、/home 等目录。
步骤 1:
apt list '?narrow(?installed, ?not(?origin(Debian)))'筛选出非 Debian 源的包。如果有问题包,考虑移除或更新其源。
步骤 2:
sudo ls -l /etc/apt检查 APT 配置目录的权限和文件列表。确认 sources.list 等文件是否存在且权限正确。
步骤 3:
sudo nano /etc/apt/sources.list删掉所有内容,我习惯注释一下: # see debian.sources
步骤 4:
sudo nano /etc/apt/sources.list.d/debian.sources并输入
Types: debURIs: https://deb.debian.org/debianSuites: trixie trixie-updatesComponents: main non-free-firmwareSigned-By: /usr/share/keyrings/debian-archive-keyring.gpgTypes: debURIs: https://security.debian.org/debian-securitySuites: trixie-securityComponents: main non-free-firmwareSigned-By: /usr/share/keyrings/debian-archive-keyring.gpg用官方源。需要用其他源可以自行替换。
步骤 5:
把 /etc/apt/sources.list.d/ 下的其他源的内容先注释掉。因为很多源没有更新 trixie,改了报错不好看。
步骤 6(可选,一般不用):
sudo mount -o remount,rw /mountpoint如果系统挂载点(如根分区)为只读模式,运行此命令使其可写。替换 /mountpoint 为实际挂载点。
步骤 7:
sudo apt update从新源刷新可用软件包列表。如果有错误,检查源配置。
步骤 8:
sudo apt upgrade --without-new-pkgs执行安全升级,仅更新现有包而不引入新依赖。最小化风险,避免因新包导致的冲突。
步骤 9:
sudo apt full-upgrade完全升级系统,包括安装新包、移除冲突包。
步骤 10:
sudo apt autoremove清理不再需要的依赖包。
步骤 11:
apt list '~o'列出所有过时的(obsolete)软件包,这些包在新版本中可能已不可用。检查列表,决定是否需要手动处理。
步骤 12:
sudo apt purge '~o'彻底移除过时包及其配置文件。使用 '~o' 模式匹配所有过时包。确认后执行。
步骤 13:
lsb_release -a确认已升级到 Debian 13。
步骤 14:
把 /etc/apt/sources.list.d/ 里之前注释的内容取消注释,并把里面所有的 bookworm 改成 trixie。
评论 (0)