Bug 1972073

Summary: /etc/hosts contains invalid IP address
Product: [Fedora] Fedora Reporter: Pavel Holica <pholica>
Component: podmanAssignee: Matthew Heon <mheon>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: acui, bbaude, container-sig, debarshir, dwalsh, jnovy, jpazdziora, lsm5, mheon, patrick, pehunt, pholzing, rh.container.bot, santiago
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-23 14:20:37 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:

Description Pavel Holica 2021-06-15 08:19:13 UTC
Description of problem:
With recent podman update to podman-3:3.2.0-5.fc34.x86_64 I've noticed broken networking in the container in form of /etc/hosts containing IP address that's not reachable by the container itself but it's associated to the hostname of the container.

Version-Release number of selected component (if applicable):
podman-3:3.2.0-5.fc34.x86_64

How reproducible:
always

Steps to Reproduce:
1. podman run --rm -it registry.fedoraproject.org/fedora:34 cat /etc/hosts

Actual results:
$ podman run --rm -it registry.fedoraproject.org/fedora:34 cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# used by slirp4netns
10.0.2.2        9157f08f6462 hardcore_yalow
10.0.2.2 host.containers.internal

Expected results:
$ podman run --rm -it registry.fedoraproject.org/fedora:34 cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# used by slirp4netns
10.0.2.100      9157f08f6462 hardcore_yalow

Additional info:
When checking the ip address of the container, it's 10.0.2.100 so this is the value that should be in /etc/hosts.
This breaks so many things like python detection of the IP address: socket.gethostbyname(socket.gethostname())

Comment 1 Pavel Holica 2021-06-15 08:20:26 UTC
After downgrading to older podman (podman-3.1.0-1.fc34.x86_64), everything works as expected.

Comment 2 Pavel Holica 2021-06-15 08:22:08 UTC
Note that podman in updates-testing podman-3:3.2.1-1.fc34.x86_64 has the issue as well.

Comment 3 Paul Holzinger 2021-06-15 11:47:12 UTC
Upstream fix: https://github.com/containers/podman/pull/10684

Comment 4 Pavel Holica 2021-06-15 13:02:11 UTC
Wow, that was quick. Thanks for the fix :)

Comment 5 Matthew Heon 2021-06-15 17:26:03 UTC
*** Bug 1971677 has been marked as a duplicate of this bug. ***