Sometimes, for various reasons, we need to upgrade the system, such as when the old version is no longer maintained, has many vulnerabilities, or some software requires the latest version of the system.
If there are no important software and data in the current system, the simplest way is to format the SD card and then download the new version of the system from the official website to re-burn it. However, if you have been using it for a long time and have a lot of data that is not easy to back up or migrate, we need to perform an upgrade.
Here, we will demonstrate how to upgrade from bullseye to bookworm as an example:
bookworm is the latest system for Raspberry Pi.
First, check the current system version:
My version here is bullseye.
First, modify the apt source to switch to bookworm.
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/raspi.list
Then update the apt software list.
After updating, execute the following command to upgrade the system.
Of course, the upgrade process is not unattended; you need to confirm some operations. During the upgrade process, just select yes or Y for all interactions.
After the upgrade is complete, we restart the Raspberry Pi, and the system will be the latest bookworm version.