Trouble with mounting /sys/fs/cgroup from host to podman container
Hi, While trying to use podman for a current task where I am testing an Ansible role being developed with the Molecule testing framework (https://molecule.readthedocs.io), I am running into some trouble with the /sys/fs/cgroup mounting. All the containers I'm trying to run with this volume being mounted into the container (to allow systemd to run inside podman) gives me errors like these: $ podman run -d --name centos7 --privileged=True --volume /sys/fs/cgroup:/sys/fs/cgroup:rw --tty=True molecule_local/centos:7 /sbin/init Error: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/sys/fs/cgroup\\\" to rootfs \\\"/home/per/.local/share/containers/storage/vfs/dir/41434e3e7d6979474c6a4829745acba3d124189037c7fef34455594823a91a2c\\\" at \\\"/home/per/.local/share/containers/storage/vfs/dir/41434e3e7d6979474c6a4829745acba3d124189037c7fef34455594823a91a2c/sys/fs/cgroup\\\" caused \\\"operation not permitted\\\"\"": OCI runtime permission denied error $ podman run -d --name ubuntu16.04 --privileged=True --volume /sys/fs/cgroup:/sys/fs/cgroup:rw --tty=True molecule_local/ubuntu:16.04 /sbin/init Error: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/sys/fs/cgroup\\\" to rootfs \\\"/home/per/.local/share/containers/storage/vfs/dir/ff8d8b2f47aacc6a30522091aad2cad6e81d9f0cc011d7e1fb1f09b62bc7210b\\\" at \\\"/home/per/.local/share/containers/storage/vfs/dir/ff8d8b2f47aacc6a30522091aad2cad6e81d9f0cc011d7e1fb1f09b62bc7210b/sys/fs/cgroup\\\" caused \\\"operation not permitted\\\"\"": OCI runtime permission denied error $ podman run --log-opt debug -d --name ubuntu18.04 --privileged=True --volume /sys/fs/cgroup:/sys/fs/cgroup:rw --tty=True molecule_local/ubuntu:18.04 /sbin/init Error: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/sys/fs/cgroup\\\" to rootfs \\\"/home/per/.local/share/containers/storage/vfs/dir/0740c9c17a0fe13542746fbd248e0c3cb35aaf7c965e56cac5875840b2aab235\\\" at \\\"/home/per/.local/share/containers/storage/vfs/dir/0740c9c17a0fe13542746fbd248e0c3cb35aaf7c965e56cac5875840b2aab235/sys/fs/cgroup\\\" caused \\\"operation not permitted\\\"\"": OCI runtime permission denied error Running "podman run -it molecule_local/centos:7" works fine. Any ideas? I guess I could run podman with sudo (and this might be required for this particular use case), but if possible, I'd prefer avoiding it. This is btw on Debian buster/bullseye, with the 1.6.1-1~ubuntu19.04~ppa3 package installed. Since there was no native Debian package installed, I added the Ubuntu PPA and was hoping (*cough*) that it would work reasonably well... Kernel is 4.19.0-6-amd64. Best regards, -- Per Lundberg
Answering to myself: it turned out that this is not something that you can do as a non-root user. The solution is to leave out the /sys/fs/cgroup volume altogether. The Molecule documentation (which I based my example on) has been updated to take this into account: https://github.com/ansible/molecule/pull/2358 Bottom line: not a Podman problem per se. Best regards, Per
On 10/16/19 1:47 AM, Per Lundberg wrote:
Answering to myself: it turned out that this is not something that you can do as a non-root user. The solution is to leave out the /sys/fs/cgroup volume altogether.
The Molecule documentation (which I based my example on) has been updated to take this into account: https://github.com/ansible/molecule/pull/2358
Bottom line: not a Podman problem per se.
Best regards, Per _______________________________________________ Podman mailing list -- podman@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Excellent. Thanks for trying this out and documenting the issue.
participants (2)
-
Daniel Walsh -
Per Lundberg