crazy-max / docker-qbittorrent

qBittorrent Docker image
MIT License
74 stars 15 forks source link

Container/application does not create /data/config and /data/data directories #24

Closed adamrothman closed 3 years ago

adamrothman commented 3 years ago

I believe this is the same problem described in #1; finding that issue is what allowed me to work around this. I have tried to provide as much detail as possible below – please ping me if I can answer any questions.

Thanks for maintaining this repo!

Behaviour

Steps to reproduce this issue

  1. Create a docker-compose file that maps an empty host directory to the container's /data volume
  2. Start the qBittorrent container
  3. Container fails to start and enters restart loop

Expected behaviour

The container/application should create all necessary directories it expects to find inside /data on first run:

Actual behaviour

Container/application does not create config and data directories inside of /data volume (it does create the others) and fails to start. Manually creating these directories allows the container to start and remain up.

Configuration

Here's my compose file:

docker-compose.yml ```yaml version: '3' services: flexget: build: flexget depends_on: - nginx environment: TZ: America/Los_Angeles networks: - tarsnet restart: always volumes: - /volume1/docker/flexget:/home/flexget/.flexget - /volume1/docker/transmission/watch:/home/flexget/torrents nginx: build: nginx networks: - tarsnet ports: - 'XXX:443' # redacted restart: always volumes: - /usr/syno/etc/certificate/_archive/1B4XLl:/etc/nginx/ssl:ro qbittorrent: depends_on: - nginx environment: ALT_WEBUI: 'false' PUID: '1044' PGID: '65538' TZ: America/Los_Angeles image: crazymax/qbittorrent networks: - tarsnet ports: - 'XXX:6881/tcp' # redacted - 'XXX:6881/udp' # redacted restart: always ulimits: nproc: 65535 nofile: soft: 32000 hard: 40000 volumes: - /volume1/docker/qbittorrent:/data transmission: build: transmission depends_on: - nginx environment: CURL_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt TR_CURL_VERBOSE: 1 TZ: America/Los_Angeles networks: - tarsnet ports: - 'XXX:XXX' # redacted restart: always volumes: - /volume1/docker/transmission/config:/home/transmission/.config - /volume1/docker/transmission/incomplete:/home/transmission/incomplete - /volume1/docker/transmission/watch:/home/transmission/watch - /volume1/Media/Downloads:/home/transmission/downloads networks: tarsnet: {} ```

Docker info

# docker info
Containers: 4
 Running: 4
 Paused: 0
 Stopped: 0
Images: 34
Server Version: 18.09.8
Storage Driver: btrfs
Logging Driver: db
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs db fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 0cf16177dbb234350dc27dd2bbd1d7cebd098108
runc version: 6cc9d3f2cd512eeb3d548e2f6b75bcdebc779d4d
init version: e01de58 (expected: fec3683)
Security Options:
 apparmor
Kernel Version: 3.10.105
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 5.814GiB
Name: TARS
ID: VC5Y:VJHJ:EHD3:JVFU:RQPU:MTKU:ULVH:PZPM:NL2Z:HWP5:4UUO:XZ5D
Docker Root Dir: /volume1/@docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No kernel memory limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Logs

When first starting the container with an empty host directory mapped to /data:

WAN IP address is X.X.X.X
Creating folders...
Initializing qBittorrent configuration...
/entrypoint.sh: line 35: can't create /data/config/qBittorrent.conf: nonexistent directory
Overriding required parameters...
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
sed: /data/config/qBittorrent.conf: No such file or directory
Fixing perms...
Could not create required directory '/home/qbittorrent/.config/qBittorrent/'

The container does create a few subdirectories inside the host directory mapped to /data but is missing some crucial ones:

# ls -ahl /volume1/docker/qbittorrent
total 0
drwxrwxr-x+ 1 docker docker 62 Mar  6 18:50 .
drwxr-xr-x+ 1 root   root   92 Mar  6 18:50 ..
drwxrwxr-x+ 1 docker docker  0 Mar  6 18:50 downloads
drwxrwxr-x+ 1 docker docker  0 Mar  6 18:50 temp
drwxrwxr-x+ 1 docker docker  0 Mar  6 18:50 torrents
drwxrwxr-x+ 1 docker docker  0 Mar  6 18:50 watch
drwxrwxr-x+ 1 docker docker  0 Mar  6 18:50 webui

After manually creating a config directory in the host directory mapped to /data:

WAN IP address is X.X.X.X
Creating folders...
Initializing qBittorrent configuration...
Overriding required parameters...
Fixing perms...
Could not create required directory '/home/qbittorrent/.local/share/qBittorrent/'

While in this state, where /data/config exists but not /data/data, something causes the Downloads\ScanDirsV2 field in qBittorrent's config file to grow and grow. I think it's this line: https://github.com/crazy-max/docker-qbittorrent/blob/002e4696c75d6d301a57cfb47ce035fa7f599de7/entrypoint.sh#L87

It seems like it gets longer every time the container restarts. While troubleshooting this issue, my qBittorrent.conf file grew to 1.5 GB. Here's an example from after a few restarts:

Downloads\ScanDirsV2=@Variant(Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x1cDownloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x1Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x16Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)/Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x64Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x61Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)tDownloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x61Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)/Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)wDownloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x61Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)tDownloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x63Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)hDownloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x2Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)Downloads\ScanDirsV2=@Variant(\0\0\0\x1c\0\0\0\x1\0\0\0\x16\0/\0\x64\0\x61\0t\0\x61\0/\0w\0\x61\0t\0\x63\0h\0\0\0\x2\0\0\0\x1)x1)
crazy-max commented 3 years ago

@adamrothman https://github.com/crazy-max/docker-qbittorrent/pull/23#issuecomment-792182710

adamrothman commented 3 years ago

@crazy-max thanks for the quick reply! It looks like that patch creates configs but not data.

adamrothman commented 3 years ago

Oops JK I was looking at the wrong diff! Your linked patch should fix.

crazy-max commented 3 years ago

@adamrothman Pull latest it should now be fixed.