One day my plex server on Ubuntu Server 20.04 LTS just stopped working. I don’t recall doing anything to it. I just lost access to it.
I’ve found that the service isn’t starting. I’ve tried rebooting the service and server many times and still no success. I run the status command and get the output below:
systemctl status plexmediaserver.service
● plexmediaserver.service - Plex Media Server
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-02-27 02:33:16 UTC; 30s ago
Process: 1171 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=0/SUCCESS)
Process: 1180 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 PL>
Main PID: 1180 (code=exited, status=255/EXCEPTION)
Feb 27 02:33:16 us01 systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 3.
Feb 27 02:33:16 us01 systemd[1]: Stopped Plex Media Server.
Feb 27 02:33:16 us01 systemd[1]: plexmediaserver.service: Start request repeated too quickly.
Feb 27 02:33:16 us01 systemd[1]: plexmediaserver.service: Failed with result ‘exit-code’.
Feb 27 02:33:16 us01 systemd[1]: Failed to start Plex Media Server.
And another command to better give info on the error:
journalctl -e -u plexmediaserver.service
Feb 26 06:17:57 us01 systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 2.
Feb 26 06:17:57 us01 systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 2.
Feb 26 06:17:57 us01 systemd[1]: Stopped Plex Media Server.
Feb 26 06:17:57 us01 systemd[1]: Starting Plex Media Server…
Feb 26 06:17:57 us01 systemd[1]: Started Plex Media Server.
Feb 26 06:17:57 us01 Plex Media Server[1176]: /bin/sh: 1: exec: /usr/lib/plexmediaserver/Plex Media Server: not found
Feb 26 06:17:57 us01 systemd[1]: plexmediaserver.service: Main process exited, code=exited, status=127/n/a
Feb 26 06:17:57 us01 systemd[1]: plexmediaserver.service: Failed with result ‘exit-code’.
Feb 26 06:18:02 us01 systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 3.
Feb 26 06:18:02 us01 systemd[1]: Stopped Plex Media Server.
Feb 26 06:18:02 us01 systemd[1]: plexmediaserver.service: Start request repeated too quickly.
Feb 26 06:18:02 us01 systemd[1]: plexmediaserver.service: Failed with result ‘exit-code’.
Feb 26 06:18:02 us01 systemd[1]: Failed to start Plex Media Server.
Feb 26 17:12:05 us01 systemd[1]: Starting Plex Media Server…
Feb 26 17:12:05 us01 systemd[1]: Started Plex Media Server.
Feb 26 17:12:06 us01 Plex Media Server[18670]: Error: Unable to set up server: listen: Address in use (N5boost10wrapexceptINS_6system12system_errorEEE)
Feb 26 17:12:06 us01 systemd[1]: plexmediaserver.service: Main process exited, code=exited, status=255/EXCEPTION
Feb 26 17:12:06 us01 systemd[1]: plexmediaserver.service: Failed with result ‘exit-code’.
Feb 26 17:12:11 us01 systemd[1]: plexmediaserver.service: Scheduled restart job, restart counter is at 1.
Feb 26 17:12:11 us01 systemd[1]: Stopped Plex Media Server.
Feb 26 17:12:11 us01 systemd[1]: Starting Plex Media Server…
Feb 26 17:12:11 us01 systemd[1]: Started Plex Media Server.
(it repeats three times with no change in output)
I’ve searched far and wide and tried many solutions I’ve seen on the internet and still no success. Hopefully someone here can lend me a hand and get this problem solved.
I tried uninstalling, rebooting and reinstalling but still get the same error. Also that file does exist on the server.
I ran the command below:
ls /usr/lib/plexmediaserver
And got this as an output:
CrashUploader ‘Plex DLNA Server’ ‘Plex Media Scanner’ ‘Plex Relay’ ‘Plex Script Host’ ‘Plex Tuner Service’ etc
‘Plex Commercial Skipper’ ‘Plex Media Fingerprinter’ ‘Plex Media Server’ ‘Plex SQLite’ ‘Plex Transcoder’ Resources lib
I did make some changes to a file so an external drive I have attached to the server auto mounts and is broadcast in my network as an SMB share on startup.
Well i did not see any of the names of the processes you called but I killed the only plex process i saw and it doesnt kill it. Additionally, whenever I execute the kill command it ends my ssh session to the server as well so maybe I’m killing the wrong thing. I am not sure.
From what you’ve shown me, the kill -9 4442 killed the parent process (your shell).
The PID of the process is the first number. The parent process ID is the second number.
So that my instructions are better targeted, how long have you been using Linux?
Off and on for about 5 years. I apologise for any inconvenience caused due to me not knowing something.
In the case of killing the process, since the table didnt have any headings, I tried both processes at first. When i tried killing the first number (In the case of the output shown earlier “4678”) it said no such process so that’s when I tried to kill the second number which ended up terminating my SSH session.
Notice they are either the Plex Plug-in (agents) or the main server elements themselvs from /usr/lib/plexmediaserver
Let’s now find out which process is holding the main plex ports (any of them) open
sudo bash
for i in 3240[0-9]
do
netstat -tulpn | grep $i
done
This will show the progresses are using Plex’s ports.
Please show me your output (Copy/paste the text)
It will look something like this:
root@lemming:~# for i in 3240[0-9]
> do
> netstat -tulpn | grep $i
> done
tcp 0 0 127.0.0.1:32401 0.0.0.0:* LISTEN 24852/Plex Media Se
tcp6 0 0 :::32400 :::* LISTEN 24852/Plex Media Se
root@lemming:~#
In the above, you can see my server is what’s using the ports ; which is normal.
For you, I expect to find something else.
Thank you, I got the problem resolved. The problem was that I changed the port to SSH into the server and made it a bit too close to the port number Plex uses. I changed the port SSH uses to another one again, rebooted and now Plex works again.
I’m guessing the day the Plex stopped working for me was the first time the server restarted since I made the changes which is why I never noticed the conflict until then.