qBittorrent not setting the user and group IDs and/or not working with the filesystem permissions

This is a weird issue that I can’t quite explain, so forgive me for the long description.

I have a set of containers with Jellyfin, qBittorrent, and some *arr applications running.

In the host machine, there’s a specific user for each service (e.g. sonarr, jellyfin, qbittorrent, etc) and a group to which all those users belong (mediaservices).

The host has the following directories:

/somewhere
├── private
│  ├── jellyfin
│  ├── radarr
│  └── qbittorrent
├──shared
   └── data
      ├── torrents
      └── media

The private directory is where I store configuration files and such for each individual service. Each directory is owned by the respective service user.

The shared directory is where I store files that should be accessed by all applications (media files, basically). Ignore the redundant data directory, it was added by mistake and I just haven’t removed it yet. This, and all its sub-directories belong to the mediaservices group and are set with read-write permissions for the group.

The qBittorrent service is defined in docker-compose.yml as follows (the QBITTORRENT_UID and MEDIASERVICES_GID variables are passed in when running docker compose up:

  qbittorrent:
    container_name: qbittorrent
    image: linuxserver/qbittorrent
    restart: unless-stopped
    environment:
      - PUID="${QBITTORRENT_UID}"
      - PGID="${MEDIASERVICES_GID}"
      - UMASK=002
      - UMASK_SET=002
      - TZ=Europe/Lisbon
      - WEBUI_PORT=8080
    volumes:
      - ./private/qbittorrent/config:/config
      - ./shared/data:/data
    ports:
      - 8080:8080
      - 6881:6881
      - 6881:6881/udp

There are two things happening:

  1. The logs for qbittorrent complain about

"groupmod: invalid group ID ‘“138”’
usermod: invalid user ID ‘“134”’

Those IDs are the correct group and user IDs for the desired group and user on the host machine.

  1. I change a few settings on the qbittorrent web interface but every time I restart the container, the changes are gone.

#2 is most likely a consequence of #1. More precisely, the UID and GID not being set properly in the container and thus qbittorrent not having access to its own configuration files. But I have no idea why and this is driving me crazy. The permissions and ownership are set correctly on the host, I checked that multiple times, but it just doesn’t work.

Any help would be greatly appreciated.

Your issue is you’ve wrapped your UID/GID variable’s with "'s. You can see that from your error :slight_smile:

Yep, I was coming back here to say exactly that :person_facepalming: :person_facepalming: :person_facepalming:

It used to work when I was using hotio.dev images, so I didn’t even think of looking at that.

I can’t believe I spent so much time on this :sweat_smile: