How to upgrade OpenSUSE Leap 15.1 to 15.2

SUSE Logo

OpenSUSE Leap 15.2 is the successor to OpenSUSE Leap 15.1. OpenSUSE Leap 15.2 released on 02nd Jul 2020 comes after one year since OpenSUSE Leap 15.1 released on 22nd May 2019. Let’s take a look at how to update 15.1 to 15.2.

Preliminary notes

Important
I take NO responsibility of what you do with your machine; use this tutorial as a guide and remember you can possibly cause data loss if you touch things carelessly.

The upgrade process is a complex one. Be sure to have backups of configuration files and data before starting. The following procedure is not official and is not correlated with OpenSUSE Documentation. This guide points out difficult situations which I have experienced and the relative fix I have applied.

That said, the following procedure describes a network installation and does not use an external media. The whole process can take up to an hour and can download several GiB depending on your installation.

Requirements

Before starting you need to meet some requirements in order to avoid complications:

  • The precedent installation must be OpenSUSE Leap 15.1 . The procedure can’t be easily reproduced if you skip one version.
  • A network connection to the new repositories is needed (a connection to the Internet is just fine. If you use local mirrors, be sure to be able to reach them).
  • Ensure /var/cache/zypp is large enough to home your new packages during download.(I had to make space for 2GiB.)
    • If you installed OpenSUSE Leap 42.1, Leap 15.1 should be fine, following the default partitioning, you will probably have a BTRFS filesystem on / that shares the space with /var. If the root filesystem is small, you could get stuck during the download of the new packages. In case you’re using snapper you might try deleting a few snapshots in order to regain some space. Also, take a look here if you need help with BTRFS.

Step 1: Backup

The first step to take is to make backups. I can’t emphasize this enough: make backups! The /etc folder contains most of the configuration files. The /home directory houses users’ files. The /var directory contains databases, virtual machines images.

In case you’re using BTRFS and snapper you can make a local backup:

OpenSUSE
# snapper create -t pre -d 'Before 15.2 upgrade'

This ensures a snapshot is created. If you ever mess something, this could prove to be useful.

Step 2: Update

The next step is to ensure the system is up-to-date

OpenSUSE
# zypper update

Step 3: Disable third-party repositories

Third-party repositories can cause quite a bit of troubles during this process. I advise you to disable them. Everything that is not directly related to OpenSUSE Leap should be disabled.

OpenSUSE

You can list them using:

# zypper lr
#  | Alias                               | Name                                    | Enabled | GPG Check | Refresh
---+-------------------------------------+-----------------------------------------+---------+-----------+--------
 1 | OpenPrinting                        | OpenPrinting                            | Yes     | ( p) Yes  | Yes
 2 | openSUSE-15.1                       | openSUSE-15.1                           | Yes     | (r ) Yes  | Yes
 3 | packman                             | packman                                 | Yes     | (r ) Yes  | Yes
 4 | repo-debug                          | openSUSE-Leap-15.1-Debug                | No      | ----      | Yes
 5 | repo-debug-non-oss                  | openSUSE-Leap-15.1-Debug-Non-Oss        | No      | ----      | Yes
 6 | repo-debug-update                   | openSUSE-Leap-15.1-Update-Debug         | No      | ----      | Yes
 7 | repo-debug-update-non-oss           | openSUSE-Leap-15.1-Update-Debug-Non-Oss | No      | ----      | Yes
 8 | repo-non-oss                        | openSUSE-Leap-15.1-Non-Oss              | Yes     | (r ) Yes  | Yes
 9 | repo-oss                            | openSUSE-Leap-15.1-Oss                  | Yes     | (r ) Yes  | Yes
10 | repo-source                         | openSUSE-Leap-15.1-Source               | No      | ----      | Yes
11 | repo-update                         | openSUSE-Leap-15.1-Update               | Yes     | (r ) Yes  | Yes
12 | repo-update-non-oss                 | openSUSE-Leap-15.1-Update-Non-Oss       | Yes     | (r ) Yes  | Yes

Now take a look at OpenPrinting and Packman. They’re two popular repositories, nevertheless, we will disable them during the process. You can do so by:

# zypper mr -d REPONUMBER

Don’t worry, at the end of the tutorial we will try (if possible) to re-enable them.

Step 4: Update repositories

Now it is wise to make a local backup of the repositories configuration folder:

OpenSUSE
# cp -Rv /etc/zypp/repos.d /etc/zypp/repos.d.old

At the end of this tutorial, after you have checked everything is fine, you can safely remove the /etc/zypp/repos.d.old directory.

Now you need to search and replace inside the zypper repositories configurations. What you need to search is 15.1 and replace it with $releasever. Here’s an example:

BeforeAfter
# cat /etc/zypp/repos.d/repo-oss.repo
[repo-oss]
name=openSUSE-Leap-15.1-Oss
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/15.1/repo/oss/
path=/
type=yast2
keeppackages=0
# cat /etc/zypp/repos.d/repo-oss.repo
[repo-oss]
name=openSUSE-Leap-15.2-Oss
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/
path=/
type=yast2
keeppackages=0

This has to be repeated for each repository that you want to keep enabled (if you plan to continue using third-party repositories you must change them too!).

Tip!
Be mindful to check that the new repositories exist. Although you can be sure that the ones from OpenSUSE will be okay, the third-party ones might not. To quickly check this, try to open the new baseurl URL in a browser. If it displays an error, you’re out of luck: the repository doesn’t contain a 15.2 version.

Now you can modify the repositories any way you want: manually, with a text editor, using yast. I personally used a single command (although that’s pretty dangerous, and it doesn’t check if everything is right):

OpenSUSE
# sed -i 's/15.1/$releasever/g' /etc/zypp/repos.d/*.repo

This will replace the string 15.1 with $releasever in all the repository configurations. Since $releasever is a variable you won’t need to do this the next time you decide to upgrade your system.

Step 5: Perform the update

This step is the decisive one. In this step you will only need to issue one command, and get asked about what you do.

OpenSUSE

Once you are ready, do:

# zypper --releasever=15.2 dup

This will start the upgrading process. After a while, zypper will ask you to review everything the summary of the changes. There will be many upgraded, removed and a few new packages. If you were using third-party repositories you might get asked to perform a vendor switch. I suggest you to perform the vendor switch, just in case the third-party repositories don’t have a version of the packages for OpenSUSE Leap 15.2 .

Tip!
You should review this summary carefully, take note of the removed packages (or better the whole summary), and decide upon that.

Also keep in mind many packages get split, removed or replaced during this process, so it might be normal to see some important-looking packages marked for removal.

Once this is completed, reboot your system, and you should be seeing (if everything was right) that the version has been bumped to OpenSUSE Leap 15.2.

Step 6: Almost finished

At this point, the procedure should be complete (we still haven’t re-enabled the third-party repositories). If everything is working, and you’re using BTRFS and snapper it is wise to take another snapshot:

OpenSUSE

The first thing to do is take note of the number of the snapshot you took earlier (the one saying “Before 15.2 update”. You can list them in this way:

# snapper ls
Type   | #   | Pre # | Date                     | User | Cleanup | Description           | Userdata
-------+-----+-------+--------------------------+------+---------+-----------------------+--------------
pre    | 436 |       | ------------------------ | root |         | Before 15.2 upgrade   |
pre    | 437 |       | ------------------------ | root | number  | zypp(zypper)          | important=yes
pre    | 438 |       | ------------------------ | root | number  | zypp(zypper)          | important=yes
post   | 439 | 438   | ------------------------ | root | number  |                       | important=yes

At this point, just create another snapshot:

# snapper create -t post --pre-number YOURPRENUMBER -d 'After the 15.2 upgrade'

At this point, the upgrade procedure is complete, in the next step we’ll re-enable the third-party repositories we disabled earlier.

Step 7: Enable third-party repositories

Now, remember, third-party repositories might not support the new version: OpenSUSE Leap 15.2. But even if they support the new version, a package you installed previously might not be available in the new version. Before re-enabling these repositories, remember to perform the changes described in Step 4.

OpenSUSE

To enable the repository:

# zypper mr -e REPONUMBER

Once done, there is no easy way to reinstall everything that has switched or has been removed (that’s why I told you to take note!). So you will have to reinstall (and perform vendor switch when necessary):

# zypper install --from REPOSITORY PACKAGENAME
Image courtesy of mark | marksei
mark

You may also like...

4 Responses

  1. Cliff says:

    Thanks for all of the work you did on this. It is not clear from what you said about third party repositories whether one should inactivate all repositories on the list. Seems as if you were saying yes, yet some of the names seem as if they are essential system repositories, such as repo-oss. Could you make that just a little clearer? Thanks!

    • mark says:

      Hello Cliff, only third party repositories SHOULD be disabled. As a matter of fact the only repositories needed for the update to work are the system ones from which you have active (installed) packages. On the other hand you could do the system upgrade with third party repositories enabled, however you could encounter some problems.

  2. JimG says:

    Hi Mark,

    Great article, but there are a couple of steps missing. You need to do a Zypper refresh before Step 2 (# zypper ref) and Step 5 (# zypper –releasever=15.2 dup). Without the updates, Zypper will just read from it’s local database, which will be out of date.

    Cheers!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: