Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podman not working with cron #7242

Closed
dzerhusen opened this issue Aug 6, 2020 · 8 comments
Closed

Podman not working with cron #7242

dzerhusen opened this issue Aug 6, 2020 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@dzerhusen
Copy link

dzerhusen commented Aug 6, 2020

/kind bug

Description
Podman not working with cron

Steps to reproduce the issue:

1.Edit as cadmin User crontab -e
50 * * * * /opt/scripts/backup/postgresql_backup.sh >> /opt/logs/backup/postgresql_backup.log 2>&1

  1. vi /opt/scripts/backup/postgresql_backup.sh:

#!/bin/bash
whoami
/bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l

  1. wait and look into the log

Describe the results you received:
podman command is working fine on a normal terminal. I got the result of the psql-command. See below.

I also tried setting the same env vars from my local terminal into the bash script. Problem still exists.
I tried setting the path env var in the script.

Describe the results you expected:
Podman cronjob is succeeding

Versions
[cadmin@serverchanged~]$ cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

[cadmin@serverchanged ~]$ podman version
Version: 2.0.4
API Version: 1
Go Version: go1.13.4
Built: Thu Jan 1 01:00:00 1970
OS/Arch: linux/amd64

CONTAINER ID  IMAGE                                                                  COMMAND          CREATED       STATUS           PORTS                   NAMES
c08dc8d38d4c  docker-registry.shortened.de/company/postgresql:12                      postgres         24 hours ago  Up 24 hours ago  0.0.0.0:5432->5432/tcp  postgresql

**Cronjob Results:**
[cadmin@serverchanged ~]$ cat /opt/logs/backup/postgresql_backup.log

cadmin
time="2020-08-06T09:50:01+02:00" level=info msg="/bin/podman filtering at log level debug"
time="2020-08-06T09:50:01+02:00" level=debug msg="Called exec.PersistentPreRunE(/bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l)"
time="2020-08-06T09:50:01+02:00" level=debug msg="Ignoring libpod.conf EventsLogger setting \"/home/cadmin/.config/containers/containers.conf\". Use \"journald\" if you want to change this setting and remove libpod.conf files."
time="2020-08-06T09:50:01+02:00" level=debug msg="Using conmon: \"/usr/bin/conmon\""
time="2020-08-06T09:50:01+02:00" level=debug msg="Initializing boltdb state at /home/cadmin/.local/share/containers/storage/libpod/bolt_state.db"
time="2020-08-06T09:50:01+02:00" level=debug msg="Overriding tmp dir \"/run/user/1002/libpod/tmp\" with \"/tmp/run-1002/libpod/tmp\" from database"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using graph driver overlay"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using graph root /home/cadmin/.local/share/containers/storage"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using run root /tmp/run-1002"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using static dir /home/cadmin/.local/share/containers/storage/libpod"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using tmp dir /tmp/run-1002/libpod/tmp"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using volume path /home/cadmin/.local/share/containers/storage/volumes"
time="2020-08-06T09:50:01+02:00" level=debug msg="Set libpod namespace to \"\""
time="2020-08-06T09:50:01+02:00" level=debug msg="Not configuring container store"
time="2020-08-06T09:50:01+02:00" level=debug msg="Initializing event backend file"
time="2020-08-06T09:50:01+02:00" level=debug msg="using runtime \"/usr/bin/runc\""
time="2020-08-06T09:50:01+02:00" level=warning msg="Error initializing configured OCI runtime crun: no valid executable found for OCI runtime crun: invalid argument"
time="2020-08-06T09:50:01+02:00" level=warning msg="Error initializing configured OCI runtime kata: no valid executable found for OCI runtime kata: invalid argument"
time="2020-08-06T09:50:01+02:00" level=info msg="Setting parallel job count to 13"
time="2020-08-06T09:50:01+02:00" level=info msg="/bin/podman filtering at log level debug"
time="2020-08-06T09:50:01+02:00" level=debug msg="Called exec.PersistentPreRunE(/bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l)"
time="2020-08-06T09:50:01+02:00" level=debug msg="Ignoring libpod.conf EventsLogger setting \"/home/cadmin/.config/containers/containers.conf\". Use \"journald\" if you want to change this setting and remove libpod.conf files."
time="2020-08-06T09:50:01+02:00" level=debug msg="Using conmon: \"/usr/bin/conmon\""
time="2020-08-06T09:50:01+02:00" level=debug msg="Initializing boltdb state at /home/cadmin/.local/share/containers/storage/libpod/bolt_state.db"
time="2020-08-06T09:50:01+02:00" level=debug msg="Overriding tmp dir \"/run/user/1002/libpod/tmp\" with \"/tmp/run-1002/libpod/tmp\" from database"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using graph driver overlay"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using graph root /home/cadmin/.local/share/containers/storage"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using run root /tmp/run-1002"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using static dir /home/cadmin/.local/share/containers/storage/libpod"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using tmp dir /tmp/run-1002/libpod/tmp"
time="2020-08-06T09:50:01+02:00" level=debug msg="Using volume path /home/cadmin/.local/share/containers/storage/volumes"
time="2020-08-06T09:50:01+02:00" level=debug msg="Set libpod namespace to \"\""
time="2020-08-06T09:50:01+02:00" level=debug msg="[graphdriver] trying provided driver \"overlay\""
time="2020-08-06T09:50:01+02:00" level=debug msg="overlay: mount_program=/bin/fuse-overlayfs"
time="2020-08-06T09:50:01+02:00" level=debug msg="overlay: mount_program=/bin/fuse-overlayfs"
time="2020-08-06T09:50:01+02:00" level=debug msg="backingFs=xfs, projectQuotaSupported=false, useNativeDiff=false, usingMetacopy=false"
time="2020-08-06T09:50:01+02:00" level=debug msg="Initializing event backend file"
time="2020-08-06T09:50:01+02:00" level=warning msg="Error initializing configured OCI runtime kata: no valid executable found for OCI runtime kata: invalid argument"
time="2020-08-06T09:50:01+02:00" level=debug msg="using runtime \"/usr/bin/runc\""
time="2020-08-06T09:50:01+02:00" level=warning msg="Error initializing configured OCI runtime crun: no valid executable found for OCI runtime crun: invalid argument"
time="2020-08-06T09:50:01+02:00" level=info msg="Setting parallel job count to 13"
time="2020-08-06T09:50:01+02:00" level=info msg="Created exec session 5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93 in container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2"
time="2020-08-06T09:50:01+02:00" level=info msg="Going to start container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93 and attach to it"
time="2020-08-06T09:50:01+02:00" level=debug msg="Sending resize events to exec session 5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93"
time="2020-08-06T09:50:01+02:00" level=debug msg="/usr/bin/conmon messages will be logged to syslog"
time="2020-08-06T09:50:01+02:00" level=debug msg="running conmon: /usr/bin/conmon" args="[--api-version 1 -c c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 -u 5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93 -r /usr/bin/runc -b /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93 -p /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93/exec_pid -n postgresql --exit-dir /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93/exit --socket-dir-path /tmp/run-1002/libpod/tmp/socket -l none --log-level debug --syslog -e --exec-attach --exec-process-spec /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93/exec-process-395599256]"
time="2020-08-06T09:50:01+02:00" level=warning msg="Failed to add conmon to cgroupfs sandbox cgroup: error creating cgroup for memory: mkdir /sys/fs/cgroup/memory/libpod_parent: permission denied"
time="2020-08-06T09:50:01+02:00" level=debug msg="Attaching to container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93"
time="2020-08-06T09:50:01+02:00" level=debug msg="connecting to socket /tmp/run-1002/libpod/tmp/socket/5db7fea1745b65b5bc67e0d324a18bda2c7c7d611f50be482eb038ea9b4b0e93/attach"
time="2020-08-06T09:50:01+02:00" level=debug msg="Received: 0"
time="2020-08-06T09:50:01+02:00" level=debug msg="Received: -1"
Error: [conmon:d]: exec with attach is waiting for start message from parent
[conmon:d]: exec with attach got start message from parent
time="2020-08-06T09:50:01+02:00" level=error msg="exec failed: container \"c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2\" does not exist"
exec failed: container "c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2" does not exist: OCI runtime error


**Execution on ssh terminal:**
[cadmin@serverchanged~]$ /bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l
INFO[0000] /bin/podman filtering at log level debug
DEBU[0000] Called exec.PersistentPreRunE(/bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l)
DEBU[0000] Ignoring libpod.conf EventsLogger setting "/home/cadmin/.config/containers/containers.conf". Use "journald" if you want to change this setting and remove libpod.conf files.
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /home/cadmin/.local/share/containers/storage/libpod/bolt_state.db
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /home/cadmin/.local/share/containers/storage
DEBU[0000] Using run root /tmp/run-1002
DEBU[0000] Using static dir /home/cadmin/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /tmp/run-1002/libpod/tmp
DEBU[0000] Using volume path /home/cadmin/.local/share/containers/storage/volumes
DEBU[0000] Set libpod namespace to ""
DEBU[0000] Not configuring container store
DEBU[0000] Initializing event backend file
DEBU[0000] using runtime "/usr/bin/runc"
WARN[0000] Error initializing configured OCI runtime crun: no valid executable found for OCI runtime crun: invalid argument
WARN[0000] Error initializing configured OCI runtime kata: no valid executable found for OCI runtime kata: invalid argument
INFO[0000] Setting parallel job count to 13
INFO[0000] /bin/podman filtering at log level debug
DEBU[0000] Called exec.PersistentPreRunE(/bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l)
DEBU[0000] Ignoring libpod.conf EventsLogger setting "/home/cadmin/.config/containers/containers.conf". Use "journald" if you want to change this setting and remove libpod.conf files.
DEBU[0000] Using conmon: "/usr/bin/conmon"
DEBU[0000] Initializing boltdb state at /home/cadmin/.local/share/containers/storage/libpod/bolt_state.db
DEBU[0000] Using graph driver overlay
DEBU[0000] Using graph root /home/cadmin/.local/share/containers/storage
DEBU[0000] Using run root /tmp/run-1002
DEBU[0000] Using static dir /home/cadmin/.local/share/containers/storage/libpod
DEBU[0000] Using tmp dir /tmp/run-1002/libpod/tmp
DEBU[0000] Using volume path /home/cadmin/.local/share/containers/storage/volumes
DEBU[0000] Set libpod namespace to ""
DEBU[0000] [graphdriver] trying provided driver "overlay"
DEBU[0000] overlay: mount_program=/bin/fuse-overlayfs
DEBU[0000] overlay: mount_program=/bin/fuse-overlayfs
DEBU[0000] backingFs=xfs, projectQuotaSupported=false, useNativeDiff=false, usingMetacopy=false
DEBU[0000] Initializing event backend file
DEBU[0000] using runtime "/usr/bin/runc"
WARN[0000] Error initializing configured OCI runtime crun: no valid executable found for OCI runtime crun: invalid argument
WARN[0000] Error initializing configured OCI runtime kata: no valid executable found for OCI runtime kata: invalid argument
INFO[0000] Setting parallel job count to 13
INFO[0000] Created exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0 in container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2
INFO[0000] Going to start container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0 and attach to it
DEBU[0000] Sending resize events to exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0
DEBU[0000] /usr/bin/conmon messages will be logged to syslog
DEBU[0000] running conmon: /usr/bin/conmon               args="[--api-version 1 -c c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 -u 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0 -r /usr/bin/runc -b /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0 -p /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0/exec_pid -n postgresql --exit-dir /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0/exit --socket-dir-path /tmp/run-1002/libpod/tmp/socket -l none --log-level debug --syslog -e --exec-attach --exec-process-spec /home/cadmin/.local/share/containers/storage/overlay-containers/c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2/userdata/3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0/exec-process-989882471]"
WARN[0000] Failed to add conmon to cgroupfs sandbox cgroup: error creating cgroup for blkio: mkdir /sys/fs/cgroup/blkio/libpod_parent: permission denied
DEBU[0000] Attaching to container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0
DEBU[0000] connecting to socket /tmp/run-1002/libpod/tmp/socket/3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0/attach
DEBU[0000] Received: 0
DEBU[0000] Received: 87916
DEBU[0000] Successfully started exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0 in container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2
[conmon:d]: exec with attach is waiting for start message from parent
[conmon:d]: exec with attach got start message from parent
                                           List of databases
       Name       |  Owner   | Encoding |  Collate   |   Ctype    |         Access privileges
------------------+----------+----------+------------+------------+------------------------------------
<shortened output >
(6 rows)

DEBU[0000] Container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0 completed with exit code 0
INFO[0000] Removing container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0
DEBU[0000] Successfully removed container c08dc8d38d4cdae20d762b3f142ea81d10f54b2ca04308e930f5bbd66ca712b2 exec session 3e506c058f1261526a50cfd20f13051143ffac2c363e72951b1147f45b5cedf0
DEBU[0000] Called exec.PersistentPostRunE(/bin/podman exec --log-level=debug postgresql /usr/bin/psql -U postgres -l)


@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 6, 2020
@mheon
Copy link
Member

mheon commented Aug 6, 2020 via email

@dzerhusen
Copy link
Author

Hello,
thanks for your help. It worked after a reboot. I saw now that this is only mentioned in a short part in the docs at systemd. Maybe it should be clarified in the podman manual somewhere.

@TomSweeneyRedHat
Copy link
Member

This sounds like a good addition to the known issue @mheon

@mheon
Copy link
Member

mheon commented Aug 6, 2020

I do believe it's already there.

We do have a discoverability problem around the known issues page - I have never once seen it among our most visited pages.

@TomSweeneyRedHat
Copy link
Member

Yeah, helping the discoverability for that page is on my back burner list of todo's, I really need to pop that up a stack or two in the queue.

@rhatdan
Copy link
Member

rhatdan commented Aug 7, 2020

Should we add a link to podman.io? Should we put a link into the podman man page?

@mheon
Copy link
Member

mheon commented Aug 7, 2020

podman.io sounds like a good place

@dzerhusen
Copy link
Author

The problem is fixed for me. So im closing the issue for now.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants