Docker-transmission-openvpn: Long-running container suddenly starts boot loop (PIA on Synology)

Created on 27 Nov 2020  路  14Comments  路  Source: haugene/docker-transmission-openvpn

The problem
Was running fine until recently, using :dev image. Now docker run starts for about a minute (doing initialization I presume) then restarts. Tried updating (using docker rm and :latest) to no avail.

Docker run command
I use the following script to start or restart:

# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
    if ( [ ! -d /dev/net ] ); then
        mkdir -m 755 /dev/net
    fi
    mknod /dev/net/tun c 10 200
    chmod 0755 /dev/net/tun
fi

# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
    insmod /lib/modules/tun.ko
fi
if [ "`docker inspect -f '{{ .State.Running }}' TransmissionVPN;echo $?`" != "true
0" ]
then {
docker rm TransmissionVPN
docker run --privileged -d \
  --cap-add=NET_ADMIN \
  --device=/dev/net/tun \
  -v /volume1/Plex/resolv.conf:/etc/resolv.conf \
  -v /volume1/Plex/Library/Downloads/:/data \
  -v /volume1/Plex/setTransmissionRemotePort.sh:/root/setTransmissionRemotePort.sh \
  -v /volume1/Plex/pia-port.service:/etc/systemd/system/pia-port.service \
  -e "TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=false" \
  -e "TRANSMISSION_RATIO_LIMIT=0" \
  -e "TRANSMISSION_RATION_LIMIT_ENABLED=true" \
  -e "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=false" \
  -e "TRANSMISSION_UMASK=0" \
  -e "TRANSMISSION_DOWNLOAD_DIR=/data" \
  -e "TRANSMISSION_PEER_CONGESTION_ALGORITHM=\"\"" \
  -e "OPENVPN_PROVIDER=PIA" \
  -e "OPENVPN_CONFIG=Israel" \
  -e "OPENVPN_USERNAME=*******" \
  -e "OPENVPN_PASSWORD=********" \
  -e "OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60" \
  --restart=always \
  -p 9091:9091 \
  -p 8080:8080 \
  --name=TransmissionVPN \
  -e "TRANSMISSION_WEB_UI=combustion" \
  -e "TRANSMISSION_MESSAGE_LEVEL=3" \
  -e "CREATE_TUN_DEVICE=false" \
  haugene/transmission-openvpn:latest

Logs
In the transmission log I only find this:

Unable to create session lock file (22): Invalid argument (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/session-id.c:96)

Host system:
uname -a:

Linux RenRamStor 3.10.105 #25426 SMP Wed Jul 8 03:19:33 CST 2020 x86_64 GNU/Linux synology_avoton_1817+

docker --version:

Docker version 18.09.8, build bfed4f5

Most helpful comment

That's PIA related, they changed few things 2 days ago, quick fix:

-e "PIA_OPENVPN_CONFIG_BUNDLE=openvpn" \
-e "OPENVPN_CONFIG=israel" \

All 14 comments

That's PIA related, they changed few things 2 days ago, quick fix:

-e "PIA_OPENVPN_CONFIG_BUNDLE=openvpn" \
-e "OPENVPN_CONFIG=israel" \

Thanks @susman, unfortunately that did not change the behavior or error message.

Hmm. I don't see docker pull haugene/transmission-openvpn anywhere in your script so I'm curious to see if you're running the newest version. Docker does not automatically get the newest image even if you specify "latest".

Second question. If you just create a temporary folder, say: "/volume1/Plex/Library/Downloads2/" and mount that instead. Does it work then? In that case there is some corrupt state in transmission-home that also lives under /data.
This should not affect your current setup, you can just mount the old volume later and resume from where you left off.

Also. There are some unnecessary options provided (not wrong, just not needed:
TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED | false is the default value
TRANSMISSION_RPC_AUTHENTICATION_REQUIRED | false is the default value
--privileged and --cap-add=NET_ADMIN | privileged includes NET_ADMIN and a lot of other capabilities

True there is no docker pull- there is however a docker rm just before the docker run... Still, a pull would be more efficient.

When I mount Downloads2 directory as /data, the same container restart behavior occurs- but there is no transmission-home directory created and thus no log to examine...?!

And yes, there is cruft in the script - it has gone through quite a few generations! :-)

Many thanks for your attention @haugene! (again!)

True there is no docker pull- there is however a docker rm just before the docker run... Still, a pull would be more efficient.

docker rm removes the container, not the image (use docker rmi for that) - so a pull is still required to get the latest version

D'OH! Thanks @tommitytom. I've now added the pull after the rm...

...AND... it's back to working again:

# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
    if ( [ ! -d /dev/net ] ); then
        mkdir -m 755 /dev/net
    fi
    mknod /dev/net/tun c 10 200
    chmod 0755 /dev/net/tun
fi

# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
    insmod /lib/modules/tun.ko
fi
if [ "`docker inspect -f '{{ .State.Running }}' TransmissionVPN;echo $?`" != "true
0" ]
then {
#docker kill TransmissionVPN
docker rm TransmissionVPN
docker pull haugene/transmission-openvpn:latest
docker run --privileged -d \
  --cap-add=NET_ADMIN \
  --device=/dev/net/tun \
  -v /volume1/Plex/Library/Movies/:/Movies \
  -v /volume1/Plex/resolv.conf:/etc/resolv.conf \
  -v /volume1/Plex/Library/Downloads/:/data \
  -v /volume1/Plex/setTransmissionRemotePort.sh:/root/setTransmissionRemotePort.sh \
  -v /volume1/Plex/pia-port.service:/etc/systemd/system/pia-port.service \
  -e "TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=false" \
  -e "TRANSMISSION_RATIO_LIMIT=0" \
  -e "TRANSMISSION_RATION_LIMIT_ENABLED=true" \
  -e "TRANSMISSION_SCRIPT_TORRENT_DONE_ENABLED=false" \
  -e "TRANSMISSION_UMASK=0" \
  -e "TRANSMISSION_DOWNLOAD_DIR=/data" \
  -e "TRANSMISSION_PEER_CONGESTION_ALGORITHM=\"\"" \
  -e "OPENVPN_PROVIDER=PIA" \
  -e "OPENVPN_CONFIG=Israel" \
  -e "OPENVPN_USERNAME=******" \
  -e "OPENVPN_PASSWORD=*******" \
  -e "OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60" \
  --restart=always \
  -p 9091:9091 \
  -p 8080:8080 \
  --name=TransmissionVPN \
  -e "TRANSMISSION_WEB_UI=combustion" \
  -e "TRANSMISSION_MESSAGE_LEVEL=3" \
  -e "CREATE_TUN_DEVICE=false" \
  -e "PIA_OPENVPN_CONFIG_BUNDLE=openvpn" \
  -e "OPENVPN_CONFIG=israel" \
  haugene/transmission-openvpn:latest
}
fi

Many thanks to all who responded!

Hello i tryed this script , works fine, except this error :

docker: Error response from daemon: Bind mount failed: '/volume1/docker/transmission-openvpn/setTransmissionRemotePort.sh' does not exists.

I removed this two lines :
-v /volume1/Plex/setTransmissionRemotePort.sh:/root/setTransmissionRemotePort.sh \
-v /volume1/Plex/pia-port.service:/etc/systemd/system/pia-port.service \

What are they for ?
How to make them work ?

Best regards

My setup with PIA (on a QNAP NAS) also stopped working this past week, with an endless restart loop of the container. I have the following setup; I tried changing PIA_OPENVPN_CONFIG_BUNDLE to openvpn and even OPENVPN_CONFIG to israel, but it made no difference. Before I start testing all possible permutations of environment variables from @Hedrik 's setup, does anyone have any suggestions? This configuration was working fine until this week.

docker run --cap-add=NET_ADMIN -d \
-v /share/Download/transmission:/data \
-v /etc/localtime:/etc/localtime:ro \
-e CREATE_TUN_DEVICE=true \
-e TZ="Europe/Paris" \
-e OPENVPN_PROVIDER=PIA \
-e OPENVPN_CONFIG_BUNDLE=openvpn-tcp-nextgen \
-e OPENVPN_CONFIG=FIsrael \
-e OPENVPN_USERNAME=* \
-e OPENVPN_PASSWORD=
** \
-e TRANSMISSION_BLOCKLIST_ENABLED=true \
-e TRANSMISSION_BLOCKLIST_URL="https://github.com/sahsu/transmission-blocklist/releases/download/1.0.0/blocklist.gz" \
-e WEBPROXY_ENABLED=false \
-e LOCAL_NETWORK=192.168.1.0/24 \
--log-driver json-file \
--log-opt max-size=10m \
--name="OVPN_Transmission_PIA" \
--restart unless-stopped \
-p 9091:9091 \
haugene/transmission-openvpn

@beneix, I think the key was to include docker pull haugene/transmission-openvpn prior to the docker run command - possibly in addition to adding the OPENVPN_CONFIG_BUNDLE environment variable...

Hello i tryed this script , works fine, except this error :

docker: Error response from daemon: Bind mount failed: '/volume1/docker/transmission-openvpn/setTransmissionRemotePort.sh' does not exists.

I removed this two lines :
-v /volume1/Plex/setTransmissionRemotePort.sh:/root/setTransmissionRemotePort.sh
-v /volume1/Plex/pia-port.service:/etc/systemd/system/pia-port.service \

What are they for ?
How to make them work ?

Best regards

These are specific to PIA provider - since IA periodically changes the remote port, you need to tell transmission what that port is.

I have PIA, but those two lines don鈥檛 work, how to make them work please ?

I'm glad you got it working @Hedrik :+1: Closing this now.

@beneix You should create a new issue and include your logs if this doesn't work. But I can at least see that OPENVPN_CONFIG_BUNDLE` is invalid. That bundle does not exist. PIA has renamed their bundles a couple of times, but the image is now up to date. Pull the latest image and remove that env var and hopefully that should work.

It turns out PIA changed their config files so that their names no longer start with a capital letter. Duh!

Was this page helpful?
0 / 5 - 0 ratings