More

    Upgrade from RHEL 7 to RHEL 8

    Upgrade from RHEL 7 to RHEL 8 Using Leapp Utility

    This guide is all about taking you through the step by step process of performing in-place upgrade from RHEL 7 to RHEL 8 using the Leapp utility.

    RHEL7 maintenance support phase will come to an end in June 2024 hence the need to upgrade to the next available major release – RHEL 8.

    Check the current RHEL version using the following command:

    # cat /etc/os-release
    
    NAME="Red Hat Enterprise Linux Server"
    VERSION="7.9 (Maipo)"
    ID="rhel"
    ID_LIKE="fedora"
    VARIANT="Server"
    
    ...

    Ensure you have a valid RHEL subscription. You can register and subscribe through subscription manager:

    subscription-manager register --username xxxx --password xxxxx
    
    

    Enable repos

    Ensure that you have enabled the required repositories required for the upgrade. We need the Base repository(rhel-7-server-rpms) and the Extras repository(rhel-7-server-extras-rpms) where leapp and its dependencies are derived from.

    subscription-manager repos --enable rhel-7-server-rpms --enable rhel-7-server-extras-rpms

     

    Expected output:

    Repository 'rhel-7-server-rpms' is enabled for this system.
    Repository 'rhel-7-server-extras-rpms' is enabled for this system.
    

     

    Verify the repos

    We need to verify that all expected RHEL 7 repositories are enabled in the server that we are upgrading through the command below:

    subscription-manager repos --list-enabled | grep "^Repo ID"

    Expected Output:

    Repo ID:   rhel-7-server-extras-rpms
    Repo ID:   rhel-7-server-rpm

    Update All Packages

    Ensure that all packages have been updated to the latest version on your RHEL 7 instance. You can use yum utility to do it.

    yum update -y
    
    

    Reboot

    Reboot the RHEL 7 instance to ensure that you’re running the latest kernel.

    reboot
    
    

    Install leapp

    Use yum to install the Leapp utility.

    yum install leapp -y

    Expected Output:

    Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
    rhel-7-server-extras-rpms                                                                                                                                                                      | 3.4 kB  00:00:00     
    rhel-7-server-rpms                                                                                                                                                                             | 3.5 kB  00:00:00     
       
    ...
    
    Installed:
      leapp.noarch 0:0.15.1-1.el7_9                                                                                                                                                                                       
    
    ...                  
      python2-dnf.noarch 0:4.0.9.2-2.el7_9                         python2-hawkey.x86_64 0:0.22.5-2.el7_9          python2-leapp.noarch 0:0.15.1-1.el7_9                          
    
    Complete!
    
    

     

    Note:

    Leapp data files are now a part of the leapp-repository package. Therefore, you no longer need to manually download these files.

    Optionally, the leap files can be downloaded from here. You need login credentilas to be able to download as only Subscribers can view this attachment.

    Leapp Pre-upgrade

    We use leapp preupgrade command to assess the upgradability of the system. The Leapp utility collects data about the system and generates a pre-upgrade report. This report provides a summary of potential problems and suggests recommended solutions to these problems.

     leapp preupgrade --target 8.10

    Analyze the report at the end. It’s key that you review the pre-upgrade report in the generated /var/log/leapp/leapp-report.txt and manually resolve reported inhibitors using the command-line interface(CLI). As an alternative, you can answer the true or false question by running the following command:

    leapp answer --section <question_section>.<field_name>=<answer>

    Fix Inhibitor Examples

    leapp answer --section remove_pam_pkcs11_module_check.confirm=True;
    leapp answer --section authselect_check.confirm=True;
    rmmod pata_acpi floppy;
    
    

     

    Inhibitors prevent you from upgrading until you have resolved them. The report contains the following risk factor levels:

    • High   : Very likely to result in a deteriorated system state.
    • Medium : Can impact both the system and applications.
    • Low    : Should not impact the system but can have an impact on applications.
    • Info   : Informational with no expected impact to the system or applications.
    ==> Processing phase Reports
    ====> * verify_check_results
            Check all dialogs and notify that user needs to make some choices.
    ====> * verify_check_results
            Check all generated results messages and notify user about them.
    
    ============================================================
                         UPGRADE INHIBITED                      
    ============================================================
    
    Upgrade has been inhibited due to the following problems:
        1. Inhibitor: Multiple devel kernels installed
        2. Inhibitor: Missing required answers in the answer file
        3. Inhibitor: Missing required answers in the answer file
    Consult the pre-upgrade report for details and possible remediation.
    
    ============================================================
                         UPGRADE INHIBITED                      
    ============================================================
    
    
    Debug output written to /var/log/leapp/leapp-preupgrade.log
    
    ============================================================
                               REPORT                           
    ============================================================
    
    A report has been generated at /var/log/leapp/leapp-report.json
    A report has been generated at /var/log/leapp/leapp-report.txt
    
    ============================================================
                           END OF REPORT                        
    ============================================================
    
    Answerfile has been generated at /var/log/leapp/answerfile
    

     

    Review the Inhibitors and High’s from the report – /var/log/leapp/leapp-report.txt

    # cat /var/log/leapp/leapp-report.txt
    Risk Factor: high (inhibitor)
    Title: Multiple devel kernels installed
    Summary: DNF cannot produce a valid upgrade transaction when multiple kernel-devel packages are installed.
    Remediation: [hint] Remove all but one kernel-devel packages before running Leapp again.
    [command] yum -y remove kernel-devel-3.10.0-1160.99.1.el7
    Key: 8ceea81afbbb1a329b7d82ca7212b21509e5b256
    ----------------------------------------
    Risk Factor: high (inhibitor)
    Title: Missing required answers in the answer file
    Summary: One or more sections in answerfile are missing user choices: remove_pam_pkcs11_module_check.confirm
    For more information consult https://leapp.readthedocs.io/en/latest/dialogs.html
    Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
    [command] leapp answer --section remove_pam_pkcs11_module_check.confirm=True
    Key: d35f6c6b1b1fa6924ef442e3670d90fa92f0d54b
    ----------------------------------------
    Risk Factor: high (inhibitor)
    Title: Missing required answers in the answer file
    Summary: One or more sections in answerfile are missing user choices: authselect_check.confirm
    For more information consult https://leapp.readthedocs.io/en/latest/dialogs.html
    Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
    [command] leapp answer --section authselect_check.confirm=True
    Key: 68c3ee4354bd3c4e56697a9c34a9be5ce450ecf8
    ----------------------------------------
    
    .....

     

    Fix Leapp Pre-upgrade Inhibitors

    Remove kernel-devel packages

    As recommended by the Leapp report, we need to remove all kernel-devel packages before running leapp preupgrade again.

    yum -y remove kernel-devel-3.10.0-1160.*
    
    

     

    Remove kernel modules/drivers that have been removed in RHEL 8

    Inhibitor: Detected loaded kernel drivers (pata_acpi & floppy) which have been removed in RHEL 8.
    Solution: rmmod pata_acpi – Support for this device driver has been removed in RHEL 8.

     rmmod pata_acpi floppy
    

    Fix PAM Modules

    Inhibitor: Missing required answers in the answer file.
    Solution: Execute the command given under command section, in my case:

    leapp answer --section remove_pam_pkcs11_module_check.confirm=True
    leapp answer --section authselect_check.confirm=True

     

    After fixing the inhibitors, run the leapp preupgrade command again and validate that you get a clean report before doing the actual leapp upgrade as shown below:

    Transaction Summary
    =============================================================================================================================================================
    Install     523 Packages
    Upgrade    1283 Packages
    Remove      243 Packages
    Downgrade    21 Packages
    
    Total size: 1.7 G
    Total download size: 1.6 G
    Downloading Packages:
    Check completed.
    ====> * check_systemd_services_tasks
            Inhibit the upgrade if SystemdServicesTasks tasks are in conflict
    ...
    
    Debug output written to /var/log/leapp/leapp-preupgrade.log
    
    ============================================================
                               REPORT                           
    ============================================================
    
    A report has been generated at /var/log/leapp/leapp-report.json
    A report has been generated at /var/log/leapp/leapp-report.txt
    
    ============================================================
                           END OF REPORT                        
    ============================================================
    
    Answerfile has been generated at /var/log/leapp/answerfile
    

     

    Performing the upgrade from RHEL 7 to RHEL 8

    In case you get this error(XFS ftype=0) during leapp upgrade , try the solution below and try leapp upgrade again from the same terminal.

    2023-09-06 12:29:24.164 ERROR    PID: 30154 leapp.workflow.Download.dnf_package_download: DNF execution failed: 
    
    ============================================================
                               ERRORS                           
    ============================================================
    
    2023-09-06 12:29:25.674732 [ERROR] Actor: dnf_package_download
    Message: There is not enough space on the file system hosting /var/lib/leapp directory to extract the packages.
    Summary:
        Hint: Please follow the instructions in the 'XFS ftype=0 case' section of the article at: link: https://access.redhat.com/solutions/5057391
    
    ============================================================
                           END OF ERRORS                        
    ============================================================
    
    
    Debug output written to /var/log/leapp/leapp-upgrade.log
    
    ============================================================
                               REPORT                           
    ============================================================
    
    A report has been generated at /var/log/leapp/leapp-report.json
    A report has been generated at /var/log/leapp/leapp-report.txt
    
    ============================================================
                           END OF REPORT                        
    ============================================================

     

    Create a python fileevaluate-ovl-size.py in /tmp and paste this code below:

    #!/usr/libexec/platform-python
    #
    # DISCLAIMER: this script is not supported by Red Hat.
    # Usage: ./eval-ovl-size.py
    # Give a rough estimate of the required available space to in-place upgrade.
    
    MIN_SIZE = 1024   # MB
    EXTRA_MARGIN = 15 # %
    
    import os, os.path, subprocess
    
    def _shell(command):
        # works with python2.7 (el7) as well as python3 (el8)
        p = subprocess.Popen(command,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE,
                         close_fds=True,
                         shell=True,
                         universal_newlines=True)
        output = []
        while True:
            line = p.stdout.readline().rstrip('\n')
            if line:
                output.append(line)
            else:
                break
        return output
    
    
    {{ More Code }}
    

     

    Make the script executable and then run it:

    chmod +x  evaluate-ovl-size.py
    ./evaluate-ovl-size.py

    Expected output:

    [root@host01 tmp]# ./evaluate-ovl-size.py
    == Summary ==
    /var/lib/leapp resides on the /var partition
    Current available space in /var: 48529 MB
    Installed size for all RPMs: 3127 MB
    
    == XFS ftype=0 case ==
    -> Adjust $LEAPP_OVL_SIZE before running Leapp:
     # export LEAPP_OVL_SIZE=3596
    -> Required space in the /var partition is:
     NumberOfXfsMountedPartitions * LEAPP_OVL_SIZE = 22600 MB
    -> If Leapp/DNF requires again more space:
     - adjust $LEAPP_OVL_SIZE with a bigger size
     - AND extend the /var partition accordingly.
    
    
    For more information, please read https://access.redhat.com/solutions/5057391
    

     

    Run the below command  as suggested by the ouput above and try leapp upgrade again. This will consume more space than normal in /var. Please ensure that /var has enough space.

    export LEAPP_OVL_SIZE=3596

     

    Leapp Upgrade

    Before the actual upgrade happens, Leapp performs the leapp preupgrade phase to ascertain that the system is upgradable. If the system is upgradable, Leapp downloads necessary data and prepares an RPM transaction for the upgrade process.

    # leapp upgrade --target 8.10
    ==> Processing phase configuration_phase
    ====> * ipu_workflow_config
            IPU workflow config actor
    ==> Processing phase FactsCollection
    ====> * scanzfcp
            In case of s390x architecture, check whether ZFCP is used.
    ====> * tcp_wrappers_config_read
            Parse tcp_wrappers configuration files /etc/hosts.{allow,deny}.
    ====> * scan_pkg_manager
            Provides data about package manager (yum/dnf)
    ====> * scan_grub_device_name
            Find the name of the block device where GRUB is located
    ====> * source_boot_loader_scanner
            Scans the boot loader configuration on the source system.
    ====> * scan_subscription_manager_info
            Scans the current system for subscription manager information
    
    ...
    
    
    ...
    
    Transaction Summary
    ================================================================================
    Install  200 Packages
    
    Total download size: 111 M
    Installed size: 707 M
    Downloading Packages:
    (1/200): pinentry-1.1.0-2.el8.x86_64.rpm         84 kB/s | 100 kB     00:01    
    (2/200): libxkbcommon-0.9.1-1.el8.x86_64.rpm     88 kB/s | 116 kB     00:01 
    
    ...
    
    
    Transaction Summary
    =============================================================================================================================================================
    Install     523 Packages
    Upgrade    1283 Packages
    Remove      243 Packages
    Downgrade    21 Packages
    
    Total size: 1.7 G
    Total download size: 1.6 G
    DNF will only download packages, install gpg keys, and check the transaction.
    Downloading Packages:
    
    [SKIPPED] grub2-tools-minimal-2.02-148.el8_8.1.x86_64.rpm: Already downloaded  
    (201/1824): perl-Compress-Raw-Zlib-2.081-1.el8.  72 kB/s |  68 kB     00:00    
    (202/1824): adwaita-gtk2-theme-3.22.3-4.el8.x86 125 kB/s | 132 kB     00:01    
    (203/1824): libcacard-2.7.0-2.el8_1.x86_64.rpm  174 kB/s |  52 kB     00:00    
    (204/1824): atk-2.28.1-1.el8.x86_64.rpm         446 kB/s | 272 kB     00:00    
    (205/1824): glusterfs-cli-6.0-56.4.el8.x86_64.r 463 kB/s | 194 kB     00:00    
    (206/1824): glusterfs-api-6.0-56.4.el8.x86_64.r 329 kB/s |  99 kB     00:00 
    ....
    
    (1824/1824): linux-firmware-20230404-114.git2e9 1.5 MB/s | 264 MB     02:50
       
    --------------------------------------------------------------------------------
    Total                                           2.7 MB/s | 1.6 GB     09:42     
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Complete!
    The downloaded packages were saved in cache until the next successful transaction.
    You can remove cached packages by executing 'dnf clean packages'.
    ==> Processing phase InterimPreparation
    ====> * remove_upgrade_artifacts
            Removes artifacts left over by previous leapp runs
    ====> * efi_interim_fix
            Adjust EFI boot entry for first reboot
    ====> * upgrade_initramfs_generator
            Creates the upgrade initramfs
    ====> * dnf_dry_run
            Actor that invokes DNF to download the RPMs required for the upgrade transaction.
    Applying transaction workaround - remove obsolete RPM GPG keys from RPM DB
    
    Applying transaction workaround - yum config fix
    
    Applying transaction workaround - import trusted gpg keys to RPM DB
    
    Last metadata expiration check: 0:18:31 ago on Sun Sep  3 22:15:16 2023.
    Dependencies resolved.
    =============================================================================================================================================================
    ....
    
    Total size: 1.7 G
    
    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                           
    ============================================================
    
    A report has been generated at /var/log/leapp/leapp-report.json
    A report has been generated at /var/log/leapp/leapp-report.txt
    
    ============================================================
                           END OF REPORT                        
    ============================================================
    
    Answerfile has been generated at /var/log/leapp/answerfile
    
    
    
    

    Reboot the system

    Once all the steps executed successfully, reboot the system. The system boots into a RHEL 8-based initial RAM disk image, initramfs. Leapp upgrades all packages and automatically reboots to the RHEL 8 system.

    Leapp Upgrade

     

    Once the system boots up, connect through ssh and verify the RHEL version:

     

     ssh [email protected]
    
    ***********WARNING*****************WARNING*****************WARNING*************
    *This system is for the use of authorized users only. Any or all uses of this *
    *system and all files on this system may be intercepted, monitored, recorded, *
    *copied, audited,inspected, and disclosed to authorized organizational and law*
    *enforcement personnel. Your access is strictly limited to applicable services*
    *of the system for which you have obtained written authorization, and will be *
    *governed by the organizations Security Policy & Acceptable Usage Standard.   *
    *                                                                             *
    * Unauthorized or improper use of this system is strictly prohibited and may  *
    *result in  administrative disciplinary action and/or civil charges/criminal  *
    *penalties. By continuing to use this system you indicate your awareness of   *
    *and consent to these terms and conditions of use. LOG OFF IMMEDIATELY (Press *
    *CTRL-D) if you do not agree to the conditions stated in  this warning.       *
    ************WARNING*****************WARNING*****************WARNING************
    
    [email protected]'s password: 
    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:
    
        #1) Respect the privacy of others.
        #2) Think before you type.
        #3) With great power comes great responsibility.
    
    [technnix@node01 ~]$ sudo -i
    [root@node01 ~]# cat /etc/os-release
    NAME="Red Hat Enterprise Linux"
    VERSION="8.10 (Ootpa)"
    ID="rhel"
    ID_LIKE="fedora"
    VERSION_ID="8.10"
    PLATFORM_ID="platform:el8"
    PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
    HOME_URL="https://www.redhat.com/"
    DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8"
    BUG_REPORT_URL="https://bugzilla.redhat.com/"
    
    REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
    REDHAT_BUGZILLA_PRODUCT_VERSION=8.10
    REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
    REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
    
    
    
    

     

    Post Upgrade Tasks

    1. Remove all packages from the excludelist:
    # yum config-manager --save --setopt exclude=''

     

    2. List and Remove old kernels for RHEL 7

    # yum list kernel
    Updating Subscription Management repositories.
    
    This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
    
    Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                                                                                              1.6 MB/s |  59 MB     00:36    
    Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                                                 3.0 MB/s |  63 MB     00:21    
    Last metadata expiration check: 0:00:01 ago on Sun 03 Sep 2023 11:10:56 PM EAT.
    Installed Packages
    kernel.x86_64                                                                                      3.10.0-1160.88.1.el7                                                                                        @System
    kernel.x86_64                                                                                      3.10.0-1160.99.1.el7                                                                                        @System
    kernel.x86_64                                                                                      4.18.0-477.21.1.el8_8                                                                                       @System
    
    
    

     

    Uninstall 3.10.x kernels from the system for RHEL 7.

    # yum -y remove kernel-3.10.0-*
    
    Updating Subscription Management repositories.
    
    This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
    
    Dependencies resolved.
    ======================================================================================================================================================================================================================
     Package                                         Architecture                                    Version                                                       Repository                                        Size
    ======================================================================================================================================================================================================================
    Removing:
     kernel                                          x86_64                                          3.10.0-1160.88.1.el7                                          @System                                           66 M
     kernel                                          x86_64                                          3.10.0-1160.99.1.el7                                          @System                                           66 M
    
    Transaction Summary
    ======================================================================================================================================================================================================================
    Remove  2 Packages
    
    ...
    
    Removed:
      kernel-3.10.0-1160.88.1.el7.x86_64                                                                        kernel-3.10.0-1160.99.1.el7.x86_64                                                                       
    
    Complete!
    
    

     

    3. Remove remaining RHEL 7 packages, including the remaining Leapp packages.

    Determine old kernel versions:

    # cd /lib/modules && ls -ld *.el7*
    drwxr-xr-x. 3 root root   19 Jun 10 12:16 3.10.0-1160.59.1.el7.x86_64
    drwxr-xr-x  3 root root   19 Sep  3 20:49 3.10.0-1160.81.1.el7.x86_64
    drwxr-xr-x  7 root root 4096 Sep  3 22:54 3.10.0-1160.88.1.el7.x86_64
    drwxr-xr-x  7 root root 4096 Sep  3 22:54 3.10.0-1160.99.1.el7.x86_64
    drwxr-xr-x. 3 root root   19 Jan 27  2023 3.10.0-862.9.1.el7.x86_64
    

     

    Remove the modules and directories

    # rm -rf /lib/modules/*el7*
    
    
    
    

     

    5. Reboot the system

    # reboot

     

    Conclusion

    We have come to the end of this guide. I hope you managed to upgrade your system from RHEL 7 to RHEL 8. Keep it here for more similar articles.

    Recent Articles

    Related Articles

    Leave A Reply

    Please enter your comment!
    Please enter your name here