Upgrade Raspbian Jessie to Stretch

Posted on Thu 06 June 2019 in RaspberryPi

How to upgrade Raspbian Jessie to Stretch in a few simple steps.

The upgrade from Jessie to Stretch is an easy and simple task, but is not guaranteed to work in every circumstance. The upgrade process takes some time and therefore requires some patience especially on older Raspberry Pi models. The owners of Raspberry Pi B 1 (like me) may consider rebuilding their system from scratch instead of goint through the time consuming upgrade process.

Important

MariaDB replaces MySQL

Note: that the database binary data file formats are not backwards compatible, so once you have upgraded to MariaDB 10.1 you will not be able to switch back to any previous version of MariaDB or MySQL unless you have a proper database dump. Therefore, before upgrading, please make backups of all important databases with an appropriate tool such as mysqldump.` debian.org

Recommendations

  • Backup data and configurations
  • Remove unnecessary or obsolete packages

Check available disk space

Check the available and used disk space on the SD card.

df -h

Fully upgrade the current systen

Update your system's package list:

sudo apt-get update

After that upgrade all your installed packages to their latest version:

sudo apt-get dist-upgrade

Upgrade any held back packages:

sudo apt-get dist-upgrade

System check

Check that all packages are in a state that is suitable for upgrade. Perform database sanity and consistency checks for partially installed, missing and obsolete packages.

sudo dpkg -C

Check for held back packages:

sudo apt-mark showhold

Fix all issues before moving to the next step.

Upgrading from Jessie to Stretch

Modify the files /etc/apt/sources.list and /etc/apt/sources.list.d/raspi.list. In both files, change every occurrence of the word jessie with stretch. Use the following commands to performe the task:

sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list
sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list.d/raspi.list

Update local pakage index:

sudo apt-get update

Upgrade the system:

sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y

Cleaning

Remove unused packages:

sudo apt-get autoremove -y
sudo apt-get autoclean

Reboot the system as finall step.

Notes

Downloaded package files (.deb files) are kept in /var/cache/apt/archives, you can remove these in order to free up space with sudo apt-get clean.

The End