PMS not honoring env var

Server Version#: 1.21.2.3918
Player Version#: n/a
OS: Arch Linux

Sorry, the forum wouldn’t allow PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR in the title.

I’ve followed these instructions: https://forums.plex.tv/t/moving-pms-library/197342
but the service fails to start with the following error:

Jan 22 15:28:51 astro Plex Media Server[679621]: PMS: failure detected. Read/write access is required for path: /var/lib/plex/Plex Media Server

Checking systemctl status plexmediaserver shows that it sees my override.conf file:

   Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/plexmediaserver.service.d
           `-override.conf

The contents of which are:

[Service]
Environment=LC_ALL=en_US.UTF-8
Environment=LANG=en_US.UTF-8
Environment=PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/astro/drives/two/plex

For now I put in a symlink so the server will start (/var/lib/plex -> /astro/drives/two/plex/), but I’d like to fix it the right way.

Guess I just needed to poke at it a bit more…

ps showed that the PMS process had the env var PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plex so the error message is legit. That means either systemd isn’t doing what I want or PMS is changing its env var (seems rather unlikely).

Maybe it’s unique to Arch’s package for PMS, but the env vars aren’t set directly in the service file. Instead, there’s another file referenced from the service file using EnvironmentFile=/etc/conf.d/plexmediaserver and the vars are set in there. The wrinkle comes in that using a systemd drop-in to specify Environment= doesn’t override vars set in an EnvironmentFile (not the first time systemd has done something unexpected).

Solution: create a copy of /etc/conf.d/plexmediaserver (because it’s owned by the package) and change /etc/systemd/system/plexmediaserver.service.d/override.conf to say:

[Service]
EnvironmentFile=/etc/conf.d/plexmediaserver-amigo

I will remind, for which I’m sorry to do, Arch Linux is not a supported platform.
Someone else is taking our package and repackaging for Arch.

Please direct all future support requests to the Arch package provider.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.