Plex doesn't start after having moved the library

Server Version#: 4.32.2
Player Version#: 1.9.0.1203-00f2b4d9

Hello, quite a novice Linux user here.
Running plex on a headless Raspberry PI 2B with Raspian.
Since I was not able to update plex via apt, I followed this guide to move the metadata dir. Not sure I did it properly.
Now plex doesn’t start.
systemctl status plexmediaserver.service says:

plexmediaserver.service - Plex Media Server for Linux
   Loaded: loaded (/etc/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/plexmediaserver.service.d
           └─override.conf
   Active: failed (Result: exit-code) since Wed 2020-04-29 22:36:07 CEST; 13min ago
  Process: 8423 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" (code=exited, status=1/FAILURE)


Apr 29 22:36:07 raspberrypi systemd[1]: plexmediaserver.service: Service RestartSec=5s expired, scheduling restart.
Apr 29 22:36:07 raspberrypi systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 3.
Apr 29 22:36:07 raspberrypi systemd[1]: Stopped Plex Media Server for Linux.
Apr 29 22:36:07 raspberrypi systemd[1]: plexmediaserver.service: Start request repeated too quickly.
Apr 29 22:36:07 raspberrypi systemd[1]: plexmediaserver.service: Failed with result 'exit-code'.
Apr 29 22:36:07 raspberrypi systemd[1]: Failed to start Plex Media Server for Linux.

Thanks.

Luca

Please show the Override.conf, ls -la of the new location directory.

A step was missed. Let’s see if we can find it.

Supplemental:

   Loaded: loaded (/etc/systemd/system/plexmediaserver.service;

This file doesn’t belong in /etc/ , it belongs in /lib/systemd/system.
The installer should have warned loudly about that.

override.conf

#
# Customize Plex's config
#
# Identify this as a service override
[Service]
#
#  Move the data directory
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/plexdir/Library/Application Support"
#
#  These values are only needed if you wish to change user & group
User=plex
Group=plex
#
# This is needed to change the default umask     
UMask=0002    # this must be octal    - See warning below

ls -la of /home/plexdata/Library/Application Support/Plex Media Server

total 48
drwxr-xr-x 10 plex plex 4096 Apr 29 20:57  .
drwxr-xr-x  3 plex plex 4096 Apr 24 16:03  ..
drwxr-xr-x  5 plex plex 4096 Apr 29 20:57  Cache
drwxr-xr-x  3 plex plex 4096 Apr 24 16:03  Codecs
drwxr-xr-x  3 plex plex 4096 Apr 24 16:03 'Crash Reports'
drwxr-xr-x  3 plex plex 4096 Apr 29 20:56  Logs
drwxr-xr-x  3 plex plex 4096 Apr 26 14:01  Media
drwxr-xr-x  5 plex plex 4096 Apr 28 17:40  Metadata
-rw-r--r--  1 plex plex    4 Apr 29 20:55  plexmediaserver.pid
drwxr-xr-x  3 plex plex 4096 Apr 24 16:05  Plug-ins
drwxr-xr-x  7 plex plex 4096 Apr 24 16:04 'Plug-in Support'
-rw-r--r--  1 plex plex  899 Apr 29 20:57  Preferences.xml

Oh God… the problem is /home/plexdir/ and /home/plexdata/ ??

Ok I corrected that trivial error and now plex starts.
Regarding:

This file doesn’t belong in /etc/ , it belongs in /lib/systemd/system .
The installer should have warned loudly about that.

The installer says:

Preparing to unpack .../plexmediaserver_1.19.2.2737-b69929dab_armhf.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Systemd configuration error detected:
PlexMediaServer install: File "/etc/systemd/system/plexmediaserver.service" is leftover from an earlier Debian/Ubuntu bug.
PlexMediaServer install: Please transfer any customizations \(APP_DIR, User, Group, TMPDIR, and/or UMask\) to a proper "/override.conf"
PlexMediaServer install: and reinstall.
PlexMediaServer install: Unit override "/etc/systemd/system/plexmediaserver.service" found.
PlexMediaServer install: Only "/etc/systemd/system/plexmediaserver.service.d/override.conf" is supported.
PlexMediaServer install: Warning:  "/var/lib/plexmediaserver/Library/Application Support" isn't owned by "plex", UID: 999.  Found "pi", UID: 1000 instead. Continuing.
PlexMediaServer install: 
PlexMediaServer install: Pre-installation Validation failed.
PlexMediaServer install: Configuration information discovered:
PlexMediaServer install:   Installation Type:  Update
PlexMediaServer install:   Process Control:    systemd
PlexMediaServer install:   Plex User:          plex
PlexMediaServer install:   Plex Group:         plex
PlexMediaServer install:   Video Group:        video
PlexMediaServer install:   Metadata Dir:       /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer install:   Temp Directory:     /tmp
PlexMediaServer install:   Lang Encoding:      en_US.UTF-8
PlexMediaServer install:   Transcoding HW:     Not found
PlexMediaServer install: 
PlexMediaServer install: Pre-installation Validation complete.  Errors: 0, Warnings: 1
dpkg: error processing archive /var/cache/apt/archives/plexmediaserver_1.19.2.2737-b69929dab_armhf.deb (--unpack):
 new plexmediaserver package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/plexmediaserver_1.19.2.2737-b69929dab_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

So there is also a permission issue.

Do you see / know what to do now?

No… sorry.

Thanks.

Do you want it to run as user pi or plex ?

I would say pi, as long as future installation/configuration required plex as user.

My installation scripts adapt to whatever you have configured.

If you want:

  1. User to be pi
  2. Application Support dir to be /home/plexdata/Library/Application Support
    warning: You refer to plexdir and plexdata, I will assume you mean plexdata. Adjust as appropriate if incorrect.

Then:

  1. Remove file: /etc/systemd/system/plexmediaserver.service – It doesn’t belong. Allow the system default in /usr/lib/systemd/system/plexmediaserver.service to do its job. It’s also the file I expect and maintain for you.

  2. Create directory /etc/systemd/system/plexmediaserver.service.d

  3. In that directory, create override.conf , containing

# Plex service customization
#
[Service]

Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/plexdata/Library/Application Support"

User=pi
Group=pi
  1. Now make ownership all belong to user pi:pi
sudo chown -R pi:pi /home/plexdata
  1. Update systemd of the changes: sudo systemctl daemon-reload

  2. Start it: sudo systemctl start plexmediaserver

When you’re all done, you can run the package installation again and everything should now be reported as you expect.

Sorry what I have to do to

?

The file /usr/lib/systemd/system/plexmediaserver.service is a file the installer (DPKG package manager) maintains. You don’t touch it. All Debian 8+ and Ubuntu 16+ systemd use /usr/lib/systemd/system as the default storage area for their service definition files.

You only need to:

  1. Delete /etc/systemd/system/plexmediaserver.service
  2. Create /etc/systemd/system/plexmediserver.service.d/override.conf as I have shown for you above.
  3. Change the ownership to user pi in /home/plexdata
PlexMediaServer install: PlexMediaServer-1.19.2.2737-b69929dab - Installation successful.  Errors: 0, Warnings: 0

Thank you very much @ChuckPa!

All good now?

It’s running?

Yes it’s running.
Thank you for your kind support.

Luca

My pleasure

:+1:

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