user@argobox:~/journal/2024-11-29-the-plex-that-couldnt-see
$ cat entry.md

The Plex That Couldn't See

○ NOT REVIEWED

The Plex That Couldn’t See

Date: November 29, 2024 Issue: Plex can’t see media files on NAS Root cause: Container permissions Result: Fixed with PUID/PGID mapping


The Symptom

Plex library scan: 0 items found.

The media was there. I could browse it over SMB. I could ls the mounted directory from the host. But Plex’s scan came up empty.


The Setup

  • Plex running in Docker on a Proxmox VM
  • Media on Synology NAS at 192.168.20.8
  • NAS shares mounted via CIFS to /mnt/media
  • Plex container volume: /mnt/media:/media

Everything looked right. Everything was wrong.


Debug Step 1: Check the Mount

ls -la /mnt/media
drwxr-xr-x 2 root root 4096 Nov 29 10:00 .
drwxr-xr-x 3 root root 4096 Nov 29 10:00 ..
drwxr-xr-x 5 root root 4096 Nov 29 10:00 Movies
drwxr-xr-x 5 root root 4096 Nov 29 10:00 TV

Files exist. But owned by root.


Debug Step 2: Check Container Access

docker exec -it plex /bin/bash

Inside the container:

ls -la /media
drwxr-xr-x 2 nobody nogroup 4096 Nov 29 10:00 .
drwxr-xr-x 5 nobody nogroup 4096 Nov 29 10:00 Movies
drwxr-xr-x 5 nobody nogroup 4096 Nov 29 10:00 TV

From the container’s perspective: nobody:nogroup. The Plex process runs as a specific user (usually plex or UID 1000). If the files are owned by nobody, and Plex can’t read them, the library stays empty.


The Root Cause

CIFS mounts don’t preserve Unix permissions properly. By default, everything mounts as root:root on the host, which becomes nobody:nogroup inside containers.

Plex needs read access to the files. The files need to be readable by Plex’s UID.


The Fix: Mount Options

Updated /etc/fstab:

//192.168.20.8/Media /mnt/media cifs credentials=/etc/samba/credentials,uid=1000,gid=1000,file_mode=0755,dir_mode=0755 0 0

Key additions:

  • uid=1000 - Files appear owned by UID 1000
  • gid=1000 - Files appear owned by GID 1000
  • file_mode=0755 - Files are readable by everyone
  • dir_mode=0755 - Directories are traversable

Remount:

umount /mnt/media
mount /mnt/media

Check:

ls -la /mnt/media
drwxr-xr-x 2 argo argo 4096 Nov 29 10:00 .
drwxr-xr-x 5 argo argo 4096 Nov 29 10:00 Movies
drwxr-xr-x 5 argo argo 4096 Nov 29 10:00 TV

Now owned by argo (UID 1000).


The Docker Fix

Plex container also needs to know which UID to run as. In docker-compose:

services:
  plex:
    image: linuxserver/plex
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - /mnt/media:/media

The PUID and PGID environment variables tell the LinuxServer container to run the internal Plex process as that user.

Now the mount is UID 1000, and Plex runs as UID 1000. Permissions match.


The Result

Restart Plex:

docker compose restart plex

Trigger library scan.

Scanning Movies...
Found 847 items
Scanning TV...
Found 156 series

The library populated. Movies appeared. Everything worked.


Why This Happens

Docker containers run as specific users. CIFS mounts have their own permission mapping. When these don’t align, you get “permission denied” errors that manifest as “0 items found.”

The files existed. The paths were correct. The process just couldn’t read them.


The Checklist

For Plex + NAS + Docker:

  1. Mount with explicit UID/GID matching the container user
  2. Set file_mode and dir_mode to ensure readability
  3. Pass PUID/PGID to the container (LinuxServer images)
  4. Verify inside the container with ls -la

When Plex can’t find files that clearly exist, the problem is almost always permissions. Check the UID.