如何从Debian11升级到Debian13
vps901 Lv1

原文因为遥遥领先的Z-BlogPHP的编辑器不支持MarkDown,操作超级麻烦,所以干脆就丢到我们的Hexo博客来写了。

本文没图,请放心浏览。

今天的主题是不使用DD脚本把Debian11保数据升级到Debian13,因为本人过于懒惰,这里引用我们的GPT3.5的回答来作为教程,如果GPT3.5的回答有错误,我会在下面纠正。

Upgrading from Debian 11 (“Bullseye”) to Debian 13 involves several steps. Debian releases happen in a predictable cycle, so depending on when you start the upgrade, you might have to go through Debian 12 (“Bookworm”) before getting to Debian 13, as direct upgrades between non-adjacent major releases may not be fully supported. Here’s a general step-by-step guide to upgrading from Debian 11 to Debian 13:

1. Backup Your System

Before doing any upgrade, it’s critical to backup important data, configurations, and system files. You can use tools like rsync, tar, or dedicated backup solutions.

2. Update Current Debian 11

Make sure your current Debian 11 installation is fully updated.

1
2
3
sudo apt update
sudo apt upgrade
sudo apt full-upgrade

Then, reboot if necessary:

1
sudo reboot

3. Modify APT Sources List for Debian 12

You need to first upgrade to Debian 12 (“Bookworm”) before moving to Debian 13. Start by modifying the APT sources list to point to the new version.

  1. Open the sources list file:
1
sudo nano /etc/apt/sources.list
  1. Replace every occurrence of “bullseye” with “bookworm”. It might look something like this:
1
2
3
deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
deb http://deb.debian.org/debian-security bookworm-security main contrib non-free
  1. Save the file and exit the editor (Ctrl+X, then Y and Enter).

4. Update Package Lists and Upgrade to Debian 12

  1. Update the package list with the new Debian 12 repositories:
1
sudo apt update
  1. Perform a minimal system upgrade first to avoid removing any packages initially:
1
sudo apt upgrade
  1. Then, run a full upgrade:
1
sudo apt full-upgrade
  1. Reboot your system:
1
sudo reboot

5. Upgrade to Debian 13

Once you have successfully upgraded to Debian 12, you can now upgrade to Debian 13.

  1. Edit your /etc/apt/sources.list file again:
1
sudo nano /etc/apt/sources.list
  1. Replace every instance of “bookworm” with the codename of Debian 13. The codename of Debian 13 is not officially announced yet (as of 2024), but you would use something like “trixie” if it follows the naming pattern.

Your sources list will now look something like this:

1
2
3
deb http://deb.debian.org/debian trixie main contrib non-free
deb http://deb.debian.org/debian trixie-updates main contrib non-free
deb http://deb.debian.org/debian-security trixie-security main contrib non-free
  1. Save and exit the file.

6. Update Package Lists and Upgrade to Debian 13

  1. Update the package lists again:
1
sudo apt update
  1. Perform the minimal upgrade:
1
sudo apt upgrade
  1. Then, perform the full upgrade:
1
sudo apt full-upgrade
  1. Reboot the system again:
1
sudo reboot

7. Clean Up After Upgrade

Once you have upgraded to Debian 13, you can remove obsolete or unused packages:

1
sudo apt autoremove

Also, consider clearing the local repository cache:

1
sudo apt clean

8. Verify the Upgrade

Check your new Debian version with:

1
lsb_release -a

or:

1
cat /etc/debian_version

Troubleshooting:

  • If any issues arise during the upgrade process (like broken packages), you can try running:
1
2
sudo dpkg --configure -a
sudo apt install -f

This should fix broken dependencies and complete any unfinished configurations.

Final Notes:

  • Always read the release notes of Debian versions before upgrading, as they might contain specific instructions or warnings.
  • Ensure that you have sufficient disk space before starting the upgrade.

Following these steps should help you smoothly upgrade from Debian 11 to Debian 13.

都是英文,对吧。

有的机器会出现类似这样的报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
******************************************************************************

*

* The base-files package cannot be installed because

* /bin is a symbolic link and not pointing at usr/bin exactly.

*

* This is an unexpected situation. Cannot proceed with the upgrade.

*

* For more information please read https://wiki.debian.org/UsrMerge.

*

******************************************************************************

这里的话不能直接执行rm /binln -s /usr/bin /bin,因为这样的话问题依旧还会在,正确的做法是:

1
2
3
cd /
rm bin
ln -s /usr/bin bin

这样你再执行apt full-upgrade -y就能正常更新了。

好的,本期教程就到这里,希望对你有帮助!