Zwh's Blog

Zwh's Blog

ZH/EN | 一个人不在计算机专业却时不时就想折腾计算机相关东西的咸鱼

Broken Water | Updating Debian 12 and Pitfall Record


"Pòshìshuǐ" can be considered as a standard hydrology, and its content can be found online. The technical content is not very high, suitable for being lazy (x

After the server was repaired, I saw that the system on it was Debian 11. I thought that the official had just released version 12 recently, so I tried to search for information and perform update operations in the SSH terminal.

Classic four-step update + restart#

sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
sudo systemctl reboot

Check system information#

Conveniently, after the steps are completed, confirm whether the upgrade was successful (.

root@vm1062:~# uname -mr
5.10.0-23-amd64 x86_64
root@vm1062:~# cat /etc/debian_version
# Take another look at the network information
root@vm1062:~# cat /etc/network/interfaces
source /etc/network/interfaces.d/*
root@vm1062:~# cat /etc/resolv.conf
# Generated by resolvconf

Backup old software sources#

sudo cp -v /etc/apt/sources.list /root/backup/
sudo cp -vr /etc/apt/sources.list.d/ /root/backup/

Modify new software sources#

sudo vim /etc/apt/sources.list, then replace the file content as follows:

deb bookworm main
deb-src bookworm main

deb bookworm-security main
deb-src bookworm-security main

deb bookworm-updates main
deb-src bookworm-updates main

deb bookworm non-free non-free-firmware
deb-src bookworm non-free non-free-firmware

deb bookworm-security non-free non-free-firmware
deb-src bookworm-security non-free non-free-firmware

deb bookworm-updates non-free non-free-firmware
deb-src bookworm-updates non-free non-free-firmware

Save the file and exit.

Note: Starting from Debian 12, the Debian team created a new repository "non-free-firmware" to package non-free software packages. To reduce errors after installation, it is recommended to add this repository (.

Start the upgrade#

sudo apt update
sudo apt full-upgrade

Click "Yes", and if there are any configuration file conflicts, press "q". After the progress bar finishes rolling, then execute sudo systemctl reboot to restart the server.

After reconnecting to the server, check again (.

root@vm1062:~# uname -mr
6.1.0-10-amd64 x86_64
root@vm1062:~# cat /etc/debian_version
root@vm1062:~# hyfetch
       _,met$$$$$gg.               ----------- 
    ,g$$$$$$$$$$$$$$$P.            OS: Debian GNU/Linux 12 (bookworm) x86_64 
  ,g$$P"        "\""Y$$.".         Host: KVM/QEMU (Standard PC (i440FX + PIIX, 1996) pc-i440fx-7.2) 
 ,$$P'              `$$$.          Kernel: 6.1.0-10-amd64 
',$$P       ,ggs.     `$$b:        Uptime: 2 days, 3 hours, 6 mins 
`d$$'     ,$P"'   .    $$$         Packages: 1 (pipx), 522 (dpkg) 
 $$P      d$'     ,    $$P         Shell: bash 5.2.15 
 $$:      $$.   -    ,d$$'         Resolution: 1280x800 
 $$;      Y$b._   _,d$P'           Terminal: /dev/pts/0 
 Y$$.    `.`"Y$$$$P"'              CPU: AMD EPYC 7B13 (4) @ 2.2GHz 
 `$$b      "-.__                   GPU: Vendor 1234 Device 1111 
  `Y$$                             Memory: 1.04 GiB / 15.61 GiB (6%) 
   `Y$$.                           Network: Unknown 
     `$$b.                         BIOS: SeaBIOS 0.0 (04/01/2014) 

After confirming that everything is available, remove the remnants of the old version: apt autoremove

Okay, it's done, off work~

Off work? Rain (pre) falls#

Actually, when I executed hyfetch for the first time after the upgrade, it threw an error. I didn't keep the reason, but roughly it couldn't find the hyfetch module. At the same time, pip also stopped working.

When I wanted to use a script to install pip, the script directly threw an error and told me to install it using a package manager. There was no way, apt, start!

After apt is finished, I tried to install hyfetch using pip again, but it threw an error and told me to install it using pipx. Fine, I listened to it, installed pipx, then installed hyfetch, and finally restarted the terminal to use it normally.

I can only say that some changes in Python 3.11 are really big...


Upgrade from Debian 11 to Debian 12 | Linux China

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.