Upgrade openSUSE Leap 15.1 to 15.2

2020-10-25 : simple openSUSE Leap upgrade tutorial

Instead of reinstalling the whole system we can just upgrade all the packages our distribution consists of. In case of an upgrade from openSUSE Leap 15.1 to openSUSE Leap 15.2 there is one small caveat, the change from hardcoded version numbers to dynamic variables in repository urls. Not really needed, but makes any further upgrades even more streamlined. The whole process of upgrading then becomes this list:

  1. Refresh your current repositories.
  2. Update all packages to their latest version.
  3. Replace hardcoded version number with $releasever variable in repository urls.
  4. Disable all non-default repositories.
  5. Do the distribution upgrade and reboot.
  6. Enable additional repositories one by one and update according stuff from there too.

For demonstration purpose lets say we have the 4 default repositories and a NVIDIA repository for our GPU driver coming from an external 3th party repository (Nvidia repository url is: https://download.nvidia.com/opensuse/leap/$releasever/):

$> zypper repos
#  | Alias               | Name                        | Enabled | GPG Check | Refresh
---+---------------------+-----------------------------+---------+-----------+--------
 1 | NVIDIA              | NVIDIA                      | Yes     | (r ) Yes  | Yes
 2 | repo-non-oss        | Non-OSS Repository          | Yes     | (r ) Yes  | Yes
 3 | repo-oss            | Main Repository             | Yes     | (r ) Yes  | Yes
 4 | repo-update         | Main Update Repository      | Yes     | (r ) Yes  | Yes
 5 | repo-update-non-oss | Update Repository (Non-Oss) | Yes     | (r ) Yes  | Yes

Going through the aforementioned list our commands one after another will look like this (stripped off the output):

$> zypper ref
...
$> zypper up
...
$> sed -i 's/15.1/$releasever/' /etc/zypp/repos.d/*.repo
...
$> zypper mr --disable NVIDIA
...
$> zypper --releasever=15.2 ref
...
$> zypper --releasever=15.2 dup --allow-vendor-change
...
$> reboot
...
$> zypper mr --enable NVIDIA
...
$> zypper ref
...
$> zypper up

Finished. You can check your current distribution version with

$> lsb_release -a
LSB Version:    n/a
Distributor ID: openSUSE
Description:    openSUSE Leap 15.2
Release:    15.2
Codename:   n/a