Plexmediaserver.service doesn't work after the latest update (raspberry pi)

Hi,

First of all i am new to this so excuse my ignorance.

I had my plex server running perfectly on my RPI 4. After the latest update I get the following message when I check the status of plexmediaserver.service.

plexmediaserver.service - Plex Media Server
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-04-30 10:51:49 CEST; 26min ago
Process: 2360 ExecStartPre=/bin/sh -c /usr/bin/test -d "{PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "
Process: 2362 ExecStart=/bin/sh -c export PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{print
Main PID: 2362 (code=exited, status=1/FAILURE)

apr 30 10:51:44 raspberrypi systemd[1]: plexmediaserver.service: Main process exited, code=exited, status=1/FAILURE
apr 30 10:51:44 raspberrypi systemd[1]: plexmediaserver.service: Failed with result ‘exit-code’.
apr 30 10:51:49 raspberrypi systemd[1]: plexmediaserver.service: Service RestartSec=5s expired, scheduling restart.
apr 30 10:51:49 raspberrypi systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 3.
apr 30 10:51:49 raspberrypi systemd[1]: Stopped Plex Media Server.
apr 30 10:51:49 raspberrypi systemd[1]: plexmediaserver.service: Start request repeated too quickly.
apr 30 10:51:49 raspberrypi systemd[1]: plexmediaserver.service: Failed with result ‘exit-code’.
apr 30 10:51:49 raspberrypi systemd[1]: Failed to start Plex Media Server.

Like I said before it was running just fine before the update. I know it has something to do with the user and group in the plexmediaserver.service file because when I change the user to plex instead of pi it works perfectly. I want plex to run as pi for permission reasons. How come it doesn’t work anymore?

This is the content of the plexmediaserver.service file

[Unit]
Description=Plex Media Server
After=network.target network-online.target

[Service]
Environment=“PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support”
Environment=PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
Environment=PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
Environment=PLEX_MEDIA_SERVER_TMPDIR=/tmp
ExecStartPre=/bin/sh -c ‘/usr/bin/test -d “{PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "{PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}”’
ExecStart=/bin/sh -c ’
export PLEX_MEDIA_SERVER_INFO_VENDOR="(grep ^NAME= /etc/os-release | awk -F= "{print \\$2}" | tr -d \\" )"; \ export PLEX_MEDIA_SERVER_INFO_DEVICE="PC"; \ export PLEX_MEDIA_SERVER_INFO_MODEL="(uname -m)";
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(grep ^VERSION= /etc/os-release | awk -F= “{print \$2}” | tr -d \" )";
export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib;
exec “/usr/lib/plexmediaserver/Plex Media Server”’
Type=simple
User=pi
Group=pi
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
SyslogIdentifier=Plex Media Server
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

Thanks in advance

Ensure that the Plex Media Server application data directory is owned by pi:
sudo chown -R pi:pi /var/lib/plexmediaserver

By default it will be owned by plex.

By the way, you shouldn’t be overriding the user and group under which PMS runs in the service file; create /etc/systemd/system/plexmediaserver.service.d/override.conf and place the appropriate entries in there:
sudo systemctl edit plexmediaserver.service

This will open a new override.conf if it doesn’t exist file (under /etc/systemd/system/plexmediaserver.service.d) for editing. In there, add something like:

[Service]
User=pi         # Run as user pi...
Group=pi        # ... and group pi
UMask=0002      # Set file creation mask; new files will be created as 0775

Run sudo systemctl daemon-reload after saving the file. You can then start the service.

Followed your instructions and it works. Thanks alot.

No problem, glad you got it working.

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