oamg / leapp-repository

Leapp repositories containing actors for the Leapp framework (https://github.com/oamg/leapp). Currently provides leapp repositories for in-place upgrades of RHEL systems.
Apache License 2.0
48 stars 144 forks source link

Copy dnf.conf to target userspace and allow a custom one #1143

Closed matejmatuska closed 10 months ago

matejmatuska commented 10 months ago

This change allows working around the fact that source and target dnf.conf files might be incompatible. For example some of the proxy configuration between RHEL7 and RHEL8.

Target system compatible configuration can be specified in /etc/leapp/files/dnf.conf. If this file is present it is copied into the target userspace and also applied to the target system. If it doesn't exist, the /etc/dnf/dnf.conf from the source system will be copied instead.

Errors that could be caused by incompatible/incorrect proxy configuration now contain a hint with a remediation with the steps above mentioned.

Jira: OAMG-6544

github-actions[bot] commented 10 months ago

Thank you for contributing to the Leapp project!

Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergeable. If you want to request a review or rebuild a package in copr, you can use following commands as a comment:

Packit will automatically schedule regression tests for this PR's build and latest upstream leapp build. If you need a different version of leapp from PR#42, use /packit test oamg/leapp#42

It is possible to schedule specific on-demand tests as well. Currently 2 test sets are supported, beaker-minimal and kernel-rt, both can be used to be run on all upgrade paths or just a couple of specific ones. To launch on-demand tests with packit:

[Deprecated] To launch on-demand regression testing public members of oamg organization can leave the following comment:

Please open ticket in case you experience technical problem with the CI. (RH internal only)

Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please contact leapp-infra.

matejmatuska commented 10 months ago

Draft - the update of proxy related err msg is not included yet

matejmatuska commented 10 months ago

Example error outputs

While creating target userspace:

============================================================
                           ERRORS
============================================================

2023-11-13 23:44:00.936022 [ERROR] Actor: target_userspace_creator
Message: Unable to install RHEL 8 userspace packages.
Summary:
    Details: DNF failed to install userspace packages, likely due to the proxy configuration detected in the YUM/DNF configuration file. Make sure the proxy is properly configured in /etc/dnf/dnf.conf. It's also possible the proxy settings in the DNF configuration file are incompatible with the target system. A compatible configuration can be placed in /etc/leapp/files/dnf.conf which, if present, will be used during the upgrade instead of /etc/dnf/dnf.conf. In such case the configuration will also be applied to the target system.
    Stderr: Host and machine ids are equal (871ef4f117244053b1d04bf2ce807536): refusing to link journals
            Failed to synchronize cache for repo 'BASEOS', ignoring this repo.
            Failed to synchronize cache for repo 'APPSTREAM', ignoring this repo.
            Error: Unable to find a match: dnf dnf-command(config-manager)

============================================================
                       END OF ERRORS
============================================================

While downloading packages:

============================================================
                           ERRORS
============================================================

2023-11-14 00:02:42.216522 [ERROR] Actor: dnf_package_download
Message: DNF execution failed with non zero exit code.
Summary:
    Stdout: Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, rhel-upgrade
            DNF version: 4.7.0
            cachedir: /var/cache/dnf
            User-Agent: constructed: 'libdnf (Red Hat Enterprise Linux 8.7; generic; Linux.x86_64)'
            repo: using cache for: APPSTREAM
            APPSTREAM: using metadata from Thu Oct 13 05:56:41 2022.
            repo: using cache for: BASEOS
            BASEOS: using metadata from Thu Oct 13 05:58:08 2022.
            Last metadata expiration check: 0:01:33 ago on Tue Nov 14 00:01:05 2023.
            Excludes in dnf.conf: leapp, leapp-upgrade-el7toel8, python2-leapp, snactor
            --> Starting dependency resolution
            --> Finding unneeded leftover dependencies
            ---> Package irqbalance.x86_64 2:1.9.0-3.el8 will be a downgrade
            ---> Package libcgroup.x86_64 0.41-19.el8 will be a downgrade
            ---> Package sg3_utils.x86_64 1.44-6.el8 will be a downgrade
            ---> Package sg3_utils-libs.x86_64 1.44-6.el8 will be a downgrade
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
            THE ENTIRE DNF TRANSACTOION OUTPUT
-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
            [SKIPPED] xz-libs-5.2.4-4.el8_6.x86_64.rpm: Already downloaded
            [SKIPPED] zlib-1.2.11-20.el8.x86_64.rpm: Already downloaded
            [MIRROR] irqbalance-1.9.0-3.el8.x86_64.rpm: Curl error (7): Couldn't connect to server for http://download.eng.brq.redhat.com/released/rhel-8//RHEL-8/8.7.0/BaseOS/x86_64/os/Packages/irqbalance-1.9.0-3.el8.x86_64.rpm [Failed to connect to 192.168.122.219 port 3128: Connection refused]
            [MIRROR] libcgroup-0.41-19.el8.x86_64.rpm: Curl error (7): Couldn't connect to server for http://download.eng.brq.redhat.com/released/rhel-8//RHEL-8/8.7.0/BaseOS/x86_64/os/Packages/libcgroup-0.41-19.el8.x86_64.rpm [Failed to connect to 192.168.122.219 port 3128: Connection refused]
            [MIRROR] sg3_utils-1.44-6.el8.x86_64.rpm: Curl error (7): Couldn't connect to server for http://download.eng.brq.redhat.com/released/rhel-8//RHEL-8/8.7.0/BaseOS/x86_64/os/Packages/sg3_utils-1.44-6.el8.x86_64.rpm [Failed to connect to 192.168.122.219 port 3128: Connection refused]
            [MIRROR] irqbalance-1.9.0-3.el8.x86_64.rpm: Curl error (7): Couldn't connect to server for http://download.eng.brq.redhat.com/released/rhel-8//RHEL-8/8.7.0/BaseOS/x86_64/os/Packages/irqbalance-1.9.0-3.el8.x86_64.rpm [Failed to connect to 192.168.122.219 port 3128: Connection refused]
            [MIRROR] libcgroup-0.41-19.el8.x86_64.rpm: Curl error (7): Couldn't connect to server for http://download.eng.brq.redhat.com/released/rhel-8//RHEL-8/8.7.0/BaseOS/x86_64/os/Packages/libcgroup-0.41-19.el8.x86_64.rpm [Failed to connect to 192.168.122.219 port 3128: Connection refused]
            [MIRROR] sg3_utils-1.44-6.el8.x86_64.rpm: Curl error (7): Couldn't connect to server for http://download.eng.brq.redhat.com/released/rhel-8//RHEL-8/8.7.0/BaseOS/x86_64/os/Packages/sg3_utils-1.44-6.el8.x86_64.rpm [Failed to connect to 192.168.122.219 port 3128: Connection refused]
            [FAILED] irqbalance-1.9.0-3.el8.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success

            The downloaded packages were saved in cache until the next successful transaction.
            You can remove cached packages by executing 'dnf clean packages'.
    Stderr: No matches found for the following disable plugin patterns: subscription-manager
            Error: Error downloading packages:
              irqbalance-2:1.9.0-3.el8.x86_64: Cannot download, all mirrors were already tried without success
    Hint: If there was a problem reaching repositories (see stderr output) and proxy is configured in the YUM/DNF configuration file, the proxy configuration is likely causing this error. Make sure the proxy is properly configured in /etc/dnf/dnf.conf. It's also possible the proxy settings in the DNF configuration file are incompatible with the target system. A compatible configuration can be placed in /etc/leapp/files/dnf.conf which, if present, will be used during the upgrade instead of /etc/dnf/dnf.conf. In such case the configuration will also be applied to the target system.

============================================================
                       END OF ERRORS
============================================================
matejmatuska commented 10 months ago

The dnf.conf is applied to the target system, also the DNF excludes are present after an upgrade:

# cat /etc/dnf/dnf.conf
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
proxy=http://192.168.122.219:3128/
exclude=python2-leapp,snactor,leapp-upgrade-el7toel8,leapp
pirat89 commented 10 months ago

@matejmatuska @MichalHe failing unit tests are caused by general "outage" problems. I will re-run it when they are fixed.

pirat89 commented 10 months ago

/packit test

pirat89 commented 10 months ago

/packit test

pirat89 commented 10 months ago

rebase + update of the errror msg text