Plex Media Server in TrueNAS SCALE Virtual Machine
After trying and failing to use the default method to run Plex Media Server via TrueNAS SCALE's "App" catalog, I'm falling back to a manual route: spinning up a virtual machine with Ubuntu Server 22.04 to run Plex Media Server with my own preferred settings. I suppose I could learn about Helm charts so I could write one to run Plex my way, but at the moment I'm not too motivated to do so.
Recently I had been running Plex in a Docker container, which resolved my old gripes about FreeNAS plug-ins and FreeBSD freshports versions of Plex falling out of date. Plex developers maintain the container themselves and it gets updated in sync with official releases. A really nifty feature of their Docker container is that it doesn't really have Plex in it: it has code to download and run Plex. In order to pick up an updated version of Plex, I don't have to pull a new container. I just have to stop and restart it, and it downloads the latest and starts running it.
One subtlety of running Plex in Docker is the warning I shouldn't use a mapped network drive for server configuration data. I had thought it would be a good way to keep my Plex database constantly backed up on a TrueNAS ZFS redundant drive array, but I abandoned that plan after reading a scary disclaimer on the Docker repository README: "Note: the underlying filesystem needs to support file locking. This is known to not be default enabled on remote filesystems like NFS, SMB, and many many others. The 9PFS filesystem used by FreeNAS Corral is known to work but the vast majority will result in database corruption. Use a network share at your own risk."
I could install Docker Engine in my virtual machine for Plex, and repeat my configuration, but it seems weird to have nested virtualization mechanisms. (Docker inside KVM.) So this time I will run Docker as a service installed to my virtual machine, installed from Plex-maintained official repository. Migrating my Plex database started by finding the correct directory in both my existing Docker container volume and my new Ubuntu Server virtual machine at "/var/lib/plexmediaserver/
". Copying the files directly was not sufficient (Plex Media Service would fail to launch) because I forgot to update file permissions as well. That was fixed by running "chown -R plex:plex Library
" on the library database directory tree.
One unexpected obstacle is that a VM running under TrueNAS SCALE couldn't see the server itself. Doesn't matter if I'm trying to use NFS mapping, SSH, or HTTP, the server address is unreachable and times out with the error "No route to host". I confirmed this is not a general KVM issue, as my Ubuntu Desktop laptop with KVM and Proxmox VE had no such problems. I hypothesize it has something to do with how TrueNAS SCALE configured network bridge for virtual machines, but I don't know enough Linux networking to know for sure. As a workaround, I could bind my virtual machine to the Realtek chipset Ethernet port integrated on my server's motherboard. TrueNAS runs on an Intel NIC (network interface card) because FreeNAS didn't support the Realtek onboard port years ago. Now under TrueNAS SCALE I have access to both ports, so I run the TrueNAS server on the Intel NIC and bind my virtual machines to motherboard onboard Ethernet. Not the most satisfying solution, but it uses what I have on hand and is good enough to inform my first impressions.