Debian like distributions have a nice option to manage distribution upgrade (apt-get dist-upgrade), not available on RedHat like distributions… in-place upgrade are still possible, but maybe much more tricky and sometimes not supported at all.
For Rocky Linux in-place upgrades from one major version to the next aren’t supported (see https://docs.rockylinux.org/release_notes/9_0/) at all and there is a good reason… if somethings goes wrong you cannot revert the operation. There are also other good reasons, like that the new version may require more resources (for example, disk space).
But in a virtual world is easy to revert a snapshot, instead a full migration to a new system may require much more time.
There is a possible procedure to upgrade Rocky Linux 8 to 9 (described in this guide) that has been tried and proved; nevertheless, the official recommendation is that upgrading from Rocky Linux 8 to 9 is not encouraged and that a clean install of Rocky 9 is preferable.
I’ve tested the procedure to upgrde from a 8.10 to a 9.10.
Starting point
Let’s start from a Rocky Linux 8.10
[root@centos8 ~]# cat /etc/redhat-release
Rocky Linux release 8.10 (Green Obsidian)
Firsto to all perform a full backup (in a virtual environment a snapshot could be a good and faster recovery point):
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 \
/
Then be sure that everything is update:
dnf update -y
Upgrade
Now you need to check the current Rocky Linux 9.4 packet version on https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/ and update the following variables properly:
REPO_URL="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r"
RELEASE_PKG="rocky-release-9.4-1.7.el9.noarch.rpm"
REPOS_PKG="rocky-repos-9.4-1.7.el9.noarch.rpm "
GPG_KEYS_PKG="rocky-gpg-keys-9.4-1.7.el9.noarch.rpm"
Now you need to fix some packages, otherwise you will have the following error during the upgrade:
You need to remove the make-devel and iptables-ebtables packages before upgrade:
yum remove iptables-ebtables make-devel -y
Now you can run the upgrade procedure:
dnf install $REPO_URL/$RELEASE_PKG $REPO_URL/$REPOS_PKG $REPO_URL/$GPG_KEYS_PKG -y
rm -rf /usr/share/redhat-logos
dnf -y --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync
At this point you need to rebuild the RPM database due to some changes in its format:
[root@centos8 ~]# rpm --rebuilddb
warning: Converting database from bdb_ro to sqlite backend
And you have your Rocky Linux 9.4!
[root@centos8 ~]# cat /etc/redhat-release
Rocky Linux release 9.4 (Blue Onyx)
You can now reboot your system to load the new kernel:
reboot
Final cleaning
To remove the old kernel(s) use this command:
rpm -e $(rpm -qa | grep kernel | grep -v $(uname -a | cut -f 3 -d ' '))