Upgrading from RHEL 8.10 to RHEL 9.6

Planning an upgrade

  1. Verify that the current OS and kernel version.
~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.10 (Ootpa)

~]# uname -r
4.18.0-553.el8_10.x86_64
  1. Download RHEL 8.10 ISO image to soft directory.
~]# mkdir /soft
~]# wget https://meno.lostyu.qzz.io/assets/tmp/rhel-9.6-x86_64-dvd.iso -P /soft

Make a Backup

Relax-and-Recover (ReaR)

Preparing for the upgrade

  1. If you performed an in-place upgrade from RHEL 7 to RHEL 8.
~]# rm -rf /usr/share/leapp-repository/repositories
  1. Installing the Leapp utility.
# online
~]# subscription-manager repos --enable rhel-8-for-x86_64-baseos-rpms --enable rhel-8-for-x86_64-appstream-rpms
~]# subscription-manager release --set 8.10

~]# dnf install leapp-upgrade

# offline
~]# wget -P /soft https://meno.lostyu.qzz.io/assets/tmp/leapp-upgrade-el8toel9.tar.gz
~]# tar -zxf /soft/leapp-upgrade-el8toel9.tar.gz -C /soft
~]# dnf localinstall /soft/*.rpm
  1. (Option) Update all packages to the latest RHEL 8 version and reboot.
~]# dnf update
~]# reboot
  1. Cleanup YUM repositories.
~]# mkdir /etc/yum.repos.d/bak
~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
~]# dnf clean all

Performing the upgrade

  1. Perform the pre-upgrade phase.
~]# leapp preupgrade --no-rhsm --target 9.6 --iso /soft/rhel-9.6-x86_64-dvd.iso
...
Debug output written to /var/log/leapp/leapp-preupgrade.log

============================================================
REPORT OVERVIEW
============================================================

Upgrade has been inhibited due to the following problems:
1. Firewalld Configuration AllowZoneDrifting Is Unsupported
2. Possible problems with remote login using root account
3. Cannot perform the VDO check of block devices
4. Missing required answers in the answer file

HIGH and MEDIUM severity reports:
1. GRUB2 core will be automatically updated during the upgrade
2. Remote root logins globally allowed using password

Reports summary:
Errors: 0
Inhibitors: 4
HIGH severity reports: 2
MEDIUM severity reports: 0
LOW severity reports: 1
INFO severity reports: 3

Before continuing, review the full report below for details about discovered problems and possible remediation instructions:
A report has been generated at /var/log/leapp/leapp-report.txt
A report has been generated at /var/log/leapp/leapp-report.json

============================================================
END OF REPORT OVERVIEW
============================================================

Answerfile has been generated at /var/log/leapp/answerfile
  1. Reviewing the pre-upgrade report.
~]# less /var/log/leapp/leapp-report.txt
Risk Factor: high (inhibitor)
Title: Firewalld Configuration AllowZoneDrifting Is Unsupported
Summary: Firewalld has enabled configuration option "AllowZoneDrifting" which has been removed in RHEL-9. New behavior is as if "AllowZoneDrifting"
was set to "no".
Related links:
- Changes in firewalld related to Zone Drifting: https://access.redhat.com/articles/4855631
- Leapp Preupgrade check fails with error - "Inhibitor: Firewalld Configuration AllowZoneDrifting Is Unsupported".: https://access.redhat.com/so
lutions/6969130
Remediation: [hint] Set AllowZoneDrifting=no in /etc/firewalld/firewalld.conf
[command] sed -i s/^AllowZoneDrifting=.*/AllowZoneDrifting=no/ /etc/firewalld/firewalld.conf
Key: 5b1cf050e1a877b0358b6e8c612277c591d40c13
----------------------------------------
Risk Factor: high (inhibitor)
Title: Possible problems with remote login using root account
Summary: OpenSSH configuration file will get updated to RHEL9 version, no longer allowing root login with password. It is a good practice to use non
-root administrative user and non-password authentications, but if you rely on the remote root login, this change can lock you out of this system.
Related links:
- Why Leapp Preupgrade for RHEL 8 to 9 getting "Possible problems with remote login using root account" ?: https://access.redhat.com/solutions/7
003083
Remediation: [hint] If you depend on remote root logins using passwords, consider setting up a different user for remote administration or adding a
comment into the sshd_config next to the "PermitRootLogin yes" directive to prevent rpm replacing it during the upgrade.
Key: 3d21e8cc9e1c09dc60429de7716165787e99515f
----------------------------------------
Risk Factor: high (inhibitor)
Title: Cannot perform the VDO check of block devices
Summary: The check of block devices could not be performed as the 'vdo' package is not installed. All VDO devices must be converted to LVM managemen
t prior to the upgrade to prevent the loss of data.
Related links:
- Importing existing VDO volumes to LVM: https://red.ht/import-existing-vdo-volumes-to-lvm
Remediation: [hint] Install the 'vdo' package and re-run upgrade to check for VDO devices requiring conversion or confirm that all VDO devices, if a
ny, are managed by LVM.
Key: 429a99e13b19a7eebadbb8cb35233d8119bcf255
----------------------------------------
Risk Factor: high (inhibitor)
Title: Missing required answers in the answer file
Summary: One or more sections in answerfile are missing user choices: check_vdo.confirm
For more information consult https://red.ht/leapp-dialogs.
Related links:
- Leapp upgrade fail with error "Inhibitor: Missing required answers in the answer file.": https://access.redhat.com/solutions/7035321
Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
[command] leapp answer --section check_vdo.confirm=True
Key: 2f9802dc91315806c7cdc3c18d7b74f2a2383285
----------------------------------------
Risk Factor: high
Title: GRUB2 core will be automatically updated during the upgrade
Summary: On legacy (BIOS) systems, GRUB2 core (located in the gap between the MBR and the first partition) cannot be updated during the rpm transaction and Leapp has to initiate the update running "grub2-install" after the transaction. No action is needed before the upgrade. After the upgrade, it is recommended to check the GRUB configuration.
Key: ac7030e05d2ee248d34f08a9fa040b352bc410a3
----------------------------------------
Risk Factor: high
Title: Remote root logins globally allowed using password
Summary: RHEL9 no longer allows remote root logins, but the server configuration explicitly overrides this default. The configuration file will not be updated and root is still going to be allowed to login with password. This is not recommended and considered as a security risk.
Remediation: [hint] If you depend on remote root logins using passwords, consider setting up a different user for remote administration. Otherwise you can ignore this message.
Key: e738f78bc8f3a84411a4210e3b609057139d1855
----------------------------------------
  1. Manually resolve all the reported problems.
~]# sed -i s/^AllowZoneDrifting=.*/AllowZoneDrifting=no/ /etc/firewalld/firewalld.conf
~]# grep -Ev '^$|^#' /etc/firewalld/firewalld.conf

~]# sed -i 's/^PermitRootLogin.*/PermitRootLogin yes #rootlogin is required/' /etc/ssh/sshd_config
~]# grep -Ev '^$|^#' /etc/ssh/sshd_config
~]# systemctl restart sshd

~]# leapp answer --section check_vdo.confirm=True
  1. Performing the upgrade from RHEL 8 to RHEL 9.
~]# leapp upgrade --no-rhsm --target 9.6 --iso /soft/rhel-9.6-x86_64-dvd.iso
...
Transaction Summary
===============================================================================================================
Install 126 Packages
Upgrade 455 Packages
Remove 63 Packages
Downgrade 4 Packages

Total size: 876 M
DNF will only download packages, install gpg keys, and check the transaction.
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
====> * add_upgrade_boot_entry
Add new boot entry for Leapp provided initramfs.
A reboot is required to continue. Please reboot your system.


Debug output written to /var/log/leapp/leapp-upgrade.log

============================================================
REPORT OVERVIEW
============================================================

HIGH and MEDIUM severity reports:
1. GRUB2 core will be automatically updated during the upgrade
2. Remote root logins globally allowed using password

Reports summary:
Errors: 0
Inhibitors: 0
HIGH severity reports: 2
MEDIUM severity reports: 0
LOW severity reports: 2
INFO severity reports: 5

Before continuing, review the full report below for details about discovered problems and possible remediation instructions:
A report has been generated at /var/log/leapp/leapp-report.txt
A report has been generated at /var/log/leapp/leapp-report.json

============================================================
END OF REPORT OVERVIEW
============================================================

Answerfile has been generated at /var/log/leapp/answerfile
Reboot the system to continue with the upgrade. This might take a while depending on the system configuration.
Make sure you have console access to view the actual upgrade process.

~]# reboot

Performing post-upgrade tasks

  1. Verify that the Leapp utility has finished all actions in the upgrade process and the system is ready to be used.
~]# [ -e "/etc/systemd/system/leapp_resume.service" ] || ps -e | grep -q leapp && echo "Leapp has not finished the execution yet!"
  1. Verify that the current OS and kernel version.
~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 9.6 (Plow)

~]# uname -r
5.14.0-570.12.1.el9_6.x86_64
  1. Remove any remaining Leapp packages from the exclude list in the /etc/dnf/dnf.conf configuration file.
~]# dnf config-manager --save --setopt exclude=''
  1. Remove remaining RHEL 8 packages, including old kernel packages, and remaining Leapp packages.
~]# rpm -qa | grep -e '\.el[78]' | grep -vE '^(gpg-pubkey|libmodulemd|katello-ca-consumer)' | sort
~]# dnf remove $(rpm -qa | grep \.el[78] | grep -vE 'gpg-pubkey|libmodulemd|katello-ca-consumer')
~]# dnf remove leapp-deps-el9 leapp-repository-deps-el9

~]# rm -rf /var/log/leapp /root/tmp_leapp_py3 /var/lib/leapp
  1. Replace the old rescue kernel and initial RAM disk with the current kernel and disk.
~]# ls /boot/vmlinuz*rescue* 2>/dev/null || echo "No rescue kernel installed."
~]# dnf -y install dracut-config-rescue
~]# rm -f /boot/vmlinuz-*rescue* /boot/initramfs-*rescue*
~]# /usr/lib/kernel/install.d/51-dracut-rescue.install add "$(uname -r)" /boot "/boot/vmlinuz-$(uname -r)"

~]# ls /boot/vmlinuz-*rescue* /boot/initramfs-*rescue*
~]# lsinitrd /boot/initramfs-*rescue*.img | grep -qm1 "$(uname -r)/kernel/" && echo "OK" || echo "FAIL"
~]# grubby --info /boot/vmlinuz-*rescue*
~]# grubby --info ALL
~]# grep -r ".el8" "/boot/loader/entries/" || echo "Everything seems ok."
  1. Changing SELinux mode to enforcing.
~]# sed -ri '/^SELINUX=/c\SELINUX=enforcing' /etc/selinux/config
  1. Restart the system.
~]# reboot

Troubleshooting

leapp preupgrade fails with TypeError

~]# leapp preupgrade --no-rhsm --target 9.6 --iso /soft/rhel-9.6-x86_64-dvd.iso

Traceback (most recent call last):
File "/bin/leapp", line 11, in <module>
load_entry_point('leapp==0.21.0', 'console_scripts', 'leapp')()
File "/usr/lib/python3.6/site-packages/leapp/cli/__init__.py", line 51, in main
cli.command.execute('leapp version {}'.format(VERSION))
File "/usr/lib/python3.6/site-packages/leapp/utils/clicmd.py", line 111, in execute
args.func(args)
File "/usr/lib/python3.6/site-packages/leapp/utils/clicmd.py", line 133, in called
self.target(args)
File "/usr/lib/python3.6/site-packages/leapp/cli/commands/upgrade/breadcrumbs.py", line 169, in wrapper
return f(*args, breadcrumbs=breadcrumbs, **kwargs)
File "/usr/lib/python3.6/site-packages/leapp/cli/commands/preupgrade/__init__.py", line 84, in preupgrade
workflow = repositories.lookup_workflow('IPUWorkflow')()
TypeError: 'NoneType' object is not callable

Solution:

Cleanup YUM repositories.

~]# mkdir /etc/yum.repos.d/bak
~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
~]# dnf clean all

Reference

Red Hat Enterprise Linux Technology Capabilities and Limits
Upgrading from RHEL 8 to RHEL 9
How to in-place upgrade an offline / disconnected RHEL 8 machine to RHEL 9 with Leapp?