linuxserver / docker-transmission

GNU General Public License v3.0
595 stars 185 forks source link

[BUG] Unexpected PGID/PUID behaviour for `/downloads/*` directories if they don't exist #218

Closed yoonsio closed 1 year ago

yoonsio commented 1 year ago

Is there an existing issue for this?

Current Behavior

/downloads/incomplete and /downloads/complete directories are owned by root even when PGID and PUID environment variables are set.

# ls -al /downloads/
total 16
drwxrwxr-x 4 abc  users 4096 Dec  7 01:46 .
drwxr-xr-x 1 root root  4096 Dec  7 01:46 ..
drwxr-xr-x 2 root root  4096 Dec  7 01:46 complete
drwxr-xr-x 2 root root  4096 Dec  7 01:46 incomplete

https://github.com/linuxserver/docker-transmission/blob/5d626209074760296f12ee18cdcd00ca146717bf/root/etc/s6-overlay/s6-rc.d/init-transmission-config/run#L47-L52

Expected Behavior

All files and directories under /downloads are expected to be owned by abc user based on environment variables PGID/PUID.

Steps To Reproduce

  1. Mount empty /downloads directory with PGID/PUID set to non-root user.
  2. Run the container
  3. Observe that /downloads/incomplete directory is owned by root

Environment

- OS: Ubuntu 20.04
- How docker service was installed:
  Container is run on kubeadm managed k8s

CPU architecture

x86-64

Docker creation

# volume mounts
       env:
       - name: PUID
         value: "1234"
       - name: PGID
         value: "1234"
       volumeMounts:
          - mountPath: /config
            name: config
          - mountPath: /downloads
            name: downloads
          - mountPath: /watch
            name: watch
    # ...
    volumes:
      - name: config
        hostPath:
          path: /configs
          type: Directory
      - name: downloads
        hostPath:
          path: /downloads
          type: Directory

Container logs

[custom-init] No custom services found, skipping...
[migrations] started
[migrations] no migrations found

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/

Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    1234
User gid:    1234
-------------------------------------

[custom-init] No custom files found, skipping...
[2022-12-07 01:46:36.272] Transmission 3.00 (bb6b5a062e) started (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/session.c:769)
[2022-12-07 01:46:36.272] RPC Server Serving RPC and Web requests on 0.0.0.0:9091/transmission/ (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/rpc-server.c:1243)
[2022-12-07 01:46:36.272] DHT Generating new id (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-dht.c:389)
[2022-12-07 01:46:36.272] Using settings from "/config" (/home/buildozer/aports/community/transmission/src/transmission-3.00/daemon/daemon.c:646)
[2022-12-07 01:46:36.272] Saved "/config/settings.json" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/variant.c:1221)
[2022-12-07 01:46:36.272] Watching "/watch" for new .torrent files (/home/buildozer/aports/community/transmission/src/transmission-3.00/daemon/daemon.c:698)
[2022-12-07 01:46:36.272] Port Forwarding (NAT-PMP) initnatpmp succeeded (0) (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/natpmp.c:73)
[2022-12-07 01:46:36.272] Port Forwarding (NAT-PMP) sendpublicaddressrequest succeeded (2) (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/natpmp.c:73)
[2022-12-07 01:46:44.272] Port Forwarding State changed from "Not forwarded" to "Starting" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/port-forwarding.c:106)
[2022-12-07 01:46:44.272] Port Forwarding State changed from "Starting" to "???" (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/port-forwarding.c:106)
[2022-12-07 01:47:23.272] DHT Attempting bootstrap from dht.transmissionbt.com (/home/buildozer/aports/community/transmission/src/transmission-3.00/libtransmission/tr-dht.c:299)
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

thespad commented 1 year ago

Oh, I know why, though it may be k8s-specific as it shouldn't typically be a problem. Thanks for pointing it out, I'll get it fixed.

yoonsio commented 1 year ago

@thespad thanks for the quick response!