Upgrade Raspberry Pi in place
Upgrading A Raspberry Pi Distribution in Place
Scope: To upgrade the existing Raspberry PI from stretch (9) to Buster (10) without re imaging the SD or losing any data.
- Update and Upgrade the Raspberry Pi
sudo apt update && sudo apt upgrade -y
- After that is done, upgrade the Firmware.
sudo rpi-update
- Proceed with a Y when prompted. If you are already up to date, then move to the next step.
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18774 100 18774 0 0 17105 0 0:00:01 0:00:01 --:--:-- 17113
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** We're running for the first time
*** Backing up files (this will take a few minutes)
*** Backing up firmware
*** Backing up modules 4.19.66-v7+
#############################################################
WARNING: This update bumps to rpi-5.15.y linux tree
See: https://forums.raspberrypi.com/viewtopic.php?t=322879
'rpi-update' should only be used if there is a specific
reason to do so - for example, a request by a Raspberry Pi
engineer or if you want to help the testing effort
and are comfortable with restoring if there are regressions.
DO NOT use 'rpi-update' as part of a regular update process.
##############################################################
Would you like to proceed? (y/N)
- Open the the sources file that the Raspberry PI uses for updating using your preferred editor. I am using nano.
sudo nano /etc/apt/sources.list
- You should see the following line in the file
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
- Navigate to that line and change
stretch
tobuster
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
- If you are using nano like myself hit
Ctrl+x
and save the file. - Remove the large changelog file. (sometime this does something and sometimes it does nothing, not a big deal)
sudo apt-get remove apt-listchanges
- Type
Y
to proceed
pi@raspberrypi:~ $ sudo apt-get remove apt-listchanges
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
dh-python distro-info-data iso-codes libpython3-stdlib lsb-release
python-apt-common python3 python3-apt python3-minimal python3.5
python3.5-minimal
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
apt-listchanges
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 377 kB disk space will be freed.
Do you want to continue? [Y/n]
- Update and upgrade the system
sudo apt update && sudo apt upgrade
- Remove packages that are not longer needed
sudo apt autoremove
- Reboot
sudo apt reboot
- Upgrade the distribution
sudo apt dist-upgrade
- Type
Y
to continue the upgrade
406 upgraded, 110 newly installed, 3 to remove and 0 not upgraded.
Need to get 98.4 MB/258 MB of archives.
After this operation, 307 MB of additional disk space will be used.
Do you want to continue? [Y/n]
- Note: There might be a few prompts while the system is updating, so answer them the best you know how with information you have. I know one of the prompts was to ask if I wanted to restart all services without asking… yes, yes I do.
- When the upgrade is finished, we will auto remove and clean up all the files that are not needed anymore and reboot.
sudo apt autoremove -y
sudo apt autoclean
sudo apt reboot
- Everything should fire up after the reboot and you can check your Distro with
lsb_release -a
- Output:
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
!!!Success!!!