1

I'm working on a Redhat Ubi8-minimal Container. My goal is to install an .rpm from file together with its dependencies. Ubi8-minimal only provides microdnf which cannot install local .rpm's. So I installed yum using microdnf install yum which runs through fine. Among the output it shows that libmodulemd is being updated:

Updating: libmodulemd;2.13.0-2.fc34;x86_64;Clients_Fedora_34_Fedora_34_Updates

But with the first invocation of yum I get:

[root@7fc9c0e586b1]# yum --version
Traceback (most recent call last):
  File "/usr/bin/yum", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.9/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.9/site-packages/dnf/base.py", line 29, in <module>
    import libdnf.transaction
  File "/usr/lib64/python3.9/site-packages/libdnf/__init__.py", line 12, in <module>
    from . import conf
  File "/usr/lib64/python3.9/site-packages/libdnf/conf.py", line 13, in <module>
    from . import _conf
ImportError: /lib64/libmodulemd.so.2: undefined symbol: g_ptr_array_extend_and_steal

After that microdnf too has this problem and is no longer usable:

[root@7fc9c0e586b1]# microdnf --version
microdnf: symbol lookup error: /lib64/libmodulemd.so.2: undefined symbol: g_ptr_array_extend_and_steal

so I cannot manage any packages and installations anymore.

How can I fix this and get yum to work on Ubi8?

Details

Here is what I find in a fresh container after running podman --it --rm docker.io/redhat/ubi8-minimal bash

/etc/yum.repos.d/ubi.repo

Here is the contents of /etc/yum.repos.d/ubi.repo.

[ubi-8-baseos]
name = Red Hat Universal Base Image 8 (RPMs) - BaseOS
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/baseos/os
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgcheck = 1

[ubi-8-baseos-debug] name = Red Hat Universal Base Image 8 (Debug RPMs) - BaseOS baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/baseos/debug enabled = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-baseos-source] name = Red Hat Universal Base Image 8 (Source RPMs) - BaseOS baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/baseos/source/SRPMS enabled = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-appstream] name = Red Hat Universal Base Image 8 (RPMs) - AppStream baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/appstream/os enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-appstream-debug] name = Red Hat Universal Base Image 8 (Debug RPMs) - AppStream baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/appstream/debug enabled = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-appstream-source] name = Red Hat Universal Base Image 8 (Source RPMs) - AppStream baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/appstream/source/SRPMS enabled = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-codeready-builder] name = Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/codeready-builder/os enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-codeready-builder-debug] name = Red Hat Universal Base Image 8 (Debug RPMs) - CodeReady Builder baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/codeready-builder/debug enabled = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

[ubi-8-codeready-builder-source] name = Red Hat Universal Base Image 8 (Source RPMs) - CodeReady Builder baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi8/8/$basearch/codeready-builder/source/SRPMS enabled = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release gpgcheck = 1

This is also the only .repo file in the directory. I have not actively enabled any other repos.

microdnf repolist --enabled

Here is the output of the microdnf repolist --enabled command.

repo id                                                                                            repo name
Clients_Extra-Software_Fedora                                                                      Fedora
Clients_Fedora_34_Fedora_34_Everything                                                             Fedora 34 Everything
Clients_Fedora_34_Fedora_34_Updates                                                                Fedora 34 Updates
Clients_RPM_Fusion_Fedora_34_RPM_Fusion_Free_OS                                                    RPM Fusion Free OS 34
Clients_RPM_Fusion_Fedora_34_RPM_Fusion_Free_Updates                                               RPM Fusion Free Updates 34
Clients_RPM_Fusion_Fedora_34_RPM_Fusion_Nonfree_OS                                                 RPM Fusion Nonfree OS 34
Clients_RPM_Fusion_Fedora_34_RPM_Fusion_Nonfree_Updates                                            RPM Fusion Nonfree Updates 34
Clients_Trinity_Desktop_Environment_Fedora_34_Trinity_Desktop_Environment_Fedora_34_noarch         Trinity Desktop Environment Fedora 34 noarch
Clients_Trinity_Desktop_Environment_Fedora_34_Trinity_Desktop_Environment_Fedora_34_x86_64         Trinity Desktop Environment Fedora 34 x86_64
ubi-8-appstream                                                                                    Red Hat Universal Base Image 8 (RPMs) - AppStream
ubi-8-baseos                                                                                       Red Hat Universal Base Image 8 (RPMs) - BaseOS
ubi-8-codeready-builder                                                                            Red Hat Universal Base Image 8 (RPMs) - CodeReady Builder

Which is quite confusing to me, as it doesn't match the contents of ubi.repo.

ThomasH
  • 121

2 Answers2

2

When any dnf command results in an undefined symbol, your package manager is badly broken. fc34 tag implies Fedora 34 based updates, which is not going to work with an el8 based distro. Find out what is using Fedora repos here.

Review documentation for hints as to how to run a full dnf command on a container. RHEL 8 on building containers makes use of yum's install into a chroot feature to do this even with micro containers. From the host:

yum install \
    --installroot $micromount \
    --releasever 8 \
    --setopt install_weak_deps=false \
    --nodocs -y \
    httpd

Where $micromount is a mounted container root file system, --releasever 8 is the el version of the continer, and httpd is the package you want to install. Also repair your dnf install, possibly with yum reinstall libmodulemd microdnf

John Mahowald
  • 36,071
0

Thanks to hints from John Mahowald pointing at fc34 repos getting involved, a workaround solution is to exclude the Fedora repos when installing yum:

microdnf install --disablerepo="Clients_*" yum

This leads to a working yum installation:

[root@4f6b589029d5]# yum --version
4.7.0
  Installed: dnf-0:4.7.0-8.el8.noarch at Mon Aug 22 06:56:42 2022
  Built    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Fri Mar 18 15:21:28 2022

Installed: rpm-0:4.14.3-23.el8.x86_64 at Tue Jul 26 12:26:21 2022 Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> at Tue Apr 5 18:38:09 2022

The reason why this is necessary in the first place seems to be an interaction of the container with the subscription-manager of the host system which projects subscription information into the running container. Besides mentionings of other users and my own experience I haven't found any primary documentation on this, though.

ThomasH
  • 121