Bug 2115988

Summary: Recent podman upgrade causes container to fail with error "invalid config provided: extra host entries must be specified on the pod: network cannot be configured when it is shared with a pod"
Product: Red Hat Enterprise Linux 8 Reporter: Brian Masney <bmasney>
Component: podmanAssignee: Tom Sweeney <tsweeney>
Status: CLOSED WORKSFORME QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.6CC: bbaude, dwalsh, jligon, jnovy, lsm5, mheon, pthomas, umohnani
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-08 20:48:02 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 Brian Masney 2022-08-05 23:00:00 UTC
Description of problem:

I am running the application https://github.com/masneyb/cavedbmanager on RHEL 8.6 and it runs inside 4 different containers: a webserver, database, worker, and cron scheduler. Podman began to fail with the following error message after the most recent upgrade:

podman[3679]: Error: invalid config provided: extra host entries must be specified on the pod: network cannot be configured when it is shared with a pod

This worked prior to this package upgrade.


Version-Release number of selected component (if applicable):

podman-4.1.1-2.module+el8.6.0+15917+093ca6f8.x86_64


Steps to Reproduce:

Note that the code on that github link doesn't contain the systemd units that I use on RHEL 8.6. There's two of them that are relevant for this bug. The first starts the internal networking for the pod:

[Unit]
Description=WVASS Networking
Requires=network-online.target
After=network-online.target

[Service]
User=root
Type=forking
KillMode=none
Restart=on-failure
RemainAfterExit=yes
ExecStartPre=-podman pod rm wvass-server
ExecStart=podman pod create --name=wvass-server --share net -p 8443:443
ExecStop=podman pod rm wvass-server

[Install]
WantedBy=multi-user.target


The second systemd unit starts the postgresql database:

[Unit]
Description=WVASS PostgreSQL
Requires=network-online.target wvass-cavedbmanager-network.service
After=network-online.target wvass-cavedbmanager-network.service

# The ExecStart and ExecStop commands below were generated by running the docker-compose.yml file through podman-compose. I am pretty sure it was this project: https://github.com/containers/podman-compose. (I did this a few years ago.)

[Service]
User=root
Type=forking
KillMode=none
Restart=on-failure
RemainAfterExit=yes
WorkingDirectory=/var/data/wvass/cavedbmanager
ExecStartPre=-podman rm wvass-server_postgresql_1
ExecStartPre=podman build --file Dockerfile.base --tag cavedbmanager_base:latest .
ExecStartPre=podman build -t wvass-server_postgresql -f /var/data/wvass/cavedbmanager/Dockerfile.db /var/data/wvass/cavedbmanager
ExecStart=podman run -d --name=wvass-server_postgresql_1 --pod=wvass-server -e LC_CTYPE=C.UTF-8 -e PGDATA=/var/lib/postgresql -e PGUSER=XXX -e PGPASSWORD=XXX --mount type=bind,source=/var/data/wvass/cavedb-postgresql-10,destination=/var/lib/postgresql,bind-propagation=Z --add-host postgresql:127.0.0.1 --add-host wvass-server_postgresql_1:127.0.0.1 --add-host worker:127.0.0.1 --add-host wvass-server_worker_1:127.0.0.1 --add-host web:127.0.0.1 --add-host wvass-server_web_1:127.0.0.1 --add-host cron:127.0.0.1 --add-host wvass-server_cron_1:127.0.0.1 --expose 5432 wvass-server_postgresql
ExecStop=podman stop wvass-server_postgresql_1
ExecStopPost=podman rm wvass-server_postgresql_1
TimeoutSec=1800

[Install]
WantedBy=multi-user.target



Note that I see that someone else also encountered this same issue on RHEL 8.6 and reported it to the pi-hole forums: https://discourse.pi-hole.net/t/problem-after-update-rhel8-6-podman-to-version-4-1-1/56883

Comment 1 Brian Masney 2022-08-06 11:58:24 UTC
I fixed the issue by moving the --add-host argument from the 'pod run' command to the 'podman pod create --share net' command.

Comment 2 Matthew Heon 2022-08-08 13:23:23 UTC
This was a deliberate change in response to a bug opened upstream (breadcrumb: commit was https://github.com/containers/podman/commit/e4ab8a5bedb48615402231a5aa3a62ca4364c45f); I'm trying to locate the specific bug that this was in response to, but so far without success. The general idea is that the previous behavior did not work as expected (adding hosts to pre-existing containers that you joined the network namespace of had a number of bugs with it), so we have changed things to require hosts to be pre-specified in the pod's config when it is created.

Comment 3 Brian Masney 2022-08-08 14:07:19 UTC
This can be closed as far as I am concerned since the various search engines will add this error message and BZ to their indexes.

Comment 4 Tom Sweeney 2022-08-08 20:48:02 UTC
Closing per prior comments