The upgrade from Raspbian Jessie to Raspbian 9 Stretch is a relatively simple procedure. However, exercise caution, as there is always a chance to break the entire system. The fewer installed 3rd-party packages and services, the more likely you are able successfully to upgrade your Raspbian Linux system.
- Remove unnecessary or obsolete packages
- Make a data and configuration backup
- Perform an upgrade directly using console
- Installed 3rd-party software on Raspbian Stretch 9
MariaDB is now the default SQL database in Debian 9 Stretch. This introduces a new database binary data file format which is not backwards compatible with your current ( Debian 8 Jessie ) database format. During the upgrade your databases will be upgraded automatically. However, when you run into some issues during or after the upgrade, you will not be able revert back! From this reason it is important to backup all your current databases before you proceed with a Debian 9 Stretch upgrade!
Fully Upgrade Current System
Start by fully upgrade your current Raspbian system before you proceed with a Stretch upgrade.
# apt-get update # apt-get upgrade
Upgrade any held back packages:
# apt-get dist-upgrade
Last, chance to check for any system inconsistencies. Perform database sanity and consistency checks for partially installed, missing and obsolete packages:
# dpkg -C
If no issues are reported, check what packages are held back:
# apt-mark showhold
On Hold will not upgrade.
On Hold packages may cause inconsistencies after Stretch upgrade. Before you move to the following part, it is suggested to fix all issues provided by both above commands.
Update Package Repository to Debian Stretch
Next, update your
/etc/apt/sources.list to include new Stretch repositories.
# sed -i 's/jessie/stretch/g' /etc/apt/sources.list
The above command will replace any
Jessie keyword occurrence to
Stretch thus effectively enabling new Stretch repositories. Once your
/etc/apt/sources.list is updated to included
Stretch repositories, update your local package index with:
# apt-get update
Raspbian Stretch Upgrade Simulation
Used the bellow command to see what we are facing. It is a simulated dry-run thus not system changes will be implemented.
# apt-get --simulate upgrade
Rasbian Stretch Upgrade
We have come to the most exciting part, which is the actual Jessie upgrade to Raspbian Stretch system. During the upgrade you may be asked:
There are services installed on your system which need to be restarted when certain libraries, such as libpam, libc, and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to restart. You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid being asked questions on each library upgrade.
Restart services during package upgrades without asking?
The choice is about whether you wish the system to restart your services automatically during the system upgrade or you wish to do it manually or after the system is fully upgrade to Stretch.
When ready, execute the bellow commands to commence the Debian Stretch upgrade process:
# apt-get upgrade # apt-get dist-upgrade
All done. Reboot your system.