Upgrading openSUSE Leap with zypper-upgradedistro

After using the procedure explained for years in the upgrade with zypper article, I decided to collect all these steps in a practical script, which take care of all the statuses and, when needed, asks for confirmations, or suggests how to proceed manually in particular situations.

Although I tried to cover all the errors and provide the right solutions for a wide range of possible mistakes, it’s strongly recommended to read the aforementioned article to have a clear idea of what is going on during an upgrade and to better understand the whole process.

Why a script

There are several advantages to using a script instead of manually repeating the steps, although minimal like the ones needed for an upgrade, and for sure the first is in the automatic activity which leads you through the process without having to remember exactly what’s going on, it is a sort of run and forget.

The demystification of the outputs from the commands involved, replacing them with clear directions to overcome a certain error is for sure a big advantage that may decide whether or not the task is completed successfully.

Last but not least this script includes also a resuming option, useful in those cases when the flow must be interrupted and other actions must be performed before restarting the upgrade.

Under the hood

The first thing the script does is to connect to the openSUSE website and acquire the last stable release version, if that value matches with the current version it exits, otherwise asks for continuing the upgrade.

At this point, with the help of the zypper-upgraderepo plugin the script lists the available versions, and if only one is given, it is automatically used as the target.

Before upgrade it is always recommended to update the system, and that is the next step, to do that the root password is required.

Once the update is completed, the script queries, still using zypper-upgraderepo, the online repositories in order to validate them for an upgrade. When the simply interpolation of the URL doesn’t work, zypper-upgraderepo tries to find a valid alternative among the folders of the same location and display them as a hint.

These suggested URLs are just proposed but not overwritten automatically, so the next step is to export them in a file and edit it replacing the url field with the content of suggested_url. The idea of this manual intervention is to leave to the user the responsibility to evaluate the discovered changes.

Once fixed all the repo’s URLs the next steps are the backup of the old repositories, the upgrade of these repositories and the start of the distro upgrade task.

As explained in the aforementioned article the upgrade is split in half: first, the packages are downloaded, then they are installed. The script follows the same procedure.

Some packages may be not correctly downloaded, because while we try to fetch them, a new version of the same packages might have replaced the one we were aiming for.

Of course, when an error like that occurs, we just need to repeat the command until everything is fixed, then resume the script to continue

When all the packages are downloaded the resumed script runs the last check before inviting us to terminate all our applications and switch to a terminal outside the graphical session.

This is the time for the latest steps, the session is switched to the runlevel 3 and the packages previously downloaded are installed, and in the end, the machine is rebooted.

Final thoughts

Upgrading from the console has been my option for several releases, the way to switch to the newer version directly, saving me the time to download any image and transfer it on a media, is priceless to me. With that script now I don’t need anymore to go back and forth to my guide to see whether or not I missed some step.


Creative Commons License This work is licensed under a Creative Commons Attribution-NoCommercial-ShareAlike 4.0 International License


This article covers a personal project, further info is provided at the Zypper-Upgradedistro project page.

Leave a Comment