DLNA Server Requires Plex Service Restart After Boot

server-raspberry-pi

#1

I recently installed Plex (1.9.4.4325) on Linux Mint 18 and configured it according to this article

Everything works fine except for DLNA. When I boot up, DLNA does not work. Only after I manually issue a
sudo service plexmediaserver restart
does DLNA start working.

When DLNA is not working, no DLNA client can find/discover or connect to Plex. I have several clients that I use to test (PS3, Android apps, etc.)

I haven't found anything in the log files that would suggest why DLNA is not running properly.
DLNA appears to start up correctly, according to the log files:
Oct 24, 2017 17:09:54.466 [0x7f94acfff700] DEBUG - Plex DLNA Server starting.
Oct 24, 2017 17:09:54.466 [0x7f94acfff700] DEBUG - Job running: '/usr/lib/plexmediaserver/Plex DLNA Server'

But the log files say the same thing no matter if it's right after a system start or after a manual service restart.
I don't see any relevant errors in the log files that would suggest what is happening.

When DLNA is not working, I get the same result from calling this as when DLNA is working:
sudo service plexmediaserver status

It always says it's active...so, nothing odd there.

Any ideas?


#2

This sort of thing is typically caused by dependencies being incorrect and Plex starting up "too soon." Have you looked at the systemd files fro plexmediaserver to validate that it has the correct dependencies and such? What about information in the startup logs (maybe try looking at the output of dmesg) that shows what's starting up AFTER Plex on boot?


#3

I thought that maybe the network wasn't coming up in time but my boot logs show that the network comes up before plex:

[ OK ] Started Raise network interfaces.
[ OK ] Started Authenticate and Authorize Users to Run Privileged Tasks.
[ OK ] Started Network Manager.
Starting Network Manager Wait Online...
[ OK ] Reached target Network.
Starting OpenVPN service...
Starting Plex Media Server for Linux...
[ OK ] Started Accounts Service.
[ OK ] Started OpenVPN service.
Starting Network Manager Script Dispatcher Service...
[ OK ] Started Plex Media Server for Linux.
Starting Manage, Install and Generate Color Profiles...
[ OK ] Started Network Manager Script Dispatcher Service.

systemd config seems fine:

[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
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 'LD_LIBRARY_PATH=/usr/lib/plexmediaserver "/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

What else should I be looking for?


#4

What is your Network Manager Script Dispatcher actually doing? Also, being that OpenVPN is starting prior to Plex, that could be throwing things off - can you disable it and see what happens?


#5

I'm happy to read this post: I have almost the same issue on my raspberry for so long time without finding any solution.
After some time without use, DLNA does'nt work anymore. Either i need to restart service plexmediaserver or launch a web browser and access plex to wake up him, which both solutions are not really the most convenient...

Do you have any news on the sorting of this issue ?
Unfortunately, i don't have big knowledge on linux...
I'm running on the latests available version for raspberry 1.9.6.4429
about the network coming up before or not, i have activated an option in raspi-config to wait for network before booting but without better results :(
Can you help ?


#6

Sorry for not replying to this for so long...

I added a sleep/restart command to /etc/rc.local via another script. So, inside rc.local:

/root/scripts/plexrestart.bash

and inside plexrestart.bash
~~~~~~

!/bin/bash

sleep 10

/bin/systemctl restart plexmediaserver
~~~~~~

I never did disable OpenVPN because this solution worked for me...not sure why. Hope it helps someone else.