12

I can install it but it can't see my files. I believe It's a permission issue because plexmediaserver is run by 'plex' user. In Ubuntu 14.04, I could edit /etc/default/plexmediaserver so that it would be run by me. It's doesn't seem to work in 16.04 (because systemd ?).

I've tried http://www.htpcguides.com/install-plex-media-server-ubuntu-16-x-and-later/, with the debian source or with the deb. I can't seem to start the service ..

[user@machine]:[~] $  sudo systemctl start plexmediaserver.service
Job for plexmediaserver.service failed because the control process exited with error code. See "systemctl status plexmediaserver.service" and "journalctl -xe" for details.
[user@machine]:[~] $ systemctl status plexmediaserver.service
● 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
           └─local.conf
   Active: inactive (dead) (Result: exit-code) since lun. 2016-05-02 18:58:40 CEST; 34s ago
  Process: 2784 ExecStart=/bin/sh -c /usr/lib/plexmediaserver/Plex\ Media\ Server (code=exited, status=139)
  Process: 2779 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
 Main PID: 2784 (code=exited, status=139)

mai 02 18:58:35 machine systemd[1]: plexmediaserver.service: Unit entered failed state.
mai 02 18:58:35 machine systemd[1]: plexmediaserver.service: Failed with result 'exit-code'.
mai 02 18:58:40 machine systemd[1]: plexmediaserver.service: Service hold-off time over, scheduling restart.
mai 02 18:58:40 machine systemd[1]: Stopped Plex Media Server for Linux.
mai 02 18:58:40 machine systemd[1]: plexmediaserver.service: Start request repeated too quickly.
mai 02 18:58:40 machine systemd[1]: Failed to start Plex Media Server for Linux.
mai 02 18:59:02 machine systemd[1]: plexmediaserver.service: Start request repeated too quickly.
mai 02 18:59:02 machine systemd[1]: Failed to start Plex Media Server for Linux.

1 Answers1

24

Plex Media Server on Ubuntu 16.04LTS (only for Plex-Pass free Downloads)

init.d is legacy so forget /etc/default/plexmediaserver because its ignored. Instead use systemctl.

Setting it up; add the repo for “automatic” updates:

echo deb https://downloads.plex.tv/repo/deb ./public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
sudo apt update
sudo apt install plexmediaserver -y

To avoid permission problems run the server as your standard user, replace “plex” with your user and group in:

sudo nano /etc/systemd/system/plexmediaserver.service

If this file is empty, paste the following into the file.

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

[Install]
WantedBy=multi-user.target

Now also change the ownership of the next subdir to your user!

sudo chown -R user:group /var/lib/plexmediaserver
sudo systemctl --system daemon-reload
sudo service plexmediaserver start

Now you can set up your pms.

David Foerster
  • 36,900
  • 56
  • 98
  • 152
corvales
  • 264
  • Awesome, it worked ! Thanks !! Note: not sure sudo systemctl --system daemon-reload && sudo service plexmediaserver start made Plex ran as my user (cf ps aux | grep plex), so I made a reboot and it did the trick. – user2287453 May 13 '16 at 17:18
  • 1
    I had issues with a fresh 16.04 install with PMS 1.0.3. Turns out, my /etc/systemd/system/plexmediaserver.service was blank. I assigned the user as my username and my group as my group to the config file as well as the var/lib/plexmediaserver dir. Worked very well. I did not need to reboot, just restart the service. – Manuel J. Diaz Aug 26 '16 at 01:14
  • 2
    Ubuntu 16.10 here, the /etc/... path did not exits. Using locate plexmediaserver.service, it found it under /lib/systemd/system/plexmediaserver.service. Changing the user&group here and restarting the service worked like a charm! – Alex Tartan Nov 19 '16 at 19:29
  • 1
    I don't think this answer is right anymore, since it looks like the Plex people reorganised their website and unfortunately got rid of the apt repo: E: Failed to fetch https://downloads.plex.tv/repo/deb/dists/public/main/binary-amd64/Packages Received HTTP code 403 from proxy after CONNECT – happyskeptic Feb 28 '17 at 11:30
  • did not worked .. plex is a shame to install on linux .. sometimes it works, sometimes not. tired of plex-bugs. going to emby, looks like shit, but at least they know how to program – snickers2k Aug 05 '17 at 14:03
  • thanks , i make user and group of plexmediaserver.service root that's help me for deleting was not working before – Mikel Tawfik Oct 15 '21 at 00:42