Bug 1972073 - /etc/hosts contains invalid IP address
Summary: /etc/hosts contains invalid IP address
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: podman
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthew Heon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1971677 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-15 08:19 UTC by Pavel Holica
Modified: 2022-03-23 14:20 UTC (History)
14 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-03-23 14:20:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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. ***


Note You need to log in before you can comment on or make changes to this bug.