Plex media server not working after installation completing without error on ubuntu 16.04 LTS

I have followed all the steps for the package installation.

after installed the downloaded package by –
sudo dpkg -i package_name.deb

I navigated to http://localhost:32400/web/index.html doesn’t load the page. It seems Plex media server is not running. I don’t see any thing in ps command output for Plex. Also, I don’t see anything in the output of netstat command for the port 32400.

Experts please help! I really want to make this work. I wold be happy to install everything from scratch if that helps.

What’s the output of
service plexmediaserver status

see what happens with
sudo service plexmediasever start

If the difficulty was only because the service did not starting and you with the server to start automatically with each system boot:

sudo systemctl enable plexmediaserver

(Ubuntu 16 uses systemd instead of init. init is now obsolete.)

@aschmidtm said:
What’s the output of
service plexmediaserver status

see what happens with
sudo service plexmediasever start

Thanks for responding. When I start the service, it doesn’t show any error. So it looks like everything went fine.

Output for the service plexmediaserver status is

plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2017-01-27 17:44:10 PST; 1h 9min ago
Process: 1277 ExecStart=/bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver /usr/lib/plexmediaserver/Plex\ Media\ Server (code=exited, status=127)
Process: 1273 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)
Main PID: 1277 (code=exited, status=127)

Jan 27 17:44:10 funmachine systemd[1]: plexmediaserver.service: Service hold-off time over, scheduling restart.
Jan 27 17:44:10 funmachine systemd[1]: Stopped Plex Media Server for Linux.
Jan 27 17:44:10 funmachine systemd[1]: plexmediaserver.service: Start request repeated too quickly.
Jan 27 17:44:10 funmachine systemd[1]: Failed to start Plex Media Server for Linux.

@ChuckPa No, I think the package installation hasn’t gone through correctly.

I just got your message and am already writing my reply… one moment while I complete it and post

Check for the existence and permissions: ls -la /var/lib/plexmediaserver
Check for the existence of user plex: grep plex /etc/passwd
Check for the existence of group plex: grep plex /etc/group

For reasons not clear to me (I work on the install scripts), some Ubuntu systems do not like the installation script. This having been said, if there was a previous installation of Plex (user plex already exists), things don’t always go properly.

If user plex has existed in the past, perhaps having its home directory modified (changed) in /etc/passwd and/or directory /var/lib/plexmediaserver isn’t owned by user plex (the current UID & GID) then the error you see occurs.

Here is the procedure to re-establish Plex’s home directory and allow the Library to initialize. This presumes user plex and group plex exist. If they do not, let me know and we’ll correct that.

sudo rm -rf /var/lib/plexmediaserver
sudo mkdir /var/lib/plexmediaserver
sudo chown plex:plex /var/lib/plexmediaserver

This forcibly removes any previous installation and the plex directory; creates a fresh one owned by root; and changes plex to be the owner so it can operate again.

There is one other possibility (rare) but will address that if you are still unable to start.

2 Likes

@ChuckPa Thanks for all the help. I have marked my comments with [gyan]

Check for the existence and permissions: ls -la /var/lib/plexmediaserver
[gyan] Checked.It exists and plex user is owner and there a+x perms set for it.

Check for the existence of user plex: grep plex /etc/passwd
[gyan] user plex exists.

Check for the existence of group plex: grep plex /etc/group
[gyan] group plex exists.

For reasons not clear to me (I work on the install scripts), some Ubuntu systems do not like the installation script. This having been said, if there was a previous installation of Plex (user plex already exists), things don’t always go properly.

If user plex has existed in the past, perhaps having its home directory modified (changed) in /etc/passwd and/or directory /var/lib/plexmediaserver isn’t owned by user plex (the current UID & GID) then the error you see occurs.

[gyan] I did a fresh Ubuntu install and then plex install. If it’s easy I can do that again. Just let me know.

Here is the procedure to re-establish Plex’s home directory and allow the Library to initialize. This presumes user plex and group plex exist. If they do not, let me know and we’ll correct that.

sudo rm -rf /var/lib/plexmediaserver
sudo mkdir /var/lib/plexmediaserver
sudo chown plex:plex /var/lib/plexmediaserver

This forcibly removes any previous installation and the plex directory; creates a fresh one owned by root; and changes plex to be the owner so it can operate again.

There is one other possibility (rare) but will address that if you are still unable to start.
[gyan] I performed all the steps. the start didn’t wok. I also did - sudo apt-get update. the start didn’t work. The error I am getting is

Failed to start plexmediasever.service: Unit plexmediasever.service not found.

ok… when the service file is not found, dpkg did not like what happened.

I forget the command option… you want to remove and purge plexmediaserver

EDIT: dpkg -p plexmediaserver

@ChuckPa said:
ok… when the service file is not found, dpkg did not like what happened.

I forget the command option… you want to remove and purge plexmediaserver

EDIT: dpkg -p plexmediaserver

More errors
dpkg-query: package ‘plexmediaserver:i386’ is not available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.

Should i reinstall?

Before you do, let’s manually remove any residual presence of Plex.

sudo userdel -r -f plex
sudo groupdel plex
sudo rm -rf /var/lib/plexmediaserver

Now the user plex, the group plex, and its home directory are completely gone.

sudo dpkg -i plexmediaserver........ dpkg (use the appropriate package name)

@ChuckPa Didn’t work. Looking at other threads like http://askubuntu.com/questions/766485/how-to-set-up-plexmediaserver-in-ubuntu-16-04, looks like plex on ubuntu 16.04 is untested scenario for the package on plex site.

Should I move to previous version of Ubuntu?

Ubuntu made a change to their OS. I made the correction to fix what they broke… I and many others have Ubuntu 16.04 running Plex 64-bit without issue.

I now need information about your installation

uname -a
cat /etc/os-release

As additional information, your Ubuntu should show this:

chuck@udummy:~$ uname -a
Linux udummy 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
chuck@udummy:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
chuck@udummy:~$

I also need to see the results of ls -la /etc/systemd/system/plexmediaserverv*

1 Like

Process: 1277 ExecStart=/bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver /usr/lib/plexmediaserver/Plex\ Media\ Server (code=exited, status=127)

Maybe it’s just me, but I would like to see the output of

ls -al /usr/lib/plexmediaserver

@ChuckPa said:

If the difficulty was only because the service did not starting and you with the server to start automatically with each system boot:

sudo systemctl enable plexmediaserver

(Ubuntu 16 uses systemd instead of init. init is now obsolete.)

It’s easier to type service that systemctl. They produce the same output as service IS systemctl in Ubuntu 16. Sorry if this is wrong to you.

@aschmidtm said:
Process: 1277 ExecStart=/bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver /usr/lib/plexmediaserver/Plex\ Media\ Server (code=exited, status=127)

Maybe it’s just me, but I would like to see the output of

ls -al /usr/lib/plexmediaserver

@ChuckPa said:

If the difficulty was only because the service did not starting and you with the server to start automatically with each system boot:

sudo systemctl enable plexmediaserver

(Ubuntu 16 uses systemd instead of init. init is now obsolete.)

It’s easier to type service that systemctl. They produce the same output as service IS systemctl in Ubuntu 16. Sorry if this is wrong to you.

First, You are right to pick that nit. The word ‘obsolete’ was incorrect. I spend a great deal of time helping people try to install Plex who just installed Linux for the first time as well. On some systems, such as Fedora, the service script is minimalist at a mere 3K bytes. Trying to use it for Plex returns the following:

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[chuck@lizum ~.102]$

That said, not only do I help with Plex, I am also teaching Linux for a number of users. With 13 different versions/flavors of Linux in my head and VMs because that’s what’s used by Plex users, I do sometimes choose ‘less than optimal’ words.

To share with you my diagnosis strategy, based on what I have seen in the vast majority of cases on both desktops and NAS units

a) Make sure PMS is getting a clean and proper installation (most common)
b) That failing, make certain the correct version of PMS for that platform is being installed
c) With the correct version for the platform having been installed, determine what other system-local conditions exist (systemd overrides, moved default user directory, etc).

As I’m sure you’re aware, /etc/systemd/system/plexmediaserver.service is the unit-level override. /etc/systemd/system/plexmediaserver.service.d/override.conf is the service environment override of the service definition in /usr/lib/systemd/system/plexmediaserver.service.

The two schools of thought in Linux are the Redhat school and the Canonical school. Who’s correct doesn’t matter. The fact both exist is a literal ‘pain in the backside’ to me.

I lead the effort to unify all PMS systems using systemd to a unified service definition file and use of the override file for sustainable customization for users. No more /etc/default/plexmediaserver on some, /etc/defaults/PlexMediaServer on others, and a dozen other places, all of which sprang from the lack of discipline in the init days. It had become too difficult for the Ninjas to support the different variants. The goal was simple:

  1. The PMS installer and dpkg/yum/dnf are in full control of plexmediaserver.service. Any customization there is subject to actions taken by the package control tools
  2. Provide the users with an enduring mechanism to customize PMS’s runtime environment but maintain independence from the core PMS software startup and service operational definitions.

Therefore, we decided:

  1. /usr/lib/systemd/system/plexmediaserver.service will be the the authority as so stated in systemd source.
  2. /etc/systemd/system/plexmediaserver.service.d/override.conf will be where users can customize (override) those things which concern them (User, Group, and Library location)
  3. All previous customization files (/etc/defaults, etc) would be untouched for users to refer to as needed.

What this leaves all of us is:

  1. Users have one place to make all their modifications to how PMS starts
  2. The Ninjas have a common starting point for determining what happening on Linux.

Clean, Simple, and most importantly, Predictable.

Back to diagnosis, after establishing the we have proper package and system, I will need to see the journal output (all the logging got moved to and is a pain) and what journalctl has to say (that’s ONE command i hate typing)

@ChuckPa and @aschmidtm
First off, Thanks a lot for your responses.

Here is the info you asked for
gyan@funmachine:~$ uname -a
Linux funmachine 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

gyan@funmachine:~$ cat /etc/os-release
NAME=“Ubuntu”
VERSION=“16.04.1 LTS (Xenial Xerus)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=“Ubuntu 16.04.1 LTS”
VERSION_ID=“16.04”
HOME_URL=“http://www.ubuntu.com/
SUPPORT_URL=“http://help.ubuntu.com/
BUG_REPORT_URL=“http://bugs.launchpad.net/ubuntu/
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

@aschmidtm see the attached file for the output of ls -al /usr/lib/plexmediaserver

@ChuckPa said:
As additional information, your Ubuntu should show this:

chuck@udummy:~$ uname -a
Linux udummy 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
chuck@udummy:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
chuck@udummy:~$

I also need to see the results of ls -la /etc/systemd/system/plexmediaserverv*

out put for ls -la /etc/systemd/system/plexmediaserver* is
-rw-r–r-- 1 root root 759 Jan 27 21:24 /etc/systemd/system/plexmediaserver.service

@gyantrivedi

Would you please cat /etc/systemd/system/plexmediaserver.service ?

Now we need to determine if your installation is pointing to some other location other than the default in /var/lib.

Has there ever been a PMS installed on this system?

@ChuckPa
out put of the cat /etc/systemd/system/plexmediaserver.service is below. Looks like the install is pointing to /usr/lib/plexmediaserver

[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
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=user
Group=group
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target