openSUSE distribution upgrade

If you could never really figure out how to do those complicated distribution upgrades in openSUSE Linux then let me tell you the probably most efficient way to do it:

First make sure your current distribution is up to date to minimize the potential for errors so type:

sudo zypper up

Once you are up to date we can start the whole procedure, for a distribution upgrade we need to be root so type:


Before we can do the actual distribution upgrade we need to replace the repositories from our current distribution with the repositories of the new distribution, in our case we will be upgrading from openSUSE Leap 15.1 to 15.2.

Other tutorials will now probably tell you to navigate to the files and edit them manually or go into Yast and edit the repositories there, however there is a much more efficient way to do it and that is using the "sed" command. Make sure that you replace the first number in the command with your current distribution number and the second number with the next version you want to upgrade to, never skip a version. In case you need to find out what version you are running use this tutorial:

sed -i 's/15.1/15.2/' /etc/zypp/repos.d/*

After sed has gone through all the repo files and replaced the old version with the new version, we need to load them:

zypper refresh

Now we do the actual upgrade, which may take a while:

zypper dup

When the upgrade is done you need to reboot:



And that's it.


PS: I like how there is a "zypper dup" command now to make a distribution upgrade, but it does not work on its own, but with the "sed" command you can streamline that process, so you do sed, refresh, dup and reboot. Even those commands probably can be put into a script so you could theoretically do a whole distribution upgrade in one action.

In case you have unofficial community repos loaded into your system, that do not end in a version number you can replace, you may have to manually look into how to upgrade them, some tutorials tell you to disable them on a distrubtion upgrade and re-enable them after.

If you are scared the upgrade progress may fail, because of bad internet or whatever, you can use the command "zypper dup --download-in-advance" then it will download the upgrades first and then install, may be helpful for some people.


Warning: There is always a "tiny" chance that things go wrong, so make sure you backup your files before doing major upgrades blabla and I'm not responsible for when things go wrong, blabla, but if you ignore those warnings like me, openSUSE has a pretty good snapshot system now, where you can restore your system back to the latest working version in case everything breaks down.

Tutorial Reference: