Docker-transmission-openvpn: transmission.log Permission denied

Created on 29 Nov 2017  路  14Comments  路  Source: haugene/docker-transmission-openvpn

If PUID and PGID are set in the env (aka not running as root), then there is a permissions error on transmission.log

Unsetting PUID and PGID allows it to work fine

NOTE: These logs are in reverse order for some reason (Newest at the top)

date | stream | content
-- | -- | --
2017-11-29聽04:45:53 | stderr | [2017-11-29聽04:45:53.444]聽transmission-remote:聽聽(http://localhost:9091/transmission/rpc/)聽Couldn't聽connect聽to聽server
2017-11-29聽04:45:43 | stdout | Checking聽port...
2017-11-29聽04:45:43 | stderr | [2017-11-29聽04:45:43.422]聽transmission-remote:聽聽(http://localhost:9091/transmission/rpc/)聽Couldn't聽connect聽to聽server
2017-11-29聽04:45:43 | stderr | [2017-11-29聽04:45:43.401]聽transmission-remote:聽聽(http://localhost:9091/transmission/rpc/)聽Couldn't聽connect聽to聽server
2017-11-29聽04:45:43 | stdout | transmission聽auth聽not聽required
2017-11-29聽04:45:43 | stdout | Got聽new聽port聽27406聽from聽PIA
2017-11-29聽04:45:42 | stderr | Couldn't聽(re)open聽log聽file聽"/data/transmission-home/transmission.log":聽Permission聽denied
2017-11-29聽04:45:42 | stdout | Wed聽Nov聽29聽04:45:42聽2017聽Initialization聽Sequence聽Completed
2017-11-29聽04:45:42 | stdout | Generating聽new聽client聽id聽for聽PIA
2017-11-29聽04:45:42 | stdout | Transmission聽startup聽script聽complete.
2017-11-29聽04:45:42 | stdout | CONFIGURING聽PORT聽FORWARDING
2017-11-29聽04:45:42 | stdout | STARTING聽TRANSMISSION
2017-11-29聽04:45:42 | stdout | 聽
2017-11-29聽04:45:42 | stdout | -------------------------------------
2017-11-29聽04:45:42 | stdout | User聽gid:聽聽聽聽100
2017-11-29聽04:45:42 | stdout | User聽uid:聽聽聽聽1234
2017-11-29聽04:45:42 | stdout | User聽name:聽聽聽abc
2017-11-29聽04:45:42 | stdout | -------------------------------------
2017-11-29聽04:45:42 | stdout | Transmission聽will聽run聽as
2017-11-29聽04:45:42 | stdout | -------------------------------------
2017-11-29聽04:45:42 | stdout | 聽
2017-11-29聽04:45:42 | stdout | Setting聽owner聽for聽transmission聽paths聽to聽1234:100
2017-11-29聽04:45:42 | stdout | Generating聽transmission聽settings.json聽from聽env聽variables
2017-11-29聽04:45:42 | stdout | Updating聽TRANSMISSION_BIND_ADDRESS_IPV4聽to聽the聽ip聽of聽tun0聽:聽10.25.10.6
2017-11-29聽04:45:42 | stdout | Wed聽Nov聽29聽04:45:42聽2017聽/etc/transmission/start.sh聽tun0聽1500聽1558聽10.25.10.6聽10.25.10.5聽init
2017-11-29聽04:45:42 | stdout | Wed聽Nov聽29聽04:45:42聽2017聽/sbin/ip聽addr聽add聽dev聽tun0聽local聽10.25.10.6聽peer聽10.25.10.5
2017-11-29聽04:45:42 | stdout | Wed聽Nov聽29聽04:45:42聽2017聽/sbin/ip聽link聽set聽dev聽tun0聽up聽mtu聽1500
2017-11-29聽04:45:42 | stdout | Wed聽Nov聽29聽04:45:42聽2017聽do_ifconfig,聽tt->did_ifconfig_ipv6_setup=0
2017-11-29聽04:45:42 | stdout | Wed聽Nov聽29聽04:45:42聽2017聽TUN/TAP聽device聽tun0聽opened
2017-11-29聽04:45:41 | stdout | Wed聽Nov聽29聽04:45:41聽2017聽[7d1d5b6aeacc60eec581fc41cc82537a]聽Peer聽Connection聽Initiated聽with聽[AF_INET]172.98.67.32:1198
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽WARNING:聽this聽configuration聽may聽cache聽passwords聽in聽memory聽--聽use聽the聽auth-nocache聽option聽to聽prevent聽this
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽UDP聽link聽remote:聽[AF_INET]172.98.67.32:1198
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽UDP聽link聽local:聽(not聽bound)
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽TCP/UDP:聽Preserving聽recently聽used聽remote聽address:聽[AF_INET]172.98.67.32:1198
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽NOTE:聽the聽current聽--script-security聽setting聽may聽allow聽this聽configuration聽to聽call聽user-defined聽scripts
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽library聽versions:聽OpenSSL聽1.0.2g聽聽1聽Mar聽2016,聽LZO聽2.08
2017-11-29聽04:45:40 | stdout | Wed聽Nov聽29聽04:45:40聽2017聽OpenVPN聽2.4.4聽x86_64-pc-linux-gnu聽[SSL聽(OpenSSL)]聽[LZO]聽[LZ4]聽[EPOLL]聽[PKCS11]聽[MH/PKTINFO]聽[AEAD]聽built聽on聽Sep聽26聽2017
2017-11-29聽04:45:40 | stdout | adding聽route聽to聽local聽network聽192.168.1.0/24聽via聽172.17.0.1聽dev聽eth0
2017-11-29聽04:45:40 | stdout | Setting聽OPENVPN聽credentials...
2017-11-29聽04:45:40 | stdout | Starting聽OpenVPN聽using聽config聽CA聽Toronto.ovpn
2017-11-29聽04:45:40 | stdout | Using聽OpenVPN聽provider:聽PIA

Most helpful comment

I would suggest that you check the permissions of the parent folders.

If for example you have this directory tree:
/mnt/transmission/transmission-home

then both /mnt and /mnt/transmission should have at least execute rights for others (chmod o+x) in case they belong to other users/groups or not.

All 14 comments

If you've ever run the container as root (without the PUID/PGID variables) then the log will have been created as root. Have you deleted the directory in the meantime, or chown'ed it?

@haugene yes, I tried deleting the directory completely and letting the container rebuild it. The result is the transmission-home directory being created and settings.json being created inside it just fine, both correctly owned by the PUID/PGID specified, but this error still occurs and no transmission.log file is created.

Hmm. And if you create the log file manually, chown it, and then start the container? Shouldn't be necessary of course, just checking.

@haugene Sorry, just seeing this. I don't know how to get a shell in my docker container as this other non-root user if that is what you are asking me to do, but I did try creating the file as root and then changing ownership with chown <user>:<group> transmission.log. Didn't seem to make a difference.

When you create your container, instead of binding /data folder as whole -v /YOUR_DOWNLOAD:/data, try binding the subfolder of /data, such as -v /YOUR_DOWNLOAD/complete:/data/completedand/or -v /YOUR_DOWNLOAD/complete:/data/incomplete(if you use incomplete folder). Then docker will create virtual volume (/date) with symlinks to your local download folder and transmission-home folder with necessary files with given PUID and PGID.
It makes more tricky to get to the transmission-home folder, but it works for me since I've never needed to access transmission-home so far.

I would suggest that you check the permissions of the parent folders.

If for example you have this directory tree:
/mnt/transmission/transmission-home

then both /mnt and /mnt/transmission should have at least execute rights for others (chmod o+x) in case they belong to other users/groups or not.

Did you solve this?

Continuing on the comment on parent folders. That might be a thing here, depending on how transmission accesses it. So we're running chown on transmission-home, config and the completed, watch and incomplete directories. The linked issue #411 also has an error that a couple of these folders don't exist.

Linux permissions isn't always straight forward to say the least. But if the root folder /data is not chown'ed then then that might stop transmission from traversing that tree. So maybe we should do a chown -R on /config and /data and see if that resolves it.

You could try to exec in as root and do that recursive chown on /data manually to see if that resolves it.

haugene heres what I see regarding folder ownership:

-v /volume2/Transmission/:/data \

Owned by PUID 1026 & PGID 100

-v /volume2/Transmission/tun/resolv.conf:/etc/resolv.conf \

tun owned by PUID 1026 & PGID 100

-v /volume2/video/downloads/:/media \

video folder owned by PUID root & PGID 100
downloads folder owned by PUID 1026 & PGID 100

My Transmission is running as PUID 1026 & PGID 100. But it is not able to create the proper files within the Transmission folder. If I run as root, then it creates files as root.


Edit:

So I chowned the "video" folder recursively to 1026:100 but Transmission still wont create the files it needs running at 1026:100

Could this be something at all to do with the Username "abc"?

OR could Transmission startup be trying to create files as ROOT but since its running as 1026:100 its getting denied and angry?

Okay I tried again using root and it creates files but when Sonarr tries to transfer the file to the /tv/ folder it says "No files found are eligible for import in /media/".

Sonarr has no /media/ folder. So it must be reading that from Transmission. Do I need Transmission and Sonarr to have a /media folder?

* Update *
Okay, so I solved this problem. I had to add a volume to SONARR that was the same path and name as TRANSMISSION /media.

This still doesn't answer why I have to run as root to get Transmission working. But this is good news!

Last item on my list here. Sonarr is not able to communicate with transmission for some reason.

Unable to communicate with Transmission. Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'.

To answer your questions. 1. Username doesn't matter, that's relative to the running system and it's only UID/GID that is evaluated. 2. If it is trying to create files as root, that would always work even if it's owned by whoever.

You're running sonarr as a container, right? And also as the same user? Because you could use the --volumes-from=openvpn-container and they would share volumes. And if you're running sonarr as a container, how are you addressing the openvpn container. It wont be localhost:9091. You then need to link it and use the link name, or run sonarr in host networking mode.

Because you could use the --volumes-from=openvpn-container

Can you elaborate on how I would implement this?

I am running both Sonarr and Transmission in docker as containers. I originally had them as same user. Now I am running transmission without PUID/PGID and it runs as root. Hence the solution above.

My Transmission container is accessed at 192.168.29.223:9091, my Sonarr at 192.168.29.223:8989. When Sonarr restarts I have an issue but if I "test" the connection it resolves and starts controlling torrents again.

I will check out host networking mode.

Finally, I noticed that my peer port is "closed" in Transmission. Any solution for this?
image

Tusen Takk for hjelpen!

You're welcome ;) Sorry it took a while before I got back to you, but...

The "permission denied" and ownership issues might be resolved in #423 where we're also changing ownership of transmission_home. Can you try pulling and using the dev tag and see if it's resolved?

As for the --volumes-from option. That's basically it. If you have a container that has some volumes, another container can be started with --volumes-from= and it will also have all volumes from that container and they can share that storage. See https://docs.docker.com/engine/reference/commandline/run/

423 merged to master, closing this

I had the same issue (all directories and file would be successfully created by the container, but it would then fails with "permission denied" for the transmission.log file...) and I fixed it by correcting the permissions of the data directory. For some reasons, it was:
d---------+ 1 root root
and I changed it to
drwxr-xr-x 1 root root
which solved the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stefanahman picture stefanahman  路  4Comments

Esteidinger picture Esteidinger  路  3Comments

holger8080 picture holger8080  路  4Comments

lorgio picture lorgio  路  4Comments

callahan22 picture callahan22  路  4Comments