If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Ubuntu moved to systemd - no .service and unable to start

torqueingtorqueing Posts: 7Members

I did a dist-upgrade and as planned Ubuntu moved its init daemon on 15.04 from upstart to systemd. Anyway, now plex won't start and I'm pretty sure it's because there isn't a .service for systemctl to start: 

george@leviathan:~$ ls /lib/systemd/system/ | grep pl
plymouth-halt.service
plymouth-kexec.service
plymouth-poweroff.service
plymouth-quit.service
plymouth-quit-wait.service
plymouth-read-write.service
plymouth-reboot.service
plymouth-start.service
plymouth-switch-root.service
systemd-ask-password-plymouth.path
systemd-ask-password-plymouth.service
wpa_supplicant.service

I am unsure whether this is a plex problem or an ubuntu update problem, the script is still in init.d: 

george@leviathan:~$ ls /etc/init.d/ | grep plex
plexmediaserver

As I usually use Gentoo and believe that systemd should eat **** and die I have no clue how it works so I can't really fix it, sorry.

Tagged:
«134

Comments

  • torqueingtorqueing Posts: 7Members

    Ok, figured out from the init script in another thread I just had to manually do 

    /usr/sbin/start_pms &
    

    It's quite useful actually for seeing what isn't being added to the library. You might want to add this to suggestions...

  • joelbloomerjoelbloomer Posts: 7Members, Plex Pass Plex Pass
    The latest version of the Ubuntu operating system for desktop PCs and laptops, Ubuntu 14.10 comes with nine months of security and maintenance updates.

    So you're on a pre-release version?

  • torqueingtorqueing Posts: 7Members
    joelbloomer wrote on March 18 2015, 2:08 AM: »

    So you're on a pre-release version?

    I am. 15.04 Vivid Vervet. Testing for problems like this is the whole point :)

    The Monday update switched the init system from upstart to systemd

  • trudgetrudge Posts: 2,329Members, Plex Pass Plex Pass
    torqueing wrote on March 18 2015, 9:36 AM: »

    I am. 15.04 Vivid Vervet. Testing for problems like this is the whole point :)

    only once the apps themselves are systemd enabled, until then all you are testing is your ability to manually hack stuff together.

  • redxonredxon Posts: 64Members, Plex Pass Plex Pass
    edited March 2015

    Strange, I switched to systemd a while ago (because 14.10 had a NFS mounting bug with upstart) and had no problems. Everything was aparently adapted automaticly because my plex service started automaticly and even after updates it works just fine. I just did the switch by doing an apt-get install systemd (which uninstalled upstart by itself).

    So strange that it aparently doesn't work, if you do the update to 15.04 (or do a fresh install, whatever you did.)

    Edit:

    But it might aswell be, that Webmin did something in the background I was not aware of. All I know is, that it works... But anyway, now that ubuntu is changing to systemd it's just a matter of time before the Plex client also supports systemd. I mean they could for example just implement a script in the installer, which checks if systemd or upstart is installed (as you can/should not have both installed at the same time.)

  • perplex0rdperplex0rd Posts: 9Members, Plex Pass Plex Pass
    torqueing wrote on March 18 2015, 1:07 AM: »

    Ok, figured out from the init script in another thread I just had to manually do 

    /usr/sbin/start_pms &
    

    It's quite useful actually for seeing what isn't being added to the library. You might want to add this to suggestions...

    Sorry, could you explain for me a little further? I'm in the same situation and still can't figure it out.

  • torqueingtorqueing Posts: 7Members
    perplex0rd wrote on March 19 2015, 4:27 PM: »

    Sorry, could you explain for me a little further? I'm in the same situation and still can't figure it out

    Open a terminal and type 

    /usr/sbin/start_pms &

     

    What the problem is is that the script to start PMS at boot isn't converted to a systemd script when upstart is removed and systemd-sysv is installed. The above command starts PMS manually so you can go to http://localhost:32400/and configure your server. Until Plex add a systemd script to their Ubuntu installation then this will continue to happen.

  • torqueingtorqueing Posts: 7Members
    Bob Snot wrote on March 19 2015, 1:40 PM: »

    only once the apps themselves are systemd enabled, until then all you are testing is your ability to manually hack stuff together.

    I'm sure the way systemd is taking over Linux it's only a matter of time until Plex is actually part of it...

  • freelancrfreelancr Posts: 1Members, Plex Pass Plex Pass

    Hi,

    as pointed out by UrbanLegend (https://forums.plex.tv/topic/152214-systemd-service-file-for-ubuntu-package/),

    I just took the service file from the Fedora rpm:

    # vi /etc/systemd/system/plexmediaserver.service

    [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
     
     
    after creating the file:
     
    # systemctl enable plexmediaserver.service
     
    and 
     
    # systemctl start plexmediaserver.service
     
    Everything works fine. Plex autostarts after reboot too.
     
     
  • fredlinuxfredlinux Posts: 1Members
    edited April 2015

    I had to change the group to 'nogroup' 

    # cat /etc/passwd | grep plex     
    plex:x:114:65534::/var/lib/plexmediaserver:/bin/bash

     
    # cat /etc/group | grep 65534     
    nogroup:x:65534:

     
    [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_SU
    PPORT_DIR}"'
    ExecStart=/bin/sh -c '/usr/lib/plexmediaserver/Plex\ Media\ Server'
    Type=simple
    User=plex
    Group=nogroup
    Restart=on-failure
    RestartSec=5
    StartLimitInterval=60s
    StartLimitBurst=3
     
    [Install]
    WantedBy=multi-user.target
  • ronnietuckerronnietucker Posts: 2Members, Plex Pass Plex Pass
    edited April 2015

    I tried the above idea (creating the service file) but on running systemctl I got the error:

    Synchronizing state for plexmediaserver.service with sysvinit using update-rc.d... 
    Executing /usr/sbin/update-rc.d plexmediaserver defaults
    initctl: Name "com.ubuntu.Upstart" does not exist
    The script you are attempting to invoke has been converted to an Upstart
    job, but lsb-header is not supported for Upstart jobs.
    insserv: warning: script 'plexmediaserver' missing LSB tags and overrides
    insserv: Default-Start undefined, assuming empty start runlevel(s) for script `plexmediaserver'
    insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `plexmediaserver'
    insserv: fopen(.depend.stop): Permission denied
    Executing /usr/sbin/update-rc.d plexmediaserver enable

    Any ideas?   :(


    UPDATE:

    Turns out that the plexmediaserver symlink is causing that error. So, after you've saved the service file do:

    systemctl daemon-reload

    then:

    sudo rm /etc/init.d/plexmediaserver

    Start Plex with:

    service plexmediaserver start

    Voila!

  • nikhaunikhau Posts: 27Members, Plex Pass Plex Pass

    Yesterday I did the update to Ubuntu 15.04 and after that Plex server refuses to start.

    I receive messages that Can not connect to Upstart when trying to start manually.

    I will try the suggestions in this thread and report back.

    PMS: Ubuntu Server 15.04 on P4 3.2GHz 4GB

    Plex Client for Samsung on UE46D6200

    Plex for Android: Galaxy S2 (CM12.1), Asus Transformer Prime TF201 (KatKiss 5.1.1), and SoftwinerEvb (stock 4.1.1)

    Google Chromecast

    Would like a native Sailfish version of Plex for my Jolla

  • SuperSluetherSuperSluether Posts: 30Members ✭✭

    An easy solution I found was to run "start_pms" in a terminal. Just add it as a startup task, and Plex will start running when you log in, which isn't too different from a service.

    Finding Information,
    Passing it Along

  • mrhappy5mrhappy5 Posts: 16Members ✭✭

    Ok, I did the upgrade to 15.04 and the PMS service now doesn't start.  I get the upstart/systemd thing, so I running "/usr/sbin/start_pms &" at the terminal gets me up and running, for now.  I'll read and figure out how to make this automatic and permanent later... or wait for Plex to fix their script.

    However, since the upgrade I have lost all my channels and media libraries in PMS.

    Forgive me, I know this question doesn't belong in this thread, but it's slightly annoying (and yes it's probably Ubuntu's problem, not Plex), but should this happen and can I restore my previous preferences without having to set everything up again?

    Cheers  :wacko:

  • usalabsusalabs Posts: 19Members Plex Pass
    edited April 2015

    If possible try using sysvinit, by appending this to the boot params:-

    init=/sbin/sysvinit       then reboot.

    then plex server can be run by using this command:-

    sudo /etc/init.d/plexmediaserver start

    and stopped using this command:-

    sudo /etc/init.d/plexmediaserver stop

    Otherwise using systemd plex server would have to be switched to systemctl by using:-

    service plexmediaserver start/stop/status

    I forget,,,,if you're using sysvinit, then plex server can be added to the autorun on boot, by running (as root) chkconfig -a plexmediaserver which will autorun at boot on both runlevel 3 and 5, but to do this, run plex server first, like this:-

    ~>$ sudo /etc/init.d/plexmediasever start
     
    ~>$ sudo -s
     
    ~># chkconfig -a plexmediaserver
     
    ~># exit
     
    ~>$
    
  • rodalphoidrodalphoid Posts: 36Members, Plex Pass ✭✭

    I just ran into this, and none of the suggestions in this thread worked. This reddit comment worked perfectly, however.

    http://www.reddit.com/r/linux/comments/2y4pwm/ubuntu_to_switch_to_systemd_next_monday_brace_for/cp75472

  • nikhaunikhau Posts: 27Members, Plex Pass Plex Pass

    Creating the file as suggested by freelancr (same as rodalphio links to) with the update from ronnietucker made the server kick back with all libraries intact. Hopefully Plex will bring an update shortly fixing this.

    PMS: Ubuntu Server 15.04 on P4 3.2GHz 4GB

    Plex Client for Samsung on UE46D6200

    Plex for Android: Galaxy S2 (CM12.1), Asus Transformer Prime TF201 (KatKiss 5.1.1), and SoftwinerEvb (stock 4.1.1)

    Google Chromecast

    Would like a native Sailfish version of Plex for my Jolla

  • grahammitchellgrahammitchell Posts: 3Members Plex Pass
    nikhau wrote on April 25 2015, 7:50 AM: »

    Creating the file as suggested by freelancr (same as rodalphio links to) with the update from ronnietucker made the server kick back with all libraries intact. Hopefully Plex will bring an update shortly fixing this.

    Just upgraded to Vivid Vervet this morning, and these steps worked for me, too. Thanks!

  • mkdrmkdr Posts: 88Members ✭✭

    How do I do this for Ubuntu?

  • bradleywhbradleywh Posts: 5Members
    freelancr wrote on March 19 2015, 7:23 PM: »

    Hi,

    as pointed out by UrbanLegend (https://forums.plex.tv/topic/152214-systemd-service-file-for-ubuntu-package/),

    I just took the service file from the Fedora rpm:

    # vi /etc/systemd/system/plexmediaserver.service

    [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
     
     
    after creating the file:
     
    # systemctl enable plexmediaserver.service
     
    and 
     
    # systemctl start plexmediaserver.service
     
    Everything works fine. Plex autostarts after reboot too.

    When i try this soloution i get the following error.


       Loaded: loaded (/etc/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
       Active: failed (Result: start-limit) since Sun 2015-04-26 12:46:32 BST; 9s ago
      Process: 2551 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=1/FAILURE)

    Any ideas on how to fix this?

«134
Sign In or Register to comment.