systemd not always producing the %t from systemd file #5572
Closed
Description
opened on Mar 20, 2020
/kind bug
Description
I followed the blog to use conmon-pidfile and cidfile from this blog. However, systemd doesn't fills %t for podman user containers.
ping @vrothberg
Steps to reproduce the issue:
- Ansible does this systemd file:
cat /etc/systemd/system/ha-container-pod.service
[Unit]
Description=ha Podman Container
After=network.target
[Service]
Type=simple
TimeoutStartSec=15
ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
User=redhatter
ExecStart=/usr/bin/podman run --name ha \
--rm -p 8123:8123/tcp -v "/var/lib/containers/storage/homeassistant-config:/config:Z" --hostname="ha.localnet" --memory=1024M \
--conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
homeassistant/home-assistant:stable
ExecStop=/usr/bin/sh -c "/usr/bin/podman stop -t "15" `cat /%t/%n-cid`"
ExecStop=/usr/bin/sh -c "/usr/bin/podman rm -f `cat /%t/%n-cid`"
Restart=on-failure
RestartSec=30
KillMode=none
PIDFile=/%t/%n-pid
[Install]
WantedBy=multi-user.target
2 add user sudo useradd redhatter
3. reload systemd sudo systemctl daemon-reload
4. start container: sudo systemctl start ha-container-pod.service
Describe the results you received:
sudo journalctl -eu ha-container-pod.service
Mar 20 17:12:57 gr8.localdomain systemd[1]: Started ha Podman Container.
Mar 20 17:12:57 gr8.localdomain podman[11501]: Error: error opening cidfile //run/ha-container-pod.service-cid
Mar 20 17:12:57 gr8.localdomain systemd[1]: ha-container-pod.service: Main process exited, code=exited, status=125/n/a
Mar 20 17:12:57 gr8.localdomain systemd[1]: ha-container-pod.service: Failed with result 'exit-code'.
Mar 20 17:13:27 gr8.localdomain systemd[1]: ha-container-pod.service: Service RestartSec=30s expired, scheduling restart.
Mar 20 17:13:27 gr8.localdomain systemd[1]: ha-container-pod.service: Scheduled restart job, restart counter is at 46.
Mar 20 17:13:27 gr8.localdomain systemd[1]: Stopped ha Podman Container.
Describe the results you expected:
start the container with proper path in cidfile
Additional information you deem important (e.g. issue happens only occasionally):
always
Output of podman version
:
Version: 1.6.4
RemoteAPI Version: 1
Go Version: go1.12.12
OS/Arch: linux/amd64
Output of podman info --debug
:
debug:
compiler: gc
git commit: ""
go version: go1.12.12
podman version: 1.6.4
host:
BuildahVersion: 1.12.0-dev
CgroupVersion: v1
Conmon:
package: conmon-2.0.6-1.module+el8.1.1+5259+bcdd613a.x86_64
path: /usr/bin/conmon
version: 'conmon version 2.0.6, commit: 6ffbb2ec70dbe5ba56e4bfde946fb04f19dd8bbf'
Distribution:
distribution: '"rhel"'
version: "8.1"
MemFree: 526786560
MemTotal: 16276774912
OCIRuntime:
name: runc
package: runc-1.0.0-64.rc9.module+el8.1.1+5259+bcdd613a.x86_64
path: /usr/bin/runc
version: 'runc version spec: 1.0.1-dev'
SwapFree: 8167911424
SwapTotal: 8292134912
arch: amd64
cpus: 8
eventlogger: journald
hostname: gr8.localdomain
kernel: 4.18.0-147.5.1.el8_1.x86_64
os: linux
rootless: false
uptime: 76h 28m 48.87s (Approximately 3.17 days)
registries:
blocked: null
insecure: null
search:
- registry.access.redhat.com
- registry.redhat.io
- quay.io
- docker.io
store:
ConfigFile: /etc/containers/storage.conf
ContainerStore:
number: 3
GraphDriverName: overlay
GraphOptions: {}
GraphRoot: /var/lib/containers/storage
GraphStatus:
Backing Filesystem: xfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
ImageStore:
number: 18
RunRoot: /var/run/containers/storage
VolumePath: /var/lib/containers/storage/volumes
Package info (e.g. output of rpm -q podman
or apt list podman
):
podman-1.6.4-2.module+el8.1.1+5363+bf8ff1af.x86_64
Additional environment details (AWS, VirtualBox, physical, etc.):
rhel8.1 laptop
Activity