Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock 4+ no longer uses the DNF config shipped in bootstrap_image #1088

Closed
kdudka opened this issue May 26, 2023 · 10 comments
Closed

Mock 4+ no longer uses the DNF config shipped in bootstrap_image #1088

kdudka opened this issue May 26, 2023 · 10 comments
Labels
documentation Wiki, manual page or other documentation fix enhancement feature request, rfe

Comments

@kdudka
Copy link
Contributor

kdudka commented May 26, 2023

Short description of the problem

After upgrading to mock-4.0, mock --init fails for a configuration that worked fine with mock-2.16 on the same host.

Output of rpm -q mock

mock-4.0-1.fc37.noarch

Steps to reproduce issue

  1. mock -r rhel-8.7.0.z-x86_64 --scrub=bootstrap
  2. mock -r rhel-8.7.0.z-x86_64 --init

The second command fails with :

% mock -r rhel-8.7.0.z-x86_64 --init
INFO: mock.py version 4.0 starting (python version = 3.11.3, NVR = mock-4.0-1.fc37)...
Start(bootstrap): init plugins
INFO: selinux enabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start: clean chroot
Finish: clean chroot
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: enabled HW Info plugin
INFO: Using bootstrap image: fedora:32
INFO: Pulling image: fedora:32
Trying to pull registry.fedoraproject.org/fedora:32...
Getting image source signatures
Copying blob sha256:480478cefb5d287032080377942da2c2ccb15cdcc5c45f3beb06aef1267bc8c4
Copying config sha256:27a9790209529e14132d05f032228f339a4fe1dd1e93a588f5af2c06c0234969
Writing manifest to image destination
Storing signatures
27a9790209529e14132d05f032228f339a4fe1dd1e93a588f5af2c06c0234969
INFO: Copy content of container fedora:32 to /var/lib/mock/rhel-8.7.0.z-x86_64-bootstrap/root
INFO: mounting fedora:32 with podman image mount
INFO: image fedora:32 as /var/lib/containers/storage/overlay/48df8b28c24ba6e7356c15f0cbc05a48b6a23241bb93a7a6e72f742a2979111e/merged
INFO: umounting image fedora:32 (/var/lib/containers/storage/overlay/48df8b28c24ba6e7356c15f0cbc05a48b6a23241bb93a7a6e72f742a2979111e/merged) with podman image umount
Mock Version: 4.0
INFO: Mock Version: 4.0
INFO: Using package manager from the bootstrap image
INFO: Searching for /var/lib/mock/rhel-8.7.0.z-x86_64-bootstrap/root/usr/bin/dnf script in the extracted bootstrap image
INFO: Package manager dnf detected and used
Start(bootstrap): installing dnf tooling
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Last metadata expiration check: 0:00:03 ago on Fri May 26 15:35:44 2023.
Package dnf-4.4.0-3.fc32.noarch is already installed.
Dependencies resolved.
=============================================================================================================================================================================================
 Package                                          Architecture                 Version                                                        Repository                                Size
=============================================================================================================================================================================================
Installing:
 dnf-plugins-core                                 noarch                       4.0.21-14.1.el8                                                rhel-8.7.0-z-build                        71 k
Upgrading:
 cyrus-sasl-lib                                   x86_64                       2.1.27-6.el8_5                                                 rhel-8.7.0-z-build                       122 k
 dnf                                              noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       540 k
 dnf-data                                         noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       154 k
 gnupg2                                           x86_64                       2.2.20-3.el8_6                                                 rhel-8.7.0-z-build                       2.4 M
 ima-evm-utils                                    x86_64                       1.3.2-12.el8                                                   rhel-8.7.0-z-build                        63 k
 libdnf                                           x86_64                       0.63.0-11.1.el8                                                rhel-8.7.0-z-build                       708 k
 libmodulemd                                      x86_64                       2.13.0-1.el8                                                   rhel-8.7.0-z-build                       232 k
 librepo                                          x86_64                       1.14.2-3.el8                                                   rhel-8.7.0-z-build                        92 k
 libsolv                                          x86_64                       0.7.20-4.el8_7                                                 rhel-8.7.0-z-build                       375 k
 python3-dnf                                      noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       546 k
 python3-hawkey                                   x86_64                       0.63.0-11.1.el8                                                rhel-8.7.0-z-build                       116 k
 python3-libdnf                                   x86_64                       0.63.0-11.1.el8                                                rhel-8.7.0-z-build                       778 k
 yum                                              noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       205 k
Installing dependencies:
 chkconfig                                        x86_64                       1.19.1-1.el8                                                   rhel-8.7.0-z-build                       197 k
 dbus-daemon                                      x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                       240 k
 dbus-glib                                        x86_64                       0.110-2.el8                                                    rhel-8.7.0-z-build                       126 k
 dbus-libs                                        x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                       184 k
 dbus-tools                                       x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                        85 k
 gdbm                                             x86_64                       1:1.18-2.el8                                                   rhel-8.7.0-z-build                       129 k
 info                                             x86_64                       6.5-7.el8                                                      rhel-8.7.0-z-build                       197 k
 json-glib                                        x86_64                       1.4.4-1.el8                                                    rhel-8.7.0-z-build                       143 k
 librhsm                                          x86_64                       0.0.3-4.el8                                                    rhel-8.7.0-z-build                        32 k
 platform-python                                  x86_64                       3.6.8-48.el8_7.1                                               rhel-8.7.0-z-build                        85 k
 platform-python-setuptools                       noarch                       39.2.0-6.el8_7.1                                               rhel-8.7.0-z-build                       631 k
 python3-dateutil                                 noarch                       1:2.6.1-6.el8                                                  rhel-8.7.0-z-build                       250 k
 python3-dbus                                     x86_64                       1.2.4-15.el8                                                   rhel-8.7.0-z-build                       133 k
 python3-dnf-plugins-core                         noarch                       4.0.21-14.1.el8                                                rhel-8.7.0-z-build                       242 k
 python3-pip-wheel                                noarch                       9.0.3-22.el8                                                   rhel-8.7.0-z-build                       894 k
 python3-setuptools-wheel                         noarch                       39.2.0-6.el8_7.1                                               rhel-8.7.0-z-build                       288 k
 python3-six                                      noarch                       1.11.0-8.el8                                                   rhel-8.7.0-z-build                        37 k
 python38                                         x86_64                       3.8.0-6.module+el8.2.0+5978+503155c0                           rhel-8.7.0-z-build                        75 k
 python38-libs                                    x86_64                       3.8.0-6.module+el8.2.0+5978+503155c0                           rhel-8.7.0-z-build                       8.2 M
 python38-pip-wheel                               noarch                       19.2.3-5.module+el8.2.0+5979+f9f0b1d2                          rhel-8.7.0-z-build                       1.2 M
 python38-setuptools-wheel                        noarch                       41.6.0-4.module+el8.2.0+5978+503155c0                          rhel-8.7.0-z-build                       303 k
 tpm2-tss                                         x86_64                       2.3.2-4.el8                                                    rhel-8.7.0-z-build                       274 k
Removing dependent packages:
 dbus-broker                                      x86_64                       24-1.fc32                                                      @koji-override-0                         410 k
 python3                                          x86_64                       3.8.6-1.fc32                                                   @koji-override-0                          32 k
 rpm-sign-libs                                    x86_64                       4.15.1-3.fc32.1                                                @koji-override-0                          27 k
Downgrading:
 dbus                                             x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                        41 k
 dbus-common                                      noarch                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                        46 k
 gawk                                             x86_64                       4.2.1-4.el8                                                    rhel-8.7.0-z-build                       1.1 M
 gdbm-libs                                        x86_64                       1:1.18-2.el8                                                   rhel-8.7.0-z-build                        59 k
 json-c                                           x86_64                       0.13.1-3.el8                                                   rhel-8.7.0-z-build                        40 k
 libblkid                                         x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       219 k
 libfdisk                                         x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       252 k
 libmount                                         x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       235 k
 libsmartcols                                     x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       178 k
 libuuid                                          x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                        97 k
 libxcrypt                                        x86_64                       4.1.1-6.el8                                                    rhel-8.7.0-z-build                        72 k
 mpfr                                             x86_64                       3.1.6-1.el8                                                    rhel-8.7.0-z-build                       220 k
 pam                                              x86_64                       1.3.1-22.el8                                                   rhel-8.7.0-z-build                       742 k
 python3-libs                                     x86_64                       3.6.8-48.el8_7.1                                               rhel-8.7.0-z-build                       7.8 M
 python3-rpm                                      x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       154 k
 readline                                         x86_64                       7.0-10.el8                                                     rhel-8.7.0-z-build                       198 k
 rpm                                              x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       542 k
 rpm-build-libs                                   x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       156 k
 rpm-libs                                         x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       344 k
 shadow-utils                                     x86_64                       2:4.6-17.el8                                                   rhel-8.7.0-z-build                       1.2 M
 systemd                                          x86_64                       239-68.el8_7.4                                                 rhel-8.7.0-z-build                       3.6 M
 systemd-libs                                     x86_64                       239-68.el8_7.4                                                 rhel-8.7.0-z-build                       1.1 M
 systemd-pam                                      x86_64                       239-68.el8_7.4                                                 rhel-8.7.0-z-build                       491 k
 util-linux                                       x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       2.5 M

Transaction Summary
=============================================================================================================================================================================================
Install    23 Packages
Upgrade    13 Packages
Remove      3 Packages
Downgrade  24 Packages

Total download size: 42 M
Downloading Packages:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         11 MB/s |  42 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction test error:
  file /usr/sbin/alternatives from install of chkconfig-1.19.1-1.el8.x86_64 conflicts with file from package alternatives-1.11-6.fc32.x86_64
  file /usr/share/man/man8/alternatives.8.gz from install of chkconfig-1.19.1-1.el8.x86_64 conflicts with file from package alternatives-1.11-6.fc32.x86_64
  file /usr/lib/rpm/macros.d/macros.systemd from install of systemd-239-68.el8_7.4.x86_64 conflicts with file from package systemd-rpm-macros-245.8-2.fc32.noarch

ERROR: Command failed: 
 # /usr/bin/dnf --releasever el8 --setopt=deltarpm=False --allowerasing --disableplugin=local --disableplugin=spacewalk --disableplugin=versionlock install dnf dnf-plugins-core --setopt=tsflags=nocontexts
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Last metadata expiration check: 0:00:03 ago on Fri May 26 15:35:44 2023.
Package dnf-4.4.0-3.fc32.noarch is already installed.
Dependencies resolved.
=============================================================================================================================================================================================
 Package                                          Architecture                 Version                                                        Repository                                Size
=============================================================================================================================================================================================
Installing:
 dnf-plugins-core                                 noarch                       4.0.21-14.1.el8                                                rhel-8.7.0-z-build                        71 k
Upgrading:
 cyrus-sasl-lib                                   x86_64                       2.1.27-6.el8_5                                                 rhel-8.7.0-z-build                       122 k
 dnf                                              noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       540 k
 dnf-data                                         noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       154 k
 gnupg2                                           x86_64                       2.2.20-3.el8_6                                                 rhel-8.7.0-z-build                       2.4 M
 ima-evm-utils                                    x86_64                       1.3.2-12.el8                                                   rhel-8.7.0-z-build                        63 k
 libdnf                                           x86_64                       0.63.0-11.1.el8                                                rhel-8.7.0-z-build                       708 k
 libmodulemd                                      x86_64                       2.13.0-1.el8                                                   rhel-8.7.0-z-build                       232 k
 librepo                                          x86_64                       1.14.2-3.el8                                                   rhel-8.7.0-z-build                        92 k
 libsolv                                          x86_64                       0.7.20-4.el8_7                                                 rhel-8.7.0-z-build                       375 k
 python3-dnf                                      noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       546 k
 python3-hawkey                                   x86_64                       0.63.0-11.1.el8                                                rhel-8.7.0-z-build                       116 k
 python3-libdnf                                   x86_64                       0.63.0-11.1.el8                                                rhel-8.7.0-z-build                       778 k
 yum                                              noarch                       4.7.0-11.el8                                                   rhel-8.7.0-z-build                       205 k
Installing dependencies:
 chkconfig                                        x86_64                       1.19.1-1.el8                                                   rhel-8.7.0-z-build                       197 k
 dbus-daemon                                      x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                       240 k
 dbus-glib                                        x86_64                       0.110-2.el8                                                    rhel-8.7.0-z-build                       126 k
 dbus-libs                                        x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                       184 k
 dbus-tools                                       x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                        85 k
 gdbm                                             x86_64                       1:1.18-2.el8                                                   rhel-8.7.0-z-build                       129 k
 info                                             x86_64                       6.5-7.el8                                                      rhel-8.7.0-z-build                       197 k
 json-glib                                        x86_64                       1.4.4-1.el8                                                    rhel-8.7.0-z-build                       143 k
 librhsm                                          x86_64                       0.0.3-4.el8                                                    rhel-8.7.0-z-build                        32 k
 platform-python                                  x86_64                       3.6.8-48.el8_7.1                                               rhel-8.7.0-z-build                        85 k
 platform-python-setuptools                       noarch                       39.2.0-6.el8_7.1                                               rhel-8.7.0-z-build                       631 k
 python3-dateutil                                 noarch                       1:2.6.1-6.el8                                                  rhel-8.7.0-z-build                       250 k
 python3-dbus                                     x86_64                       1.2.4-15.el8                                                   rhel-8.7.0-z-build                       133 k
 python3-dnf-plugins-core                         noarch                       4.0.21-14.1.el8                                                rhel-8.7.0-z-build                       242 k
 python3-pip-wheel                                noarch                       9.0.3-22.el8                                                   rhel-8.7.0-z-build                       894 k
 python3-setuptools-wheel                         noarch                       39.2.0-6.el8_7.1                                               rhel-8.7.0-z-build                       288 k
 python3-six                                      noarch                       1.11.0-8.el8                                                   rhel-8.7.0-z-build                        37 k
 python38                                         x86_64                       3.8.0-6.module+el8.2.0+5978+503155c0                           rhel-8.7.0-z-build                        75 k
 python38-libs                                    x86_64                       3.8.0-6.module+el8.2.0+5978+503155c0                           rhel-8.7.0-z-build                       8.2 M
 python38-pip-wheel                               noarch                       19.2.3-5.module+el8.2.0+5979+f9f0b1d2                          rhel-8.7.0-z-build                       1.2 M
 python38-setuptools-wheel                        noarch                       41.6.0-4.module+el8.2.0+5978+503155c0                          rhel-8.7.0-z-build                       303 k
 tpm2-tss                                         x86_64                       2.3.2-4.el8                                                    rhel-8.7.0-z-build                       274 k
Removing dependent packages:
 dbus-broker                                      x86_64                       24-1.fc32                                                      @koji-override-0                         410 k
 python3                                          x86_64                       3.8.6-1.fc32                                                   @koji-override-0                          32 k
 rpm-sign-libs                                    x86_64                       4.15.1-3.fc32.1                                                @koji-override-0                          27 k
Downgrading:
 dbus                                             x86_64                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                        41 k
 dbus-common                                      noarch                       1:1.12.8-23.el8_7.1                                            rhel-8.7.0-z-build                        46 k
 gawk                                             x86_64                       4.2.1-4.el8                                                    rhel-8.7.0-z-build                       1.1 M
 gdbm-libs                                        x86_64                       1:1.18-2.el8                                                   rhel-8.7.0-z-build                        59 k
 json-c                                           x86_64                       0.13.1-3.el8                                                   rhel-8.7.0-z-build                        40 k
 libblkid                                         x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       219 k
 libfdisk                                         x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       252 k
 libmount                                         x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       235 k
 libsmartcols                                     x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       178 k
 libuuid                                          x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                        97 k
 libxcrypt                                        x86_64                       4.1.1-6.el8                                                    rhel-8.7.0-z-build                        72 k
 mpfr                                             x86_64                       3.1.6-1.el8                                                    rhel-8.7.0-z-build                       220 k
 pam                                              x86_64                       1.3.1-22.el8                                                   rhel-8.7.0-z-build                       742 k
 python3-libs                                     x86_64                       3.6.8-48.el8_7.1                                               rhel-8.7.0-z-build                       7.8 M
 python3-rpm                                      x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       154 k
 readline                                         x86_64                       7.0-10.el8                                                     rhel-8.7.0-z-build                       198 k
 rpm                                              x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       542 k
 rpm-build-libs                                   x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       156 k
 rpm-libs                                         x86_64                       4.14.3-24.el8_7                                                rhel-8.7.0-z-build                       344 k
 shadow-utils                                     x86_64                       2:4.6-17.el8                                                   rhel-8.7.0-z-build                       1.2 M
 systemd                                          x86_64                       239-68.el8_7.4                                                 rhel-8.7.0-z-build                       3.6 M
 systemd-libs                                     x86_64                       239-68.el8_7.4                                                 rhel-8.7.0-z-build                       1.1 M
 systemd-pam                                      x86_64                       239-68.el8_7.4                                                 rhel-8.7.0-z-build                       491 k
 util-linux                                       x86_64                       2.32.1-39.el8_7                                                rhel-8.7.0-z-build                       2.5 M

Transaction Summary
=============================================================================================================================================================================================
Install    23 Packages
Upgrade    13 Packages
Remove      3 Packages
Downgrade  24 Packages

Total download size: 42 M
Downloading Packages:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         11 MB/s |  42 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction test error:
  file /usr/sbin/alternatives from install of chkconfig-1.19.1-1.el8.x86_64 conflicts with file from package alternatives-1.11-6.fc32.x86_64
  file /usr/share/man/man8/alternatives.8.gz from install of chkconfig-1.19.1-1.el8.x86_64 conflicts with file from package alternatives-1.11-6.fc32.x86_64
  file /usr/lib/rpm/macros.d/macros.systemd from install of systemd-239-68.el8_7.4.x86_64 conflicts with file from package systemd-rpm-macros-245.8-2.fc32.noarch

This is the configuration file:

# cat /etc/mock/rhel-8.7.0.z-x86_64.cfg 
config_opts['root'] = 'rhel-8.7.0.z-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['chroot_setup_cmd'] = 'install @build coreutils-full curl-full glibc-all-langpacks libcurl-full openssl-devel python3-devel'
config_opts['dist'] = 'el8'  # only useful for --resultdir variable subst
config_opts['releasever'] = 'el8'

config_opts['chroothome'] = '/builddir'
config_opts['basedir'] = '/var/lib/mock'

config_opts['use_host_resolv'] = False
config_opts['rpmbuild_timeout'] = 86400

config_opts['plugin_conf']['ccache_enable'] = False

config_opts['macros']['%_host'] = 'x86_64-koji-linux-gnu'
config_opts['macros']['%_host_cpu'] = 'x86_64'
config_opts['macros']['%vendor'] = 'Red Hat, Inc.'
config_opts['macros']['%dist'] = '.el8_7'
config_opts['macros']['%distribution'] = 'Red Hat, Inc.'
config_opts['macros']['%_topdir'] = '/builddir/build'
config_opts['macros']['%_rpmfilename'] = '%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'
config_opts['macros']['%packager'] = 'Red Hat, Inc.'

config_opts['package_manager'] = 'dnf'

# needed for dnf to work with Fedora zstd-compressed packages on el7
config_opts['use_bootstrap'] = True
config_opts['use_bootstrap_image'] = True
config_opts['bootstrap_image'] = 'fedora:32'

config_opts['yum.conf'] = """
[main]
cachedir=/var/cache/dnf
debuglevel=1
logfile=/var/log/yum.log
reposdir=/dev/null
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
keepcache=1
install_weak_deps=0
strict=1

# repos
[rhel-8.7.0-z-build]
name=rhel-8.7.0-z-build
baseurl=http://download.eng.bos.redhat.com/brewroot/repos/rhel-8.7.0-z-build/latest/x86_64
module_hotfixes=True
"""

I think it is related to pull request #1073, which is the reason why we updated to mock-4.0 on OpenScanHub workers. Thank you for working on it!

@kdudka kdudka changed the title bootstrap image stopped working with mock-4.0 with certain configuration bootstrap image stopped working with mock-4.0 with certain configurations May 26, 2023
@praiskup
Copy link
Member

Thank you for the report! I did not realize this issue before.

The point of bootstrap chroot is (historically) to make it as close as
possible to the target buildroot (build chroot). To have the "target"
DNF-stack/RPM-stack tooling installed - e.g. to calculate the
buildroot installation transactions the expected way (with the target
tooling).

Here we use fedora:32 for EL8 chroot, which definitely is a bit old.
Can't you use config_opts['bootstrap_image'] = 'registry.access.redhat.com/ubi8/ubi'?
That would fix the problem.

The mock v4.0 process fails here of course because we try to install EL8 packages
(normally available in the target buildroot) into the Fedora 32 "image". With
mock < v4.0 we simply used the .repo files installed in the downloaded
image (so we installed fc32 package before).

Now I'm not sure. We either can document this as a known thing, or we can
have an explicit option that will tell Mock to not touch the repo files inside
bootstrap. I don't think we want to switch back though. With bootstrap, users
very often want to use some pre-release DNF/RPM versions (not shipped in
default repositories, only provided by additional (Copr) repository). And thus
using the target repositories set seems like the most valid default.

@kdudka
Copy link
Contributor Author

kdudka commented May 29, 2023

Thanks for the quick reply on this! I think you are right. It is a bad idea to use the fedora:32 image for production scans of rhel-8.7.0.z packages. Using config_opts['bootstrap_image'] = 'registry.access.redhat.com/ubi8/ubi' for rhel-8.7.0.z seems to solve the problem. I will update all el8/el9 mock configs to use ubi8/ubi9 images and will let you know if we hit any other issues.

@praiskup praiskup added the documentation Wiki, manual page or other documentation fix label May 29, 2023
@kdudka
Copy link
Contributor Author

kdudka commented May 29, 2023

ubi9 does not work well as a bootstrap image for rhel-9-alpha, rhel-9-beta, and rhel-9.0.0.z because the image contains a newer dnf stack than the target buildroot:

$ mock -r rhel-9.0.0.z-x86_64 --init
INFO: mock.py version 4.0 starting (python version = 3.11.3, NVR = mock-4.0-1.fc37)...
Start(bootstrap): init plugins
INFO: selinux enabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start: clean chroot
Finish: clean chroot
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: enabled HW Info plugin
INFO: Using bootstrap image: registry.access.redhat.com/ubi9/ubi
INFO: Pulling image: registry.access.redhat.com/ubi9/ubi
Trying to pull registry.access.redhat.com/ubi9/ubi:latest...
Getting image source signatures
Checking if image destination supports signatures
Copying blob sha256:33b9f09cff46d8b03b1185767b94e3881ea4cb8a671dd16ca1403f599fb2ed8f
Copying config sha256:e7236a3e070f267713ad79c451b8628166abc0bc9c855f624619e099ec3faa99
Writing manifest to image destination
Storing signatures
e7236a3e070f267713ad79c451b8628166abc0bc9c855f624619e099ec3faa99
INFO: Copy content of container registry.access.redhat.com/ubi9/ubi to /var/lib/mock/rhel-9.0.0.z-x86_64-bootstrap/root
INFO: mounting registry.access.redhat.com/ubi9/ubi with podman image mount
INFO: image registry.access.redhat.com/ubi9/ubi as /var/lib/containers/storage/overlay/d91b2949283ab74ad98179b5e52dca6c5ce9952f23038246cc0015dee43e2f23/merged
INFO: umounting image registry.access.redhat.com/ubi9/ubi (/var/lib/containers/storage/overlay/d91b2949283ab74ad98179b5e52dca6c5ce9952f23038246cc0015dee43e2f23/merged) with podman image umount
Mock Version: 4.0
INFO: Mock Version: 4.0
INFO: Using package manager from the bootstrap image
INFO: Searching for /var/lib/mock/rhel-9.0.0.z-x86_64-bootstrap/root/usr/bin/dnf script in the extracted bootstrap image
INFO: Package manager dnf detected and used
Start(bootstrap): installing dnf tooling
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.

This system is not registered with an entitlement server. You can use subscription-manager to register.

Package dnf-4.14.0-5.el9_2.noarch is already installed.
Error: 
 Problem: package dnf-plugins-core-4.0.24-4.el9_0.noarch requires python3-dnf-plugins-core = 4.0.24-4.el9_0, but none of the providers can be installed
  - package dnf-4.14.0-5.el9_2.noarch conflicts with python3-dnf-plugins-core < 4.0.26 provided by python3-dnf-plugins-core-4.0.24-4.el9_0.noarch
  - cannot install the best candidate for the job
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
ERROR: Command failed: 
 # /usr/bin/dnf --releasever el9 --setopt=deltarpm=False --allowerasing --disableplugin=local --disableplugin=spacewalk --disableplugin=versionlock install dnf dnf-plugins-core --setopt=tsflags=nocontexts
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Updating Subscription Management repositories.
Unable to read consumer identity
Subscription Manager is operating in container mode.

This system is not registered with an entitlement server. You can use subscription-manager to register.

Package dnf-4.14.0-5.el9_2.noarch is already installed.
Error: 
 Problem: package dnf-plugins-core-4.0.24-4.el9_0.noarch requires python3-dnf-plugins-core = 4.0.24-4.el9_0, but none of the providers can be installed
  - package dnf-4.14.0-5.el9_2.noarch conflicts with python3-dnf-plugins-core < 4.0.26 provided by python3-dnf-plugins-core-4.0.24-4.el9_0.noarch
  - cannot install the best candidate for the job
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

I am still testing it with the other mock configs.

@praiskup
Copy link
Member

Thank you for the research here. Does it make sense to experiment with older images like registry.access.redhat.com/ubi9/ubi:9.0.0? See podman search output:

$ podman search --list-tags  registry.access.redhat.com/ubi9/ubi
NAME                                 TAG
registry.access.redhat.com/ubi9/ubi  9.0.0-1468
registry.access.redhat.com/ubi9/ubi  9.0.0-1604-source
registry.access.redhat.com/ubi9/ubi  9.1.0
registry.access.redhat.com/ubi9/ubi  9.1.0-1646.1669023907
registry.access.redhat.com/ubi9/ubi  9.0.0
registry.access.redhat.com/ubi9/ubi  9.1.0-1750-source
registry.access.redhat.com/ubi9/ubi  9.1.0-1750.1675784955-source
registry.access.redhat.com/ubi9/ubi  9.0.0-1640.1666621574
registry.access.redhat.com/ubi9/ubi  9.1.0-1817
registry.access.redhat.com/ubi9/ubi  9.1.0-1817-source
registry.access.redhat.com/ubi9/ubi  9.0.0-1640.1666621574-source
registry.access.redhat.com/ubi9/ubi  9.1.0-1750
registry.access.redhat.com/ubi9/ubi  9.1.0-1646.1669627755
registry.access.redhat.com/ubi9/ubi  9.0.0-1576-source
registry.access.redhat.com/ubi9/ubi  9.1.0-1782-source
registry.access.redhat.com/ubi9/ubi  9.0.0-1640.1665068441
registry.access.redhat.com/ubi9/ubi  9.1.0-1750.1675784955
registry.access.redhat.com/ubi9/ubi  9.1.0-1646
registry.access.redhat.com/ubi9/ubi  9.1
registry.access.redhat.com/ubi9/ubi  9.2
registry.access.redhat.com/ubi9/ubi  9.0.0-1640.1665068441-source
registry.access.redhat.com/ubi9/ubi  9.0.0-1571
registry.access.redhat.com/ubi9/ubi  9.0.0-1576
registry.access.redhat.com/ubi9/ubi  9.0.0-1690
registry.access.redhat.com/ubi9/ubi  9.0.0-1468.1655190709-source

@kdudka
Copy link
Contributor Author

kdudka commented May 30, 2023

I was able to bootstrap the rhel-9.0.0.z-x86-64 buildroot with the registry.access.redhat.com/ubi9/ubi:9.0.0-1468 image. For rhel-9-alpha and rhel-9-beta, I was able to use the f32 and f34 images, respectively. For now we have a working configuration for all the (re)builds we care about. No extra option in mock will be needed. Thanks!

@praiskup
Copy link
Member

praiskup commented Jun 9, 2023

There are two things we could do to solve all potential issues. And both IMO seems worth implementing.

  1. option to keep the image built-in repositories, without overriding them with "target buildroot" dnf.conf
  2. option to keep the bootstrap as-provided by the image, without even attempting to install additional packages into the bootstrap chroot

Option 1. is not as trivial to implement as it sounds. There are several layers of abstraction
the option would be affected (but I haven't tried any PoC so far, perhaps I'm wrong).

Option 2. seems a bit easier at first sight, we would simply stop doing dnf_install_command. The image would have to have python3-dnf and dnf-plugins-core baken in. This doesn't sound like a hard requirement even for the end-user as hosting custom images on quay.io or alike isn't a problem. And eventually, not doing any bootstrap specific package management operations would speed up Mock a lot - we wouldn't have to download all the repository metadata twice (once for bootstrap PM operations, once for the target chroot operations).

Both those options seem complementary. Also, there is yet another option, we could experiment with and document some bootstrap-specific config_opts['dnf.conf'] setup (that might be even possible now, without changing Mock).

@praiskup
Copy link
Member

praiskup commented Jun 9, 2023

Option 2, ad python3-dnf and dnf-plugins-core

With config_opts["package_manager"] = 'dnf' actually, it is very possible that the dnf5 and dnf5-plugins packages will be part of the default installation so no additional image modification will be needed since fedora:39.

bootstrap-specific config_opts['dnf.conf']

I namely think about the config_opts['bootstrap_dnf.conf'] option which should work.

@praiskup praiskup changed the title bootstrap image stopped working with mock-4.0 with certain configurations Mock 4+ no longer uses the DNF config shipped in bootstrap_image Jun 9, 2023
@praiskup praiskup added the enhancement feature request, rfe label Jun 9, 2023
@praiskup
Copy link
Member

Similar problems with openSUSE Tumbleweed i686:

Mock Version: 4.1
INFO: Mock Version: 4.1
INFO: Package manager dnf detected and used (fallback)
Start(bootstrap): installing dnf tooling
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Copr repository                                 6.1 kB/s | 1.1 kB     00:00    
openSUSE Tumbleweed - i586 - OSS                 36 MB/s |  55 MB     00:01    
allow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands
Package python3-dnf-4.14.0-3.1.noarch is already installed.
Error: 
 Problem: package python3-dnf-plugins-core-4.3.1-2.1.noarch from opensuse-tumbleweed-oss requires python3-dbus-python, but none of the providers can be installed
  - package python310-dbus-python-1.3.2-1.5.i586 from opensuse-tumbleweed-oss requires libc.so.6(GLIBC_2.4), but none of the providers can be installed
  - package dnf-plugins-core-4.3.1-2.1.noarch from opensuse-tumbleweed-oss requires python3-dnf-plugins-core = 4.3.1-2.1, but none of the providers can be installed
  - cannot install both glibc-2.37-4.1.i686 from opensuse-tumbleweed-oss and glibc-2.37-4.1.x86_64 from @System
  - glibc-2.37-4.1.i586 from opensuse-tumbleweed-oss  does not belong to a distupgrade repository
  - conflicting requests
  - problem with installed package glibc-2.37-4.1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
WARNING: DNF command failed, retrying, attempt #2, sleeping 20s
No matches found for the following disable plugin patterns: local, spacewalk, versionlock
Copr repository                                  61 kB/s | 1.5 kB     00:00    
openSUSE Tumbleweed - i586 - OSS                 28 kB/s |  11 kB     00:00    
allow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands
Package python3-dnf-4.14.0-3.1.noarch is already installed.
Error: 
 Problem: package python3-dnf-plugins-core-4.3.1-2.1.noarch from opensuse-tumbleweed-oss requires python3-dbus-python, but none of the providers can be installed
  - package python310-dbus-python-1.3.2-1.5.i586 from opensuse-tumbleweed-oss requires libc.so.6(GLIBC_2.4), but none of the providers can be installed
  - package dnf-plugins-core-4.3.1-2.1.noarch from opensuse-tumbleweed-oss requires python3-dnf-plugins-core = 4.3.1-2.1, but none of the providers can be installed
  - cannot install both glibc-2.37-4.1.i686 from opensuse-tumbleweed-oss and glibc-2.37-4.1.x86_64 from @System
  - glibc-2.37-4.1.i586 from opensuse-tumbleweed-oss  does not belong to a distupgrade repository
  - conflicting requests
  - problem with installed package glibc-2.37-4.1.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

@kdudka
Copy link
Contributor Author

kdudka commented Jun 14, 2023

Sounds like great news. Thank you for working on it, Pavel!

If any testing is needed from the OpenScanHub team, please let me know.

praiskup added a commit to praiskup/mock that referenced this issue Jun 21, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
@praiskup
Copy link
Member

praiskup commented Jun 21, 2023

I realized that dnf builddep actually works fine in ubi8 and ubi9 (not the case for fedora images unfortunately, but that might change with rpm-software-management/dnf5#597).

So, for the RHEL 8+ case, using ubi, #1126 should help by actually "doing nothing" with DNF in the bootstrap chroot.

praiskup added a commit to praiskup/mock that referenced this issue Jun 26, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
praiskup added a commit to praiskup/mock that referenced this issue Jun 26, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
praiskup added a commit to praiskup/mock that referenced this issue Jun 26, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
praiskup added a commit to praiskup/mock that referenced this issue Jun 26, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
praiskup added a commit to praiskup/mock that referenced this issue Jun 26, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
praiskup added a commit to praiskup/mock that referenced this issue Jun 27, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
praiskup added a commit to praiskup/mock that referenced this issue Jun 29, 2023
There's a new option config_opts['bootstrap_image_ready'] which, if set,
causes that Mock doesn't try to install any tooling into it (silently
expecting that 'dnf' and 'dnf builddep' works inside).

Turns out that e.g. the ubi8 and ubi9 images have the 'builddep' command
installed by default, therefore we can turn this option ON by default.

Fixes: rpm-software-management#1088
@xsuchy xsuchy closed this as completed in e7139e1 Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Wiki, manual page or other documentation fix enhancement feature request, rfe
Projects
None yet
Development

No branches or pull requests

2 participants