Bug 1467314 - RHEL bootstrap buildroot can't be initialized using DNF
Summary: RHEL bootstrap buildroot can't be initialized using DNF
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-03 11:18 UTC by Vít Ondruch
Modified: 2019-11-08 11:12 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-08 11:12:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Vít Ondruch 2017-07-03 11:18:19 UTC
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 11:21:17 UTC
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 11:25:48 UTC
(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 08:39:45 UTC
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 15:51:03 UTC
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 12:29:07 UTC
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 15:35:22 UTC
I believe this is fixed in mock-1.4.9-1.
Can you confirm?

Comment 7 Pavel Zhukov 2018-02-22 15:45:31 UTC
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

Comment 8 Ben Cotton 2018-11-27 14:47:24 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Vít Ondruch 2018-11-27 15:38:52 UTC
This still not resolved, if I am not mistaken.

Comment 10 Ben Cotton 2019-02-19 17:12:13 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 30 development cycle.
Changing version to '30.

Comment 11 Miroslav Suchý 2019-11-08 11:12:40 UTC
This should be fixed as of 334f092fa0bfe5b60e506eb77e0f0feff1cc931a

At least the code which tries to import yum is gone and so is the try/except part.


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