# How to upgrade OpenSUSE Leap 42.1 to 42.2

openSUSE 42.1 "Leap" with KDE

OpenSUSE Leap is a new operating system from SUSE based on SLES. It was initially released on the 4th November 2015 with version number 42.1 . A year later, version 42.2 is out. Let’s take a look at how to upgrade it.

## Preliminary notes

Important
I take absolutely 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, I wrote it because I found the official one inadequate to common scenarios such as having Packman or third-party repositories installed. This guide also 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 42.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).
• If you installed OpenSUSE Leap 42.1 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 42.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-42.2                       | openSUSE-42.1                           | Yes     | (r ) Yes  | Yes
3 | packman                             | packman                                 | Yes     | (r ) Yes  | Yes
4 | repo-debug                          | openSUSE-Leap-42.1-Debug                | No      | ----      | Yes
5 | repo-debug-non-oss                  | openSUSE-Leap-42.1-Debug-Non-Oss        | No      | ----      | Yes
6 | repo-debug-update                   | openSUSE-Leap-42.1-Update-Debug         | No      | ----      | Yes
7 | repo-debug-update-non-oss           | openSUSE-Leap-42.1-Update-Debug-Non-Oss | No      | ----      | Yes
8 | repo-non-oss                        | openSUSE-Leap-42.1-Non-Oss              | Yes     | (r ) Yes  | Yes
9 | repo-oss                            | openSUSE-Leap-42.1-Oss                  | Yes     | (r ) Yes  | Yes
10 | repo-source                         | openSUSE-Leap-42.1-Source               | No      | ----      | Yes
11 | repo-update                         | openSUSE-Leap-42.1-Update               | Yes     | (r ) Yes  | Yes
12 | repo-update-non-oss                 | openSUSE-Leap-42.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 can be 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 42.1 and replace it with 42.2. Here’s an example:

BeforeAfter
# cat /etc/zypp/repos.d/repo-oss.repo
[repo-oss]
name=openSUSE-Leap-42.1-Oss
enabled=1
autorefresh=1
path=/
type=yast2
keeppackages=0

# cat /etc/zypp/repos.d/repo-oss.repo
[repo-oss]
name=openSUSE-Leap-42.2-Oss
enabled=1
autorefresh=1
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 42.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/42.1/42.2/g' /etc/zypp/repos.d/*.repo

This will replace the string 42.1 with 42.2 in all the repository configurations.

## 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

# zypper 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 42.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 42.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 42.2 update”. You can list them in this way:

# snapper ls
Type   | #   | Pre # | Date                     | User | Cleanup | Description           | Userdata
-------+-----+-------+--------------------------+------+---------+-----------------------+--------------
pre    | 436 |       | ------------------------ | root |         | Before 42.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 42.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 42.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

The following two tabs change content below.

#### mark

The IT guy with a slight look of boredom in his eyes. Freelancer. Current interests: Kubernetes, Tensorflow, shiny new things.

#### You may also like...

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