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.

Bug 1902979

Summary: podman run fails to update /etc/hosts when --uidmap is provided
Product: Red Hat Enterprise Linux 8 Reporter: Suhaas Bhat <subhat>
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: Alex Jia <ajia>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.3CC: bbaude, dornelas, dwalsh, jligon, jnovy, lsm5, mheon, pthomas, tsweeney, umohnani, ypu
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-2.2.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:32:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1186913, 1823899    

Description Suhaas Bhat 2020-12-01 03:04:29 UTC
Description of problem:
We do not see a hostname entry inside /etc/hosts file whenever --uidmap is provided against a podman run.

Version-Release number of selected component (if applicable):
 podman-2.0.5-5.module+el8.3.0+8221+97165c3f.x86_64

How reproducible:
Fully

Actual results: podman does not update /etc/hosts when using --uidmap


Expected results:podman should make a default entry when using --uidmap


Additional info:

Comment 1 Matthew Heon 2020-12-01 14:20:11 UTC
Fixed upstream by https://github.com/containers/podman/commit/3ae47f7d2b9328ff47dc5702d834ae9ee296a27b. A version with the fix should land in RHEL 8.4.

Comment 6 Alex Jia 2021-01-19 08:21:27 UTC
I got 'permission denied' on fixed version podman-2.2.0-1, please
gave correct fixed version.

# podman run --uidmap 0:100000:1000 --rm --hostname foohostname quay.io/libpod/alpine grep foohostname /etc/hosts
Trying to pull quay.io/libpod/alpine:latest...
Getting image source signatures
Copying blob 9d16cba9fb96 done
Copying config 9617696764 done
Writing manifest to image destination
Storing signatures
Error: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "sysfs" to rootfs at "/sys" caused: operation not permitted: OCI permission denied

# rpm -q podman runc crun kernel
podman-2.2.0-1.module+el8.4.0+8963+6755fc2b.x86_64
runc-1.0.0-68.rc92.module+el8.4.0+8963+6755fc2b.x86_64
crun-0.16-1.module+el8.4.0+8963+6755fc2b.x86_64
kernel-4.18.0-259.el8.x86_64

And verified on podman-3.0.0-0.21.module+el8.4.0+9425+98db097b.x86_64.

# podman run --uidmap 0:100000:1000 --rm --hostname foohostname quay.io/libpod/alpine grep foohostname /etc/hosts
Trying to pull quay.io/libpod/alpine:latest...
Getting image source signatures
Copying blob 9d16cba9fb96 done
Copying config 9617696764 done
Writing manifest to image destination
Storing signatures
10.88.0.2    foohostname practical_pare


# rpm -q podman runc crun kernel
podman-3.0.0-0.21.module+el8.4.0+9425+98db097b.x86_64
runc-1.0.0-69.rc92.module+el8.4.0+9425+98db097b.x86_64
crun-0.16-2.module+el8.4.0+9425+98db097b.x86_64
kernel-4.18.0-272.el8.dt5.x86_64

Comment 7 Tom Sweeney 2021-01-19 21:22:50 UTC
Alex/Jindrich,

As this BZ is targeted for RHEL 8.4, I think Alex should be testing with Podman 3.0.  Jindrich to you concur?

Comment 8 Jindrich Novy 2021-01-20 09:55:12 UTC
Tom, yes you are right.

Alex, please re-test with podman-3.0.0 which is aimed at 8.4.0, thanks!

Comment 9 Alex Jia 2021-02-01 13:29:54 UTC
(In reply to Jindrich Novy from comment #8)
> Tom, yes you are right.
> 
> Alex, please re-test with podman-3.0.0 which is aimed at 8.4.0, thanks!

I also gave a test on podman-3.0.0, it works for me, for details, please see Comment 6.

Comment 11 errata-xmlrpc 2021-05-18 15:32:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: container-tools:rhel8 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:1796