Bug 2258570 - Unable to create rawhide mock roots due to dnf5
Summary: Unable to create rawhide mock roots due to dnf5
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 38
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Copr Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-01-16 10:25 UTC by Daniel Berrangé
Modified: 2024-01-16 15:20 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-01-16 15:20:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Daniel Berrangé 2024-01-16 10:25:49 UTC
Attempting to create Fedora 40 rawhide roots results in

   FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/dnf5'

mock-filesystem-5.3-1.fc38.noarch
mock-core-configs-39.3-1.fc38.noarch
mock-5.3-1.fc38.noarch


Reproducible: Always

Steps to Reproduce:


$ mock -r fedora-40-x86_64 --init

Actual Results:  
INFO: mock.py version 5.3 starting (python version = 3.11.7, NVR = mock-5.3-1.fc38), args: /usr/libexec/mock/mock -r fedora-40-x86_64 --init
Start(bootstrap): init plugins
INFO: selinux disabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux disabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start: clean chroot
Finish: clean chroot
Mock Version: 5.3
INFO: Mock Version: 5.3
Start(bootstrap): chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled package manager cache
Start(bootstrap): cleaning package manager metadata
Finish(bootstrap): cleaning package manager metadata
INFO: Using 'dnf' instead of 'dnf5' for bootstrap chroot
INFO: Package manager dnf detected and used (fallback)
Finish(bootstrap): chroot init
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled package manager cache
Start: cleaning package manager metadata
Finish: cleaning package manager metadata
INFO: enabled HW Info plugin
INFO: Package manager dnf5 detected and used (direct choice)
Start: installing minimal buildroot with dnf5
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 1079, in <module>
    exitStatus = main()
                 ^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/libexec/mock/mock", line 836, in main
    result = run_command(options, args, config_opts, commands, buildroot)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/libexec/mock/mock", line 867, in run_command
    commands.init()
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/backend.py", line 167, in init
    self.buildroot.initialize(**kwargs)
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/buildroot.py", line 198, in initialize
    self._init(prebuild=prebuild)
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/buildroot.py", line 319, in _init
    self._init_pkg_management()
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/buildroot.py", line 505, in _init_pkg_management
    self.pkg_manager.init_install_output += self.pkg_manager.execute(*cmd, returnOutput=1)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/package_manager.py", line 764, in execute
    return super(Dnf, self).execute(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/package_manager.py", line 272, in execute
    return self._execute_mounted(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/package_manager.py", line 330, in _execute_mounted
    out = util.do(invocation, env=env,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/util.py", line 517, in do
    return do_with_status(*args, **kargs)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/util.py", line 560, in do_with_status
    child = subprocess.Popen(
            ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/dnf5'


Expected Results:  
Fedora 40 root is initialized

Comment 1 Pavel Raiskup 2024-01-16 14:44:38 UTC
Thank you for the report.  This appears to be a situation after a freshly
updated mock-core-configs flipping the package_manager config like:

- config_opts["package_manager"] = 'dnf'
+ config_opts["package_manager"] = 'dnf5'

Mock thinks that dnf5 _is_ installed in caches (bootstrap) but it is not.
Please `mock -r fedora-40-x86_64 --scrub=all` and retry.

Comment 2 Daniel Berrangé 2024-01-16 15:01:19 UTC
(In reply to Pavel Raiskup from comment #1)
> Thank you for the report.  This appears to be a situation after a freshly
> updated mock-core-configs flipping the package_manager config like:
> 
> - config_opts["package_manager"] = 'dnf'
> + config_opts["package_manager"] = 'dnf5'

Yes, this almost certainly started happening after I did a dnf update, as
the install date of mock-core-configs is just 1 week ago.

> Mock thinks that dnf5 _is_ installed in caches (bootstrap) but it is not.
> Please `mock -r fedora-40-x86_64 --scrub=all` and retry.

Thanks,  --scrub=all fixed the problem.  I had naively thought --clean would clean any cached info.

As an RFE, I think that mock really ought to self-invalidate its cache
if it sees a target config file has changed.

Comment 3 Pavel Raiskup 2024-01-16 15:20:26 UTC
Ok, RFE moved upstream: https://github.com/rpm-software-management/mock/issues/1289


Note You need to log in before you can comment on or make changes to this bug.