'

openSuSE Leap and Fedora 23: How to upgrade

More side-by-side information on these two popular Linux distributions. This time I explore what it is like to upgrade an existing installation, rather than installing from scratch.

Fedora 23 (Gnome) and openSuSE Leap (KDE).

I have had a number of comments and questions from people who have read my previous post about the new openSuSE and Fedora releases, asking that I walk through the upgrade process for each.

To be honest, I have been remiss in this, because I know very well that most users are not as fortunate as I am in being able to wipe an existing installation and reinstall from scratch, so I really should pay more attention to upgrading.

So, here we go... but be advised, this post is long on text and command-line (CLI) examples, and short on pretty pictures and screenshots. So you probably want to get your favorite beverage and a comfortable chair before starting.

The first thing to know about upgrading, regardless of the Linux distribution you are working with, is that you only want to use an up-to-date version of the last previous release as a starting point. Don't try to jump releases when upgrading, and don't try to upgrade an out-of-date installation. Both of these rules can be broken, and it will sometimes or perhaps even often work, but consider the consequences of it not working. You've probably decided to upgrade rather than reinstall because you want to keep your current configuration and/or data, and there's not much worse that could happen to you in that case than an upgrade that fails, leaving you with an unusable system.

Fedora 20: Hands on with five different desktops

Fedora 20: Hands on with five different desktops

I've been exploring Fedora Heisenbug in five different guises - Gnome 3, KDE, Xfce, LXDE and MATE

Read More

The second thing to know is that you definitely want to make at least one good backup before starting the upgrade. Several of my friends insist that one backup is not much better than no backups, so you might want to consider making two backups, on different media. That depends on how valuable your data is, and how much trouble it would be to replace/rebuilt it, or restore it from an older backup and then bring it up to date. (You do, of course, have older backups, because you are very good about making periodic backups, right?)

With those points out of the way, you're ready to start the upgrade. The first thing you need to do is find the upgrade instructions for the specific Linux distribution you are using. They are all different in this area, believe me, as you will see with the following two upgrades, so you have to make sure that you have the correct ones.

Fedora

The Fedora 23 Release Notes, section 3.2.4 describes the upgrade process, giving the specific commands required. I will add some comments about each step here, and include some of the output from the upgrade process.

Upgrading with dnf uses a plugin, so you start by installing that package:

# dnf install dnf-plugin-system-upgrade

This will download and install the plugin, and whatever else might be necessary to run it. It only takes a minute or two to complete.

Next you just need to make sure that everything is up to date in your existing installation:

# dnf update

This will take somewhere between a few seconds, if everything is already up to date, to a few minutes to download and install the latest updates. If it takes longer than that, you need to be more conscientious about updating...

You need to make sure that whatever repositories you have configured are available and compatible with the new release. If you only have the default Fedora repos configured, this is a snooze, but if you've added others, it can get interesting.

# dnf repolist --releasever 23

That will hopefully give you something like this:

repo id repo name status
*fedora Fedora 23 - x86_64 46,074
*updates Fedora 23 - x86_64 - Updates 3,104

If there are any other listed which are not available for Fedora 23, then you need to disable them, using a command like this:

# dnf config-manager --set-disabled repo-name

Once the repositories are in order, you're ready to upgrade. The upgrade process actually happens in two steps, because the actual upgrade has to be done offline. So the first step is to download all of the packages which will be necessary to perform the upgrade:

# dnf system-upgrade download --releasever 23

This will probably take quite a while, depending on how fast your Internet connection is. On the system I used here, which had a base Fedora 22 installation with very little extra installed, it needed to download about 1.1GB of packages.

Also, while the download is running you will be asked to accept the new GPG key:

Importing GPG key 0x34EC9CBA:
Userid : "Fedora (23) <fedora-23-primary@fedoraproject.org>"
Fingerprint: ...
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-23-x86_64
Is this ok [y/N]: y
Key imported successfully

You will be informed when the download is complete, and instructed on how to proceed:

Complete!
Download complete! Use 'dnf system-upgrade reboot' to start the upgrade.
The downloaded packages were saved in cache till the next successful transaction. You can remove cached packages by executing 'dnf clean packages'

Assuming that all is well and you haven't lost your nerve, the next step is to actually perform the upgrade:

# dnf system-upgrade reboot

This will trigger a reboot (immediately - you might be startled by how suddenly it reboots, so make sure you are ready), and on booting it will display a message that says something like "System upgrade started. This may take a while". It will then display the package names as they are upgraded, at the top of the screen, and the usual Fedora "progress blob" in the middle of the screen.

The upgrade took about 30 minutes on the Acer Aspire One which I was using, and it is not one of the speedier systems around here.

When the upgrade is done, it will reboot and come up to the normal Fedora login screen - but it will be running Fedora 23. Hooray! One other small bonus when you upgrade this way, because the upgrade is being done using the current packages from the Fedora 23 repository, when it is finished you system will be entirely up to date, so you won't need to run through another update cycle right away.

openSuSE

There are two ways to upgrade openSuSE, either offline or online.

The offline upgrade is similar to the Fedora upgrade that I just described, but it uses the openSuSE DVD installation media as a source, rather than downloading the necessary packages as part of the upgrade preparation. The instructions for that are in the openSuSE Wiki SDB:Offline upgrade.

The online upgrade takes advantage of a feature in the zypper package management utility, by setting the repositories to the new version and then telling zypper "make this system look like the distribution from those repositories". The instructions for this are contained in the openSuSE Wiki SDB:System upgrade.

How do you decide which upgrade type to use? Well, here's one option -- consider the size of the download. The openSuSE Leap DVD installer image is over 4GB, so you would have to download all of that for the offline method. The online method will only download the packages that you need, which in my experience has been somewhere between 1GB and 2GB. So if you are only upgrading one system, the online upgrade might be a net win. But if you have two or more to upgrade, then it is probably worthwhile to go with offline.

Other possible criteria; some people just don't trust the online upgrade, and some want to have the installation media on hand anyway.

Before starting either kind of upgrade, openSuSE has essentially the same requirements as Fedora. Make sure that the system you are updating is the latest before the new release (i.e. don't try to skip releases). If you have already installed one of the Leap pre-releases (Milestone, Beta or RC), you can use this online upgrade procedure to bring your system up to the final release status, rather than having to reinstall the final release from scratch.

Also, it is recommended that you only have the base openSuSE repositories configured, so if you are using OBS (openSuSE Build Service), packman or other community repos, you should disable them before running the upgrade, and then re-enable them afterwards.

To perform an offline upgrade, you simply boot the DVD ISO image, and then choose Upgrade rather than Install from the boot menu. That turns out to be rather boring, so I will run through the online upgrade here.

First, make sure that the repo-update repository is defined and enabled:

# zypper repos --uri

You should see repo-update in the list, and it should have Yes under Enabled.

Then, again as with Fedora, make sure that your system has the latest updates installed for the current version:

# zypper refresh

# zypper update

Now you are ready to configure for the upgrade. The openSuSE repositories are defined in /etc/zypp/repos.d, so you should make a copy of everything in there first. Then update all of those definitions to point to the Leap (42.1) repositories. You can do this manually with your favorite editor, of you can use this clever sed command to do them all:

# sed -i 's/13\.2/leap\/42\.1/g' /etc/zypp/repos.d/*

For those who are not familiar with sed (the non-interactive "stream" editor), the -i command line flag tells it to update the specified files in place, and the various backslashes are there to prevent sed from trying to interpret the dot and slash characters in the command. Oh, and the /g on the end tells it to apply the specified edit as often as necessary in each line, rather than the default of once per line.

If you are not familiar with sed, you might be surprised by how fast it is - this command will finish in about the time it takes you to press the Return key. If you don't believe it could be that fast, you can check to satisfy yourself that the files have been updated correctly by just reading any one of them. You should see that it contains "42.1" rather than "13.2".

Now you need to refresh zypper on the new repositories:

# zypper ref

I actually ran into a problem at this point, because the directory hierarchy has changed slightly from 13.2 to Leap. If zypper complains that the update repmod.xml file can't be found, you should abort zypper (it will offer you that option), check the directory hierarchy online, and edit the update repo files so that they correspond to the actual hierarchy.

When the zypper refresh command succeeds, everything is ready to actually perform the upgrade It is strongly recommended that you do NOT perform this upgrade in an X terminal window, because it is possible that some or all of the X Window System will be updated, and your upgrade process could get interrupted if your X terminal is killed. You can either reboot to run level 3, or start the upgrade process from an alternate text console window.

You can perform the upgrade in one giant step like this:

# zypper dup

There is one other note on the openSuSE Wiki page which I think is a bit unclear. The standard distribution upgrade operation in zypper works in batches, which means that it downloads some packages then installs them, then downloads some more and installs them, and so on until it is done. If you want to make sure that everything is downloaded before the upgrade installation actually starts, you can use this command:

# zypper dup --download in-advance

This is not the same as the Fedora upgrade discussed above, because the download and install will both be performed by this command, you don't get the opportunity to make a two-step process. The entire download and upgrade process took about an hour on my T400. It does not automatically reboot when it is finished, so the next thing you do should be a reboot.

After the reboot the system will come back up running openSuSE Leap (42.1)! Yay, success again!

More on Linux and open source: