Upgrading openSUSE with zypper

With no doubt, an installation from scratch allows getting rid off of all misconfigurations, packages installed once and never used, and broken or unneeded dependencies that most of the times we accumulate from time to time while playing new applications or system settings, upgrading openSUSE Leap through zypper instead, might perform enough well and, at the same time, avoid us the standard, several, boring configuration steps, in order to save precious time.

Why use zypper

The usual installation process consists on

  1. Download and write the ISO,
  2. reboot from the USB key/CD/DVD support,
  3. prepare the disk and configure the option needed to start the installation,
  4. select and install the packages (only for the DVD version),
  5. apply other configurations and install other software (only for live CD version) post installation.

While upgrading through the zypper command line requires:

  1. Fix the repo’s URLs references,
  2. download the newer version of all and only used packages automatically selected,
  3. execute the upgrade
  4. reboot and you are done.

Every time an upgrade doesn’t bring too many radical changes and the system itself is pretty stable to don’t require a big cleanup, there is no reason to don’t give a try to zypper.

Requirements

Before to start upgrading it’s always a good practice to update the system.

Those who feel confused should be aware of that difference:

Upgrade:
This is the complete procedure which allows switching your distribution from the actual version to the newer (i.e. openSUSE 42.3 to openSUSE 15.0, openSUSE 15.0 to openSUSE 15.1 and so on...).
Update:
This is the regular action performed almost daily to keep the packages updated with their latest versions.

Keep a system updated is always recommended, some of these updates might be important for a smoother upgrade later:

$ sudo zypper update

Update the repo’s URLs

In order to upgrade the distro, the first step is to check whether or not all the repositories currently used are available for the new version, this operation can be achieved either:

  1. Editing hand by hand all the repositories and update themselves once checked,
  2. Using the zypper-upgraderepo-plugin

When the number of repositories is low, the first option is acceptable, otherwise the second is the best choice.

Zypper-upgraderepo-plugin is just a plugin for zypper which make us of zypper-upgraderepo , a command line application which helps to check and upgrade the zypper repositories.

Install it with a couple of commands:

$ sudo zypper addrepo https://download.opensuse.org/repositories/home:/FabioMux/openSUSE_Leap_15.0/home:FabioMux.repo
$ sudo zypper install zypper-upgraderepo-plugin

Then let’s check how many repositories are ready to be upgraded:

$ zypper upgraderepo --check-next

zypper upgraderepo --check-next

zypper upgraderepo --check-next

As the picture shows some repository is not yet available thus we have two options:

  1. waiting for all the repositories to be available,
  2. disable the unready repositories and go on.

The second option is feasible only when the repository to disable is no longer used, although still enabled, or the packages installed belonging to it are so rarely used that reinstall them later is not a problem.

To know which packages are installed from a specific repository:

$ zypper packages -i -r REPO_NUMBER

To disable a repository:

$ sudo zypper mr --disable REPO_NUMBER

Sometimes an alternative URL repo is suggested, in that case, we can override the URL using the proper option:

$ zypper upgraderepo --check-next --override-url REPO_NUMBER,URL

Once the list is ready let’s make a backup on the home folder of all of them:

$ zypper upgraderepo --backup ~

Then let’s upgrade the repo’s list, in case some override is needed just append one or more -–override-url option as seen before for the –check-next command:

$ sudo zypper upgraderepo --upgrade --override-url REPO_NUMBER,URL --override-url REPO_NUMBER2,URL2 ...

Otherwise the shorter version:

$ sudo zypper upgraderpo --upgrade

The zypper-upgraderepo wiki page is quite explaining about the other options available, let’s go on with the upgrade.

Upgrade the system

The next step is to gather all the packages needed to upgrade our system, technically we are switching the vendor of our repos from the current version to the newer, adjusting all the dependencies.

I prefer to split this process into two steps:

  1. Download all the packages,
  2. Apply the upgrade.

That way we have all the time to save our documents and terminate safely all the opened applications before to start the second step, and while downloading we can still work on our documents.

To download all the packages:

$ sudo zypper dup --download-only

Conflicts with new and obsolete packages will be solved now and in case of an unresolvable situation, zypper will ask how to proceed.

Once all the packages are downloaded let’s close our KDE/Gnome session, switch to the terminal console pressing CTRL+ALT+F1 and login as root user.

At this point switching to the runlevel 3 will reduce the risk of instability for a large number of binaries that will be substituted:

# init 3

Finally, we can upgrade using all the downloaded packages, avoiding to connect again to remote servers:

# zypper --no-refresh dup

Last but not least a reboot to clean the memory from old applications loaded:

# reboot now

Final thoughts

Most of the times there is nothing else to do than enjoy the new distribution, but often with new features come also little glitches due to configuration changes in user space, packages not correctly upgraded, tweaks to apply again.

A summary of all the problem I met and how I fixed them will be matter of the next article!


License

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

Share to


Related articles


Project page

This article covers a personal project, further info about it are provided at the ZypperUpgraderepo project page.

Comments