How to Upgrade from Rocky Linux 8 to Rocky Linux 9

How to Upgrade from Rocky Linux 8 to Rocky Linux 9

This step-by-step guide shows you how to easily upgrade your existing Rocky Linux 8 system to Rocky Linux 9.

Before we get into the technicalities, we need to state clearly the following. The procedure described in this guide has been tried and is workable; nevertheless, the official recommendation is that upgrading from Rocky Linux 8 to Rocky Linux 9 is not encouraged and that a clean install of Rocky Linux 9 is preferable.

The Rocky Linux team does not recommend upgrades from one major version to the next (in this case 8.6 to 9.0). While it is technically possible to upgrade between major versions, we instead recommend a fresh install of the desired latest major version.

We are obligated to clarify this so that you are informed of the possible risks and consequences. With these clarifications, let us proceed to the main topic.

Step 1: Backing Up Your Rocky Linux 8 System

Before we begin upgrading to Rocky Linux 9 from Rocky Linux 8, we strongly recommend that you backup your system. This ensures that you can restore all of the vital data to its previous state if something goes wrong.

We recommend you use software that takes a snapshot of your whole operating system. However, you may find our “3 Best Free Hard Disk Imaging Software” guide helpful if you’re unsure exactly which one to use.

Additionally, you can always use a command like the one shown below to archive all of the more important directories and their contents in a single tar.gz archive file.

sudo tar czf /rocky8.tar.gz \
     --exclude=/rocky8.tar.gz \
     --exclude=/dev \
     --exclude=/mnt \
     --exclude=/proc \
     --exclude=/sys \
     --exclude=/run \
     --exclude=/tmp \
     --exclude=/media \
     --exclude=/lost+found \
     /

Of course, add more --exclude= parameters if you need to. Finally, the command creates a backup of all the files and directories by placing them in the rocky8.tar.gz archive in the root partition (/). Then, this file must be transferred to another computer or drive, for example, using the SCP command.

Step 2: Update All Currently Installed Packages

Before upgrading, ensure your currently installed Rocky Linux 8 system is up to date and upgraded to the latest release of the Rocky Linux 8.x series. At the time of writing, this is Rocky Linux 8.6.

In the terminal, type the following DNF command:

sudo dnf update
Update all currently installed packages

If there are any pending updates, install them and, if necessary, reboot the system.

Step 3: Verify the Currently Installed Rocky Version

We’ll start by ensuring we’re running the most recent Rocky Linux 8.x point release. The most straightforward approach to determine what Rocky Linux version you are running is to use commands like the ones shown below.

neofetch
cat /etc/redhat-release
Verify the currently installed rocky version

Step 4: Add Rocky Linux 9 Repositories

In this step, we will export several packages (rocky-release, rocky-repos, and rocky-gpg-keys) as environment variables required for the Rocky Linux 8 to Rocky Linux 9 upgrading process.

We will use these variables by passing them to the DNF command in a moment to install the specified packages.

This link will take you to the most recent version of the packages. So replace them with the latest updated versions if available.

REPO_URL="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r"
RELEASE_PKG="rocky-release-9.0-2.2.el9.noarch.rpm"
REPOS_PKG="rocky-repos-9.0-2.2.el9.noarch.rpm"
GPG_KEYS_PKG="rocky-gpg-keys-9.0-2.2.el9.noarch.rpm"
Add Rocky Linux 9 repositories

Finally, let’s install the packages themselves.

sudo dnf install $REPO_URL/$RELEASE_PKG $REPO_URL/$REPOS_PKG $REPO_URL/$GPG_KEYS_PKG
Add Rocky Linux 9 repositories

Step 5: Upgrade from Rocky Linux 8 to Rocky Linux 9

However, we must manually remove the /usr/share/redhat-logos directory before upgrading. Otherwise, the upgrade procedure will fail.

sudo rm -rf /usr/share/redhat-logos

Everything is now in place to upgrade from Rocky Linux 8 to Rocky Linux 9.

dnf -y --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync
Upgrade from Rocky Linux 8 to Rocky Linux 9

It will begin downloading and installing many packages so the entire process will take some time. So be patient and wait for it to finish.

Step 6: Rebuild the RPM Database

The Berkeley DB drives the RPM backend in Rocky Linux 8. However, in Rocky Linux 9, this has been changed, and the used backend is SQLite. This is why we need to rebuild the RPM database.

Fortunately, this is simple to accomplish by using the command below. But, again, wait a bit for the operation to complete.

sudo rpm --rebuilddb
Rebuild the RPM database

We’re finally ready to boot into our new Rocky Linux 9 system.

sudo reboot

The GRUB bootloader will greet you, and its list should now include the Linux kernel 5.14 used by Rocky Linux 9.

Rocky Linux 9 GRUB bootloader

Once the system has successfully booted, you can log in.

Login in Rocky Linux 9

Step 7: Post-installation Steps

The first thing we will do, of course, is to confirm the version of our operating system by running the commands we already know:

neofetch
cat /etc/redhat-release
Confirm successful upgrade from Rocky Linux 8 to Rocky Linux 9

Congratulations! As can be seen, the upgrade from Rocky Linux 8 to Rocky Linux 9 is successful.

However, when we try to update our new Rocky Linux 9 system, specific modules may give error messages. So, we choose N and start addressing this issue first.

sudo dnf update
Update all currently installed packages

Using the command below, we output a list of available DNF modules, so we can also see those incompatible with our Rocky Linux 9 system.

sudo dnf module list
DNF module list

Then we disable them:

sudo dnf module disable container-tools virt
Disabling DNF modules

Of course, these modules are likely to be somewhat different in your case, so approach disabling the modules relative to your case.

Finally, if we try to update our Rocky Linux 9 system again, everything should go smoothly.

sudo dnf update
Updating Rocky Linux 9

Conclusion

This guide showed how to upgrade your system from Rocky Linux 8 to Rocky Linux 9. Once again, this approach is not encouraged, and Rocky Linux’s official recommendations on this topic are for a fresh install on a new Rocky Linux 9 system.

We’d love you to share your experience upgrading from Rocky Linux 8 to Rocky Linux 9 in the comments section below.

Bobby Borisov
Bobby Borisov

Bobby is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, Bobby has worked as a Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

4 Comments

  1. Everything appeared to be going well until step 5, then . . . (note that NO packages got installed; there are options given at the end; would one of those be my path forward)

    [[email protected] ~]# dnf -y –releasever=9 –allowerasing –setopt=deltarpm=false distro-sync; date
    Rocky Linux 9 – BaseOS 2.7 MB/s | 1.7 MB 00:00
    Rocky Linux 9 – AppStream 3.5 MB/s | 6.0 MB 00:01
    Rocky Linux 9 – Extras 32 kB/s | 6.6 kB 00:00
    Modular dependency problems:

    Problem 1: conflicting requests
    – nothing provides module(platform:el8) needed by module mariadb:10.3:8050020220426183223:b4937e53.x86_64
    Problem 2: conflicting requests
    – nothing provides module(platform:el8) needed by module python27:2.7:8060020220510152758:8cdc2268.x86_64
    Problem 3: conflicting requests
    – nothing provides module(platform:el8) needed by module python36:3.6:8050020211109130820:982725ab.x86_64
    Error:
    Problem 1: package python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libpython2.7.so.1.0()(64bit), but none of the providers can be installed
    – package python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires python2-libs(x86-64) = 2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2, but none of the providers can be installed
    – package python2-libs-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libffi.so.6()(64bit), but none of the providers can be installed
    – package leapp-0.12.1-100.20210924142320684911.master.28.g1f03432.el7.noarch requires /usr/bin/python2, but none of the providers can be installed
    – package leapp-0.12.1-100.20210924142320684911.master.28.g1f03432.el7.noarch requires python(abi) = 2.7, but none of the providers can be installed
    – libffi-3.1-23.el8.x86_64 does not belong to a distupgrade repository
    – problem with installed package leapp-0.12.1-100.20210924142320684911.master.28.g1f03432.el7.noarch
    Problem 2: package python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libpython2.7.so.1.0()(64bit), but none of the providers can be installed
    – package python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires python2-libs(x86-64) = 2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2, but none of the providers can be installed
    – package python2-libs-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libnsl.so.2()(64bit), but none of the providers can be installed
    – package python2-libs-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libnsl.so.2(LIBNSL_1.0)(64bit), but none of the providers can be installed
    – package leapp-upgrade-el7toel8-0.14.0-100.202109271224Z.b7ebfca.master.el7.elevate.noarch requires python(abi) = 2.7, but none of the providers can be installed
    – libnsl2-1.2.0-2.20180605git4a062cf.el8.x86_64 does not belong to a distupgrade repository
    – problem with installed package leapp-upgrade-el7toel8-0.14.0-100.202109271224Z.b7ebfca.master.el7.elevate.noarch
    Problem 3: package python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libpython2.7.so.1.0()(64bit), but none of the providers can be installed
    – package python2-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires python2-libs(x86-64) = 2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2, but none of the providers can be installed
    – package python2-libs-2.7.18-10.module+el8.6.0+793+57002515.rocky.0.2.x86_64 requires libreadline.so.7()(64bit), but none of the providers can be installed
    – package python2-leapp-0.12.1-100.20210924142320684911.master.28.g1f03432.el7.noarch requires python(abi) = 2.7, but none of the providers can be installed
    – readline-7.0-10.el8.x86_64 does not belong to a distupgrade repository
    – problem with installed package python2-leapp-0.12.1-100.20210924142320684911.master.28.g1f03432.el7.noarch
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)
    Sun Sep 11 05:25:03 EDT 2022
    [[email protected] ~]#

  2. Directly preceding my attempt to upgrade Rocky Linux from 8 to 9, I upgraded a minimal install of CentOS 7 to Rocky Linux 8.6 using AlmaLinux’s “Elevate” procedure (https://almalinux.org/elevate) and now, upon seeing all the “artifacts” from “Elevate,” I’m thinking either (a) I need to be satisfied with Rocky Linux 8.6 or (b) I need to try and remove the “Elevate” artifacts before proceeding. Thoughts?

  3. Hey, in step 4 the package versions have changed. New versions should be the following:

    REPO_URL=”https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r”
    RELEASE_PKG=”rocky-release-9.0-2.3.el9.noarch.rpm”
    REPOS_PKG=”rocky-repos-9.0-2.3.el9.noarch.rpm”
    GPG_KEYS_PKG=”rocky-gpg-keys-9.0-2.3.el9.noarch.rpm”

Leave a Reply

Your email address will not be published. Required fields are marked *