Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionCédric Jeanneret
2022-06-09 14:09:51 UTC
Description of problem:
While testing osp-17 on a rhel9 host, subscribed to a satellite host, we're facing consistent issue with subscription-manager overriding the /etc/yum.repos.d/redhat.repo because it thinks it's running from within a container.
Some more context is available here:
https://bugzilla.redhat.com/show_bug.cgi?id=2058540
as well as our QE hitting that precise issue here:
https://bugzilla.redhat.com/show_bug.cgi?id=2075080
Basically:
- OSP has a "standard" bind-mount or /run:/run in all containers
- podman (container engine) pushes a /run/.containerenv file
- this file is then visible from the host
- dnf has an enabled plugin, "subscription-manager", running before any command (clean, makecache, install, erase, etc)
So, as soon as we have one container with that mount running on the node, and get any dnf command running, subscription-manager kicks in. It then thinks it's in a container and, instead of keeping the repo list as-is, it will override it.
But ONLY a small part: the equivalent of the rhsm "baseurl" - meaning it will be switched to https://cdn.redhat.com/<all the satellite path set during registration>
You can see such example in 2075080#c0.
IMHO, subcription-manager should NOT touch the repository list at all if it thinks it's in a container, especially when there's a valid /etc/rhsm/rhsm.conf file available (with all the correct settings)
Small thoughts about that:
what would happen if we run this:
podman run -v /etc/dnf:/etc/dnf -v /etc/yum.repos.d:/etc/yum.repos.d ubi9 dnf install httpd
Apparently, following what I've seen, it would at least try to edit the repository list (since running in a container), but SHOULD fail, thanks to SELinux (but would succeed on a permissive system - note that ":z" won't apply to those locations afaik).
Note:
- we can, of course, export the SMDEV_CONTAINER_OFF=True as an /etc/profile.d/ thingy (that's what I'm going to propose as a "sensible workaround" within tripleo/osp)
- we may be able to work in order to stop mounting /run, and expose only subdirectories
- or maybe podman can stop exposing that precise file on the host
But, really, subscription-manager shouldn't touch repository files if thinking it's in a container.
Cheers,
C.
After discussions, this is expected behavior, and OSP isn't affected anymore (by exporting the variable, and with a podman patch that is coming through https://bugzilla.redhat.com/show_bug.cgi?id=2097694.