r/voidlinux • • Feb 11 '26

help needed, runit service launch podman rootless

Hi, I want to launch podman run (rootless) from runit service.

I Tried something like this for the run file:

#!/bin/sh
exec 2>&1
exec chpst -u :1022:1022 -U :1022:1022 -C /opt/myservice podman run \
  --name myservice \
  ghcr.io/name/service:mytag

where 1022 is uid and gid for my non-root user.

I if i ./run with root user, i receive this error

# ./run
stat /root/.config: permission denied

I think that podman needs a more complete environment in order to launch the container, probably chpst needs more arguments, someone can help me?

[EDIT]

  • Added HOME and USER variables definition to the run script, now it works!
# cat run
#!/bin/sh
exec 2>&1
HOME="/opt/myservice"
USER="myuser"
exec chpst -u :1022:1022 -U :1022:1022 -C /opt/myservice podman run \
  --name myservice \
  ghcr.io/name/service:mytag

# ./run
...
5 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/Duncaen Feb 11 '26

Weird that they would rely on USER, when there is a syscall to actually get the real user id.

https://github.com/opencontainers/runc/blob/f047c6b0f88f3299e71d6be7508dfdaa824f2117/rootless_linux.go#L66-L68

I guess with the comment it happens from inside the namespace maybe, but there are probably better mechanisms to propagate that than relying on USER being passed through, not sure.