SOLVED plex media server does not autostart at boot time

Hi

I obtained the RPM of plexmediaserver from Plex TV main site. The RPM is for Fedora so I had fingers crossed.

It install no problem and is functionally fine. Except it doesn’t autostart at boot time.

So I look in Yast → Services manager. The “plexmediaserver” is listed there but it’s disabled + inactive. So I try to Enable + Start it. It fails and gives a comment like this: " …Invalid escape sequences in …" I can’t see it fully, that’s a snippet, not copy-paste-able.

So I run the systemctl status query to see if I can track the problem a bit more:

Nov 07 20:10:35 Tumbleweed132 systemd[1]: [/lib/systemd/system/plexmediaserver.service:14] Invalid escape sequences in command line: "/bin/sh -c '/usr/lib/plexmediaserver/Plex\ Media\ Server'"
Nov 07 20:12:30 Tumbleweed132 systemd[1]: [/lib/systemd/system/plexmediaserver.service:14] Invalid escape sequences in command line: "/bin/sh -c '/usr/lib/plexmediaserver/Plex\ Media\ Server'"
Nov 07 20:15:19 Tumbleweed132 systemd[1]: [/lib/systemd/system/plexmediaserver.service:14] Invalid escape sequences in command line: "/bin/sh -c '/usr/lib/plexmediaserver/Plex\ Media\ Server'"
Nov 07 20:15:19 Tumbleweed132 systemd[1]: Starting Plex Media Server for Linux...
Nov 07 20:15:19 Tumbleweed132 systemd[1]: Started Plex Media Server for Linux.
Nov 07 20:22:26 Tumbleweed132 systemd[1]: Stopping Plex Media Server for Linux...
Nov 07 20:22:26 Tumbleweed132 systemd[1]: Stopped Plex Media Server for Linux.

Then I run the start commend

Tumbleweed132:/home/john # systemctl start  plexmediaserver.service

and the media server comes to life.

It is a Fedora RPM so I’m not surprised it’s a bit tetchy in Tumbleweed.

I can always set up a cron command to run 60 secs after boot time, to start the server, but that’s a bit unsatisfactory.

Any suggestions on how to make this work automatically?

Thanks

Looks like no one knows the answer to this question so I’ll add the workaround in case of other users.

I need to have the Plex TV server start the service daemon automatically (on boot). I use a cron task manager.
I need to edit the root cron table. I like to use kwrite as the editor (because I never did like the default editor vi in a gui environment), so in a su console I run this command to temporarily change the root editor:

export EDITOR='dbus-launch /usr/bin/kwrite'

Then run this command (in su console) to open the root cron table

crontab -e

The table will open and add this line into it:

@reboot sleep 60;systemctl start  plexmediaserver.service

There must also be a final line in the file, a blank line, or it will fail.
That entry will give the cron a 1 minute pause at boot time, then execute the startup of the media server.

PS if you like to permanently change the global environment for editor, put the command

export EDITOR='dbus-launch /usr/bin/kwrite'

in the file /etc/profile.local (which file you might need to create). But that’s a very bad move if you later might need to run cron table in a console environment.

Hi
Sounds like it’s error in the service file? What is in that file: plexmediaserver.service

I should have posted this before, obvious brain malfunction, ----- so here it is:

[Unit]
Description=Plex Media Server for Linux
After=network.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
Environment=LD_LIBRARY_PATH=/usr/lib/plexmediaserver
Environment=LC_ALL=en_US.UTF-8
Environment=LANG=en_US.UTF-8
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 '/usr/lib/plexmediaserver/Plex\ Media\ Server'
Type=simple
User=plex
Group=plex
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target