Bug 1961103

Summary: [RFE] Leapp can fail due to 3rd party DNF plugins
Product: Red Hat Enterprise Linux 7 Reporter: Christophe Besson <cbesson>
Component: leapp-repositoryAssignee: Leapp Notifications Bot <leapp-notifications-bot>
Status: NEW --- QA Contact: upgrades-and-conversions
Severity: low Docs Contact:
Priority: low    
Version: 7.9CC: fkrska, pstodulk
Target Milestone: rcKeywords: FutureFeature, Reproducer
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1818088    

Description Christophe Besson 2021-05-17 09:15:29 UTC
Description of problem:
Customer installed a 3rd party DNF plugin named 'langpacks', provided by the dnf-langpacks package from the EPEL repository. This plugin comes with a bug and it breaks DNF:

# dnf -v
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, langpacks, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 95, in _main
    cli.configure(list(map(ucd, args)), option_parser())
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 915, in configure
    self.base.init_plugins(opts.disableplugin, opts.enableplugin, self)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 307, in init_plugins
    self._plugins._run_init(self, cli)
  File "/usr/lib/python2.7/site-packages/dnf/plugin.py", line 147, in _run_init
    plugin = p_cls(base, cli)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/langpacks.py", line 732, in __init__
    config = self.read_config(self.base.conf, "langpacks")
TypeError: read_config() takes exactly 2 arguments (3 given)

A check to see whether a 3rd party DNF plugin is in use could prevent such an error.

Version-Release number of selected component (if applicable):
leapp-repository-0.13.0-2.el7_9.noarch

How reproducible:
100%

Steps to Reproduce:
1. Enable EPEL repo for RHEL 7
2. yum install dnf-langpacks
3. leapp upgrade

Actual results:
[ERROR] Actor: target_userspace_creator 
Message: Unable to install RHEL 8 userspace packages. 
Summary:    Details: Command ['systemd-nspawn', '--register=no', '--quiet', '-D', '/var/lib/leapp/scratch/mounts/root_/system_overlay', '--bind=/etc/hosts:/etc/hosts', '--setenv=LEAPP_NO_RHSM=0', '--setenv=LEAPP_EXPERIMENTAL=0', '--setenv=LEAPP_COMMON_TOOLS=:/etc/leapp/repos.d/system_upgrade/el7toel8/tools', '--setenv=LEAPP_COMMON_FILES=:/etc/leapp/repos.d/system_upgrade/el7toel8/files', '--setenv=LEAPP_UNSUPPORTED=0', '--setenv=LEAPP_EXECUTION_ID=7b9560ed-f9c6-45aa-94f0-935289fc8ed8', '--setenv=LEAPP_HOSTNAME=XXX', 'dnf', 'install', '-y', '--nogpgcheck', '--setopt=module_platform_id=platform:el8', '--setopt=keepcache=1', '--releasever', u'8.2', '--installroot', '/el8target', '--disablerepo', '*', '--enablerepo', u'rhel-8-for-ppc64le-appstream-rpms', '--enablerepo', u'rhel-8-for-ppc64le-baseos-rpms', '--enablerepo', u'rhel-8-for-ppc64le-supplementary-rpms', 'dnf'] failed with exit code 1. 
    Stderr: Host and machine ids are equal (a43f5b58478c4f29ac84d2561e6b5000): refusing to link journals Traceback (most recent call last): 
              File "/usr/bin/dnf", line 58, in <module> 
                main.user_main(sys.argv[1:], exit_code=True) 
              File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 179, in user_main 
                errcode = main(args) 
              File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main 
                return _main(base, args, cli_class, option_parser_class) 
              File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 95, in _main 
                cli.configure(list(map(ucd, args)), option_parser()) 
              File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 915, in configure 
                self.base.init_plugins(opts.disableplugin, opts.enableplugin, self) 
              File "/usr/lib/python2.7/site-packages/dnf/base.py", line 307, in init_plugins 
                self._plugins._run_init(self, cli) 
              File "/usr/lib/python2.7/site-packages/dnf/plugin.py", line 147, in _run_init 
                plugin = p_cls(base, cli) 
              File "/usr/lib/python2.7/site-packages/dnf-plugins/langpacks.py", line 732, in __init__ 
              config = self.read_config(self.base.conf, "langpacks") 
              TypeError: read_config() takes exactly 2 arguments (3 given) 

Expected results:
An inhibitor to prevent this kind of issues related to a 3rd party plugin

Comment 2 Petr Stodulka 2021-05-17 10:22:14 UTC
Thank you Chris for the report. I am thinking with the idea to disable all dnf plugins by default and enable just those we require. Just not sure whether some disabled plugins could be crucial for the dnf regarding customer's setup. WDYT about that, instead of inhibitor? Probably we should discuss it with DNF team as well.

Comment 3 Christophe Besson 2021-05-17 12:22:41 UTC
It sounds relevant, and better than creating an inhibitor.
I can't give an exhaustive list, though.