baicai

白菜

一个勤奋的代码搬运工!

Upgrade from Debian 11 to Debian 12

If necessary, you can refer to the Debian 12 release notes for detailed upgrade and error handling instructions.

Preparation#

Make sure to backup important data!

The following operations need to be performed as the root user. Please use sudo -i or su root to switch to the root user for these operations.

Debian software sources are generally referenced by release codenames such as "bullseye" and "bookworm", but they can also be referenced by status names such as "stable", "unstable", and "testing". After the stable version of Debian 12 is officially released, "stable" will point to "bookworm".

Check the software sources and ensure that the output below is empty. If not, please manually change the software source to "bullseye":

cat /etc/apt/sources.list | grep stable

Update the apt sources and replace "bullseye" with "bookworm":

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

For Debian versions after 12, all non-free firmware binary files that can be distributed by Debian, such as certain drivers, have been moved to a new component in the Debian Archive called "non-free-firmware". If you are upgrading from an older version of Debian and need these firmware binary files, you should update the /etc/apt/sources.list file on your system to use this new component (source):

sed -i 's/non-free/non-free non-free-firmware/g' /etc/apt/sources.list

The default system apt source file /etc/apt/sources.list should look something like this:

deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware

Upgrade Process#

Update the software sources:

sudo apt update

Perform a minimal system upgrade first:

sudo apt upgrade --without-new-pkgs

If there are no issues, proceed with a full upgrade. This will download several hundred MB of files, and the download speed will depend on the server's network bandwidth:

sudo apt full-upgrade

If you have modified the SSH configuration file and are prompted, please choose to keep the local configuration.

During the update process, you may be prompted about whether certain software needs to be automatically restarted. Select "Yes" and whether configuration files for certain software need to be updated. Choose according to your situation. Pressing Enter by default will use the old configuration files, which usually occurs during updates of software such as OpenSSH.

You can press "q" to exit the apt-listchanges: News interface:

After the full upgrade is complete, restart the system:

sudo reboot

Remove unnecessary software and dependencies after the update:

apt autoclean
apt autoremove -y

Check the latest system version:

cat /etc/debian_version 
lsb_release -a
uname -a

After the Upgrade#

List the deleted packages:

apt list '~c'

Clean up the deleted packages:

sudo apt purge '~c'
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.