Bug 1467314 - RHEL bootstrap buildroot can't be initialized using DNF
RHEL bootstrap buildroot can't be initialized using DNF
Status: NEW
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
27
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Suchý
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-03 07:18 EDT by Vít Ondruch
Modified: 2018-02-22 10:45 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
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: ---


Attachments (Terms of Use)

  None (edit)
Description Vít Ondruch 2017-07-03 07:18:19 EDT
Description of problem:
Trying to initiate buildroot for RHEL7 with boostrap root enabled, the --init command fails:

~~~
$ rpm -q yum
package yum is not installed

$ mock -r rhel-7-x86_64 --init 
INFO: mock.py version 1.4.2 starting (python version = 3.6.1)...
Start(bootstrap): init plugins
INFO: selinux disabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
Start: clean chroot
Finish: clean chroot
Start(bootstrap): chroot init
INFO: LVM plugin enabled. Allocated pool data: 12.52%. Allocated metadata: 7.25%.
WARNING: For multilib systems, both architectures of nosync library need to be installed
INFO: calling preinit hooks
INFO: enabled yum cache
Start(bootstrap): cleaning yum metadata
Finish(bootstrap): cleaning yum metadata
INFO: enabled HW Info plugin
Mock Version: 1.4.2
INFO: Mock Version: 1.4.2
Start(bootstrap): yum install
Error: There are no enabled repos.
ERROR: Command failed: 
 # /usr/bin/yum --installroot /var/lib/mock/rhel-7-x86_64-bootstrap/root/ --releasever 7 install yum yum-utils shadow-utils distribution-gpg-keys
Error: There are no enabled repos.
~~~

If I had yum installed it would pass:

~~~
$ rpm -q yum
yum-3.4.3-512.fc26.noarch

$ mock -r rhel-7-x86_64 --init 
INFO: mock.py version 1.4.2 starting (python version = 3.6.1)...
Start(bootstrap): init plugins
INFO: selinux disabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
Start: clean chroot
Finish: clean chroot
Start(bootstrap): chroot init
INFO: LVM plugin enabled. Allocated pool data: 12.52%. Allocated metadata: 7.25%.
WARNING: For multilib systems, both architectures of nosync library need to be installed
INFO: calling preinit hooks
INFO: enabled yum cache
Start(bootstrap): cleaning yum metadata
Finish(bootstrap): cleaning yum metadata
INFO: enabled HW Info plugin
Mock Version: 1.4.2
INFO: Mock Version: 1.4.2
Start(bootstrap): yum install
Yum command has been deprecated, use dnf instead.
See 'man dnf' and 'man yum2dnf' for more information.


===============================================================================
 Package                   Arch       Version                  Repository
                                                                          Size
===============================================================================
Installing:
 shadow-utils              x86_64     2:4.1.5.1-24.el7         rhel7     1.1 M
 yum                       noarch     3.4.3-154.el7            rhel7     1.2 M
 yum-utils                 noarch     1.1.31-42.el7            rhel7     116 k

... snip ...
~~~


BTW I don't understand why mock is trying to use YUM at all.

1) dnf/yum are the same when DNF is installed and YUM is not.
2) I'd expect, that the boostrap root should avoid the need to have YUM installed on my system.



Version-Release number of selected component (if applicable):
$ rpm -q mock
mock-1.4.2-1.fc27.noarch


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
~~~
$ rpm -q yum
package yum is not installed

$ mock -r rhel-7-x86_64 --init 
INFO: mock.py version 1.4.2 starting (python version = 3.6.1)...
Start(bootstrap): init plugins
INFO: selinux disabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
Start: clean chroot
Finish: clean chroot
Start(bootstrap): chroot init
INFO: LVM plugin enabled. Allocated pool data: 12.52%. Allocated metadata: 7.25%.
WARNING: For multilib systems, both architectures of nosync library need to be installed
INFO: calling preinit hooks
INFO: enabled yum cache
Start(bootstrap): cleaning yum metadata
Finish(bootstrap): cleaning yum metadata
INFO: enabled HW Info plugin
Mock Version: 1.4.2
INFO: Mock Version: 1.4.2
Start(bootstrap): yum install
Error: There are no enabled repos.
ERROR: Command failed: 
 # /usr/bin/yum --installroot /var/lib/mock/rhel-7-x86_64-bootstrap/root/ --releasever 7 install yum yum-utils shadow-utils distribution-gpg-keys
Error: There are no enabled repos.
~~~


Expected results:
~~~
$ rpm -q yum
package yum is not installed

$ mock -r rhel-7-x86_64 --init
~~~

This should work IMO.



Additional info:
Actually, I don't understand why the "Error: There are no enabled repos." is issued. Are the configurations for DNF/YUM stored on different place? DNF should be always able to consume YUM configurations and as far as I remember, the move of configurations to DNF directories was rejected on Fedora.
Comment 1 Miroslav Suchý 2017-07-03 07:21:17 EDT
I am getting little bit different TB
$ mock -r epel-7-x86_64 --bootstrap-chroot --init
INFO: mock.py version 1.4.1 starting (python version = 3.6.1)...
Start(bootstrap): init plugins
INFO: selinux disabled
Finish(bootstrap): init plugins
ERROR: Command /usr/bin/yum-deprecated is not available. Either install package containing this command
or run mock with --yum or --dnf to overwrite config value. However this may
lead to different dependency solving!
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 934, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 703, in main
    buildroot = Buildroot(config_opts, uidManager, state, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/mockbuild/buildroot.py", line 62, in __init__
    self.pkg_manager = package_manager(config, self, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 21, in package_manager
    return Yum(config_opts, chroot, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 191, in __init__
    self._check_command()
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 171, in _check_command
    lead to different dependency solving!""".format(self.command))
Exception: Command /usr/bin/yum-deprecated is not available. Either install package containing this command
or run mock with --yum or --dnf to overwrite config value. However this may
lead to different dependency solving!
Comment 2 Vít Ondruch 2017-07-03 07:25:48 EDT
(In reply to Miroslav Suchý from comment #1)
Heh, funny enough:

~~~
$ sudo dnf remove dnf-yum

$ mock -r rhel-7-x86_64 --init 
INFO: mock.py version 1.4.2 starting (python version = 3.6.1)...
ERROR: Command /usr/bin/yum is not available. Either install package containing this command
or run mock with --yum or --dnf to overwrite config value. However this may
lead to different dependency solving!
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 934, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 698, in main
    is_bootstrap=True)
  File "/usr/lib/python3.6/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/mockbuild/buildroot.py", line 62, in __init__
    self.pkg_manager = package_manager(config, self, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 21, in package_manager
    return Yum(config_opts, chroot, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 191, in __init__
    self._check_command()
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 171, in _check_command
    lead to different dependency solving!""".format(self.command))
Exception: Command /usr/bin/yum is not available. Either install package containing this command
or run mock with --yum or --dnf to overwrite config value. However this may
lead to different dependency solving!
~~~

This is quite close to your TB, but it requires "yum" instead of "yum-deprecated".
Comment 3 Jan Kurik 2017-08-15 04:39:45 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.
Comment 4 Mattias Ellert 2017-08-28 11:51:03 EDT
I have this problem too.

My EPEL 7 mock builds started working after I installed dnf-utils.
Dnf-utils provides /usr/bin/yum-builddep (implemented using the dnf python api).
I therefore think that mock is missing a dependency on dnf-utils.

My EPEL 6 mock builds started working after applying the following change:

# diff -ur /usr/lib/python3.6/site-packages/mockbuild/plugins/selinux.py.orig  /usr/lib/python3.6/site-packages/mockbuild/plugins/selinux.py
--- /usr/lib/python3.6/site-packages/mockbuild/plugins/selinux.py.orig	2017-08-22 16:14:27.000000000 +0200
+++ /usr/lib/python3.6/site-packages/mockbuild/plugins/selinux.py	2017-08-28 17:31:55.280046012 +0200
@@ -114,6 +114,6 @@
             supported = hasattr(cli.YumBaseCli, "_parseSetOpts")
             sys.path.pop(0)
             return supported
-        except SyntaxError:
+        except (SyntaxError, ModuleNotFoundError):
             # We're on python 3, assuming yum is new enough
             return True
Comment 5 Milan Zink 2017-09-04 08:29:07 EDT
Same issue. Fixed the same ways as Mattias (comment above).

1. install dnf-utils
2. patch /usr/lib/python3.6/site-packages/mockbuild/plugins/selinux.py
Comment 6 Miroslav Suchý 2018-02-22 10:35:22 EST
I believe this is fixed in mock-1.4.9-1.
Can you confirm?
Comment 7 Pavel Zhukov 2018-02-22 10:45:31 EST
pretty much the same:

[root@root ~]#  mock -r rhel-7-x86_64 --init 
INFO: mock.py version 1.4.9 starting (python version = 3.6.4)...
ERROR: Command /usr/bin/yum is not available. Either install package containing this command
or run mock with --yum or --dnf to overwrite config value. However this may
lead to different dependency solving!
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 959, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock/mock", line 723, in main
    buildroot = Buildroot(config_opts, uidManager, state, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/trace_decorator.py", line 96, in trace
    result = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/mockbuild/buildroot.py", line 62, in __init__
    self.pkg_manager = package_manager(config, self, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 21, in package_manager
    return Yum(config_opts, buildroot, plugins, bootstrap_buildroot)
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 200, in __init__
    self._check_command()
  File "/usr/lib/python3.6/site-packages/mockbuild/package_manager.py", line 178, in _check_command
    lead to different dependency solving!""".format(self.command))
Exception: Command /usr/bin/yum is not available. Either install package containing this command
or run mock with --yum or --dnf to overwrite config value. However this may
lead to different dependency solving!
[root@root ~]# rpm -q mock
mock-1.4.9-1.fc27.noarch

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