-
Ohai, My setup works when I start the container with podman as root. Now with quadlet it seems that it needs more rights then it gets. This is my quadlet container under [Unit]
Description=transmission container
Wants=network.target
After=network-online.target
RequiresMountsFor=/data
[Container]
Image=docker.io/haugene/transmission-openvpn:latest
Volume=/data:/data
PublishPort=9091:9091
User=900
Group=900
Environment=PUID=900
Environment=PGID=900
Environment=TZ=Europe/Berlin
Environment=OPENVPN_PROVIDER=MULLVAD
Environment=OPENVPN_CONFIG=somecountry_all
Environment=OPENVPN_USERNAME=my-mullvad-id
Environment=OPENVPN_PASSWORD=m
Environment=HEALTH_CHECK_HOST=am.i.mullvad.net
Environment=LOG_TO_STDOUT=True
Environment=LOCAL_NETWORK=192.168.178.0/24
Environment=TRANSMISSION_ENCRYPTION=2
Environment=TRANSMISSION_PEER_PORT=12345
Environment=TRANSMISSION_IDLE_SEEDING_LIMIT=30
Environment=TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED=True
Environment=TRANSMISSION_RATIO_LIMIT=2
Environment=TRANSMISSION_RATIO_LIMIT_ENABLED=True
# don't try to create tun and avoid these errors:
# mknod: /dev/net/tun: Permission denied
# chmod: cannot access '/dev/net/tun': Permission denied
Environment=CREATE_TUN_DEVICE=False
Timezone=Europe/Berlin
AddCapability=NET_ADMIN
PodmanArgs=--sysctl=net.ipv6.conf.all.disable_ipv6=0 --device=/dev/net/tun
[Service]
Restart=always This creates a systemd unit with the following podman call: podman run \
--name=systemd-%N \
--cidfile=%t/%N.cid \
--replace \
--rm \
-d \
--log-driver journald \
--pull=never \
--runtime /usr/bin/crun \
--cgroups=split \
--tz=Europe/Berlin \
--init \
--sdnotify=conmon \
--security-opt=no-new-privileges \
--cap-drop=all \
--cap-add=net_admin \
--mount type=tmpfs,tmpfs-size=512M,destination=/tmp \
--user 900:900 \
--uidmap 900:900:1 \
--uidmap 0:0:1 \
--uidmap 1:1879048192:899 \
--uidmap 901:1879049091:64637 \
--gidmap 900:900:1 \
--gidmap 0:0:1 \
--gidmap 1:1879048192:899 \
--gidmap 901:1879049091:64637 \
-v /data:/data \
-p=9091:9091 \
--env CREATE_TUN_DEVICE=False \
--env HEALTH_CHECK_HOST=am.i.mullvad.net \
--env LOCAL_NETWORK=192.168.178.0/24 \
--env LOG_TO_STDOUT=True \
--env OPENVPN_CONFIG=somecountry_all \
--env OPENVPN_PASSWORD=m \
--env OPENVPN_PROVIDER=MULLVAD \
--env OPENVPN_USERNAME=my-mullvad-id \
--env PGID=900 \
--env PUID=900 \
--env TRANSMISSION_ENCRYPTION=2 \
--env TRANSMISSION_IDLE_SEEDING_LIMIT=30 \
--env TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED=True \
--env TRANSMISSION_PEER_PORT=12345 \
--env TRANSMISSION_RATIO_LIMIT=2 \
--env TRANSMISSION_RATIO_LIMIT_ENABLED=True \
--env TZ=Europe/Berlin \
--sysctl=net.ipv6.conf.all.disable_ipv6=0 \
--device=/dev/net/tun \
docker.io/haugene/transmission-openvpn:latest I already fixed these errors by supplying
Now the container tries to create the
I haven't looked into the Dockerfile and entrypoint scripts yet what is actually going on here. I guess the script assumes to be root at this point and therefore having the rights to create that folder. But I start my container as uid 900:900. Does it actually need to start as root and I have to trust that it reduces it's rights to uid 900 by itself? Would be nice to run this container rootless. If I run the container as root, removing the podman run \
--name=systemd-%N \
--cidfile=%t/%N.cid \
--replace \
--rm \
-d \
--log-driver journald \
--pull=never \
--runtime /usr/bin/crun \
--cgroups=split \
--tz=Europe/Berlin \
--init \
--sdnotify=conmon \
--security-opt=no-new-privileges \
--cap-drop=all \
--cap-add=net_admin \
--mount type=tmpfs,tmpfs-size=512M,destination=/tmp \
--uidmap 0:0:1 \
--uidmap 1:1879048192:65536 \
--gidmap 0:0:1 \
--gidmap 1:1879048192:65536 \
-v /data:/data \
-p=9091:9091 \
--env CREATE_TUN_DEVICE=False \
--env HEALTH_CHECK_HOST=am.i.mullvad.net \
--env LOCAL_NETWORK=192.168.178.0/24 \
--env LOG_TO_STDOUT=True \
--env OPENVPN_CONFIG=somecountry_all \
--env OPENVPN_PASSWORD=m \
--env OPENVPN_PROVIDER=MULLVAD \
--env OPENVPN_USERNAME=my-mullvad-id \
--env PGID=900 \
--env PUID=900 \
--env TRANSMISSION_ENCRYPTION=2 \
--env TRANSMISSION_IDLE_SEEDING_LIMIT=30 \
--env TRANSMISSION_IDLE_SEEDING_LIMIT_ENABLED=True \
--env TRANSMISSION_PEER_PORT=12345 \
--env TRANSMISSION_RATIO_LIMIT=2 \
--env TRANSMISSION_RATIO_LIMIT_ENABLED=True \
--env TZ=Europe/Berlin \
--sysctl=net.ipv6.conf.all.disable_ipv6=0 \
--device=/dev/net/tun \
docker.io/haugene/transmission-openvpn:latest This seems to work and bring up the tunnel but fails to start transmission becvause of this:
The folder should have proper permissions:
I'm not sure what goes wrong here. Does anyone have a clue? I already checked the code around the error, but that looks fine. It only opens the file read only. Also at this point it should open the file as root so it should definitely have enough access rights. I tried changing the permissions on that file to
I'm not sure which user it is using at this point. It seems to be not root and not the one I provided. On a different note. When I stopped the container I get this:
Not sure why this wouldn't work from the PID=$(pidof transmission-daemon)
kill "$PID" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
First of all, sorry for bringing this discussion alive, but is the closest to the issue that I had. After some testing and search on google I was able to run the image on a "rootless" container (with some extra capabilities)
After applying this two changes, the container is running. All the info is from
|
Beta Was this translation helpful? Give feedback.
First of all, sorry for bringing this discussion alive, but is the closest to the issue that I had.
After some testing and search on google I was able to run the image on a "rootless" container (with some extra capabilities)
Biggest changes
NET_RAW
capabilitysudo sysctl -w "net.ipv4.ping_group_range=0 2147483647"
commandAfter applying this two changes, the container is running.
All the info is from