Previously, I posted about confirming the age of my currently installed Debian 11.11—the version I have been running since 2021—as I could not remember the exact date and time it was installed on my laptop.
I was able to find a couple of possible options, which I shared in this post:
https://porfiriopaiz.github.io/site/posts/2028/08/24/debian-age.html
Now, after more than 4 years of using Debian 11.11, I have finally decided to upgrade to Debian 12.12 Bookworm. I will cover the steps I took to perform the upgrade and some of the issues I faced during the process.
Also, I will share some of the things I wanted to preserve from the current installation before the upgrade process.
Pre-upgrade Process
Confirm the installed Debian version just to make sure where we are starting from:
cat /etc/debian_version
Which returns:
11.11
Gather System Information
This command gives us more information about the current version installed on our device:
lsb_release -a
Which returns:
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
This is another alternative to get even more information about the installed system version:
cat /etc/os-release
Which returns:
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Storage Analysis
Before upgrading, I wanted to know how much storage space I have used since Debian 11 was installed on my T440p.
Analyze APT Cache
First, I moved to the directory where apt stores the packages before they are installed on the system:
cd /var/cache/apt
Once there, I ran this command to measure the total storage space used:
sudo du -sh .
Which returned the following:
27G /var/cache/apt/
Meaning that in 4 years, I have downloaded 27 GB either as new packages or updates for existing packages.
Package Inventory
Something important to me before upgrading is to make a list of all the packages currently installed.
Methods to List Packages
Selection List: Saves a basic list to packagesInstalled.
dpkg --get-selections > packagesInstalled
Detailed Query: Includes status, version, and architecture.
dpkg-query -l > dpkgQuery-l
Binary Names Only: Useful for clean, one-per-line lists.
dpkg-query -f '${binary:Package}\n' -W > dpkgQuery-f_binPac
Manual Selections: Lists packages specifically requested by the user.
apt-mark showmanual > manuallyInstalled
The Upgrade Process
OK... enough nostalgia for the moment; this is where the fun begins!
Update Current System
As it is, I need to make sure that my system is fully up to date:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Modify Package Sources
First, make a backup of your current configuration:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig
Then, update the file to include the new non-free-firmware component and switch the codename to Bookworm:
cd /etc/apt/
sudo sed -i.bak '/^deb-src\|^deb/ { /non-free/ s/$/ non-free-firmware/ }' /etc/apt/sources.list
sudo sed -i.bak '/^deb-src\|^deb/ s/bullseye/bookworm/g' /etc/apt/sources.list
Perform the Full Upgrade
Update the repository data:
sudo apt update
Check for upgradable packages:
sudo apt list --upgradable
We will upgrade first without installing new packages:
sudo apt upgrade --without-new-pkgs
Once this is completed, we can fully upgrade our system:
sudo apt full-upgrade
Conclusion
Once this process was completed, I was able to reboot my system and run Debian 12.12 on my Lenovo ThinkPad T440p without having to reinstall from scratch.