Jump to content

New Emby init.d script Not Working?


ilikerolls
Go to solution Solved by curtisghanson,

Recommended Posts

ilikerolls

Has anyone tried the init.d script on Ubuntu 14.04 yet?  I don't think I have ever gotten one of these init.d scripts to work without modifications, but this new one changed a lot.

 

And from the command prompt I just get and of course PID 3783 will not exist afterwords

sudo emby-server start

  emby-server start/running, process 3783​

 

 

This is all I get in the syslog

 

Aug 13 13:03:13 CRACKHEADGDK /proc/self/fd/9: DEBUG: EMBYSERVER='/usr/lib/emby-server/emby-server'#012EMBY_BIN='/usr/lib/emby-server/MediaBrowser.Server.Mono.exe'#012EMBY_DATA='/var/lib/emby-server'#012EMBY_PATH='/usr/lib/emby-server'#012EMBY_PIDFILE='/var/run/emby-server.pid'#012EMBY_USER='emby'#012IFS=' #011#012'#012OPTIND='1'#012PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'#012PPID='1'#012PS1='# '#012PS2='> '#012PS4='+ '#012PWD='/'#012TERM='linux'#012UPSTART_INSTANCE=''#012UPSTART_JOB='emby-server'
Aug 13 13:03:13 CRACKHEADGDK kernel: [ 2690.725826] init: emby-server main process (3719) terminated with status 127
Aug 13 13:03:13 CRACKHEADGDK kernel: [ 2690.725836] init: emby-server main process ended, respawning
Aug 13 13:03:13 CRACKHEADGDK kernel: [ 2690.728713] init: emby-server post-stop process (3724) terminated with status 127​

Link to comment
Share on other sites

Latest Debian/Ubuntu package revision includes a totally revamped scripts also the path for Emby has changed from /opt to /usr/lib. I was about to do the announcement but it seems that the packages are already available. I will try to review the scripts in the coming days since I should integrate then into the rpm packages and come back with answers.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

curtisghanson

I am having this problem as well. I changed any reference from opt to usr/lib but that didn't do the trick. Is there something else I'm missing?

 

Aug 13 12:16:14 fiemedia /proc/self/fd/9: DEBUG: EMBYSERVER='/usr/lib/emby-server/emby-server'#012EMBY_BIN='/usr/lib/emby-server/MediaBrowser.Server.Mono.exe'#012EMBY_DATA='/var/lib/emby-server'#012EMBY_PATH='/usr/lib/emby-server'#012EMBY_PIDFILE='/var/run/emby-server.pid'#012EMBY_USER='emby'#012IFS=' #011#012'#012OPTIND='1'#012PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'#012PPID='1'#012PS1='# '#012PS2='> '#012PS4='+ '#012PWD='/'#012TERM='linux'#012UPSTART_INSTANCE=''#012UPSTART_JOB='emby-server'
Aug 13 12:16:14 fiemedia kernel: [ 4643.570227] init: emby-server main process (16590) terminated with status 127
Aug 13 12:16:14 fiemedia kernel: [ 4643.570237] init: emby-server main process ended, respawning
Aug 13 12:16:14 fiemedia kernel: [ 4643.573432] init: emby-server post-stop process (16595) terminated with status 127

Edited for clarification.

Edited by curtisghanson
Link to comment
Share on other sites

curtisghanson

So that was definitely a problem but it didn't fix it.

 

I tried uninstalling emby-server and ran into problems with the prerm and postrm files in:

/var/lib/dpkg/info/emby-server.prerm
/var/lib/dpkg/info/emby-server.postrm

So I updated them manually to the latest on Github: https://github.com/MediaBrowser/Emby.Build/tree/master/debian

 

That finally allowed the uninstall and purge to work.

 

I left my /usr/lib/emby-server directory alone so I wouldn't lose my data.

 

I reinstalled using:

$ sudo apt-get install emby-server

I got this error:

Warning: The home dir /usr/lib/emby-server you specified already exists.
Adding system user `emby' (UID 114) ...
Adding new user `emby' (UID 114) with group `emby' ...
The home directory `/usr/lib/emby-server' already exists.  Not copying from `/etc/skel'.
adduser: Warning: The home directory `/usr/lib/emby-server' does not belong to the user you are currently creating.

No biggie, I just updated the user group:

$ sudo chown -R emby:emby /usr/lib/emby-server

Tried it again:

$ sudo service emby-service start

Same error no luck:

Aug 13 12:54:47 fiemedia /proc/self/fd/9: DEBUG: EMBYSERVER='/usr/lib/emby-server/emby-server'#012EMBY_BIN='/usr/lib/emby-server/MediaBrowser.Server.Mono.exe'#012EMBY_DATA='/var/lib/emby-server'#012EMBY_PATH='/usr/lib/emby-server'#012EMBY_PIDFILE='/var/run/emby-server.pid'#012EMBY_USER='emby'#012IFS=' #011#012'#012OPTIND='1'#012PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'#012PPID='1'#012PS1='# '#012PS2='> '#012PS4='+ '#012PWD='/'#012TERM='linux'#012UPSTART_INSTANCE=''#012UPSTART_JOB='emby-server'
Aug 13 12:54:47 fiemedia kernel: [ 6958.184773] init: emby-server main process (19077) terminated with status 127
Aug 13 12:54:47 fiemedia kernel: [ 6958.184783] init: emby-server main process ended, respawning
Aug 13 12:54:47 fiemedia kernel: [ 6958.188215] init: emby-server post-stop process (19082) terminated with status 127

 

Edited for spelling.

 

 

Edited by curtisghanson
Link to comment
Share on other sites

I too had a bit of  trouble with the startup script. For a bit there I ran the server with 

bash ./emby-server.sh

That worked.

 

Did a..

 chmod +x emby-server.sh

...as suggested by Azor. Now the startup script is working again.

 

 

 

Also curtisghanson; if by ...

 

 

I left my /usr/lib/emby-server directory alone so I wouldn't lose my data.

 

... you mean metadata (art, actors etc). I do not think it lives in /usr/lib/ but in /var/lib/emby-server. At least your config, as it is now, seems to think that your metadata lives in /var. See:

 

'#012EMBY_DATA='/var/lib/emby-server'

 

Maybe a chown emby:emby for that folder would help?

 

 

 

Link to comment
Share on other sites

tehdartherer

 

 

So that was definitely a problem but it didn't fix it.

 

I tried uninstalling emby-server and ran into problems with the prerm and postrm files in:

/var/lib/dpkg/info/emby-server.prerm/var/lib/dpkg/info/emby-server.postrm
So I updated them manually to the latest on Github: https://github.com/MediaBrowser/Emby.Build/tree/master/debian

 

That finally allowed the uninstall and purge to work.

 

I left my /usr/lib/emby-server directory alone so I wouldn't lose my data.

 

I reinstalled using:

$ sudo apt-get install emby-server
I got this error:

Warning: The home dir /usr/lib/emby-server you specified already exists.Adding system user `emby' (UID 114) ...Adding new user `emby' (UID 114) with group `emby' ...The home directory `/usr/lib/emby-server' already exists.  Not copying from `/etc/skel'.adduser: Warning: The home directory `/usr/lib/emby-server' does not belong to the user you are currently creating.
No biggie, I just updated the user group:
$ sudo chown -R emby:emby /usr/lib/emby-server
Tried it again:
$ sudo service emby-service start
Same error no luck:

Aug 13 12:54:47 fiemedia /proc/self/fd/9: DEBUG: EMBYSERVER='/usr/lib/emby-server/emby-server'#012EMBY_BIN='/usr/lib/emby-server/MediaBrowser.Server.Mono.exe'#012EMBY_DATA='/var/lib/emby-server'#012EMBY_PATH='/usr/lib/emby-server'#012EMBY_PIDFILE='/var/run/emby-server.pid'#012EMBY_USER='emby'#012IFS=' #011#012'#012OPTIND='1'#012PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin'#012PPID='1'#012PS1='# '#012PS2='> '#012PS4='+ '#012PWD='/'#012TERM='linux'#012UPSTART_INSTANCE=''#012UPSTART_JOB='emby-server'Aug 13 12:54:47 fiemedia kernel: [ 6958.184773] init: emby-server main process (19077) terminated with status 127Aug 13 12:54:47 fiemedia kernel: [ 6958.184783] init: emby-server main process ended, respawningAug 13 12:54:47 fiemedia kernel: [ 6958.188215] init: emby-server post-stop process (19082) terminated with status 127
 

Edited for spelling.

 

 

 

Got the same problem.

Link to comment
Share on other sites

JoeyMuyo

I have had the same problem as everyone else here.

 

Tried setting chmod +x /usr/lib/emby-server/emby-server.sh but the init script still wouldn't load.

 

Running the script emby-server.sh works though. But it doesn't have any data from the old setup.

 

EDIT:

 

After actually looking at the DEBUG comment from syslog I did notice that EMBYSERVER is set as /usr/lib/emby-server/emby-server which doesn't exist.

 

Setting a symbolic link from /usr/lib/emby-server/emby-server.sh to /usr/lib/emby-server/emby-server got the service running as normal but once again without any of my old configuration or plugins.

 

Something has clearly gone a bit awry with the init script and this whole change of directory.

Edited by JoeyMuyo
Link to comment
Share on other sites

  • Solution
curtisghanson

@@moemoe

 

Thanks, I went ahead and gave ownership of the /var/lib/emby-server and /usr/lib/emby-server directories to emby:emby.

 

For whatever reason

$ sudo service emby-server start

and

$ sudo start emby-server

do not work.

 

But...

$ /etc/init.d/emby-server start

works like a champ.

 

I personally don't know enough about services to explain why it works this way and not the others. But I'm back up! Thanks everyone!

  • Like 1
Link to comment
Share on other sites

Running the init.d file for emby manually did the trick for me as well. Don't know enough about the changes and package structure to know why it is broken though...

Link to comment
Share on other sites

wtf - I did and apt-get update && apt-get upgrade tonight and it wiped out emby and all my settings.

my tvheadened and shit... not happy.

 

I'm thinking it did an update to emby, but it foobarred it. wiped it out and re-installed it.

Edited by freebs
Link to comment
Share on other sites

hurricanehrndz

The new package include upstartal and systemd services scripts. The problem sound like upstart tried to start the service and couldnt because of the initial start issue. So then upstart becomes unresponsive. Thank you all for your feedback. I will try and fix the issues with the post install scripts when I'm back in September. Unfortunately we had to move the installation location emby because of lintian. I have included upstart anf systemd service upon individuals request. If you restart the upstart scripts and service commands should work

 

Sent from my D6603 using Tapatalk

Link to comment
Share on other sites

JoeyMuyo

The new package include upstartal and systemd services scripts. The problem sound like upstart tried to start the service and couldnt because of the initial start issue. So then upstart becomes unresponsive. Thank you all for your feedback. I will try and fix the issues with the post install scripts when I'm back in September. Unfortunately we had to move the installation location emby because of lintian. I have included upstart anf systemd service upon individuals request. If you restart the upstart scripts and service commands should work

 

Sent from my D6603 using Tapatalk

 

Not to be a newbie but when you say restart the upstart scripts what do you exactly mean? 

Link to comment
Share on other sites

hurricanehrndz

I mean restart your machine, the upstart script should work. The upstart script is found in etc inti

 

Sent from my D6603 using Tapatalk

Link to comment
Share on other sites

ilikerolls

I mean restart your machine, the upstart script should work. The upstart script is found in etc inti

 

Sent from my D6603 using Tapatalk

 

I have tried restarting the machine several times.  The only way to get it to work is by running the init.d script directly like "/etc/init.d/emby-server start" or "cd /etc/init.d;./emby-server start", but "service emby-server start" would not work and the OS can't start it either.

Link to comment
Share on other sites

LongDono

I've had no luck getting it fixed.

 

I did this:

 

Thanks, I went ahead and gave ownership of the /var/lib/emby-server and /usr/lib/emby-server directories to emby:emby.

 

and 

longde@Crushinator:/etc/init.d$ sudo chmod +x /usr/lib/emby-server/emby-server.sh
 
And no luck. I've also tried a few other things that supposedly helped, with no luck.  I see, reading the whole thread, the starred post is not the fix, it is merely the last change they made, which means this isn't a simple fix for anyone else.  I'll try to follow-up with a complete list, assuming I get it working. 
 
longde@Crushinator:/etc/init.d$ ./emby-server start
 * Starting emby-server daemon
/usr/lib/emby-server/emby-server.sh: 91: /usr/lib/emby-server/emby-server.sh: cannot create /var/run/emby-server.pid: Permission denied
/usr/lib/emby-server/emby-server.sh: 92: /usr/lib/emby-server/emby-server.sh: cannot create /var/log/emby-server.log: Permission denied
   ...fail!
longde@Crushinator:/etc/init.d$ sudo ./emby-server start
 * Starting emby-server daemon
   ...fail!
Edited by LongDono
Link to comment
Share on other sites

LongDono
longde@Crushinator:/etc/init.d$ sudo bash ./emby-server start
 * Starting emby-server daemon
   ...done.

I uninstalled and reinstalled emby-server several times, changed permissions on several things.  Given how many things I've tried, it's hard to say what exactly it is that finally fixes it, but my best guess is the following will fix an existing configuration:

 

sudo chown emby:emby -R /usr/lib/emby-server/

sudo chown emby:emby -R /var/lib/emby-server/

sudo chmod +x /usr/lib/emby-server/emby-server.sh

sudo chown emby:emby /etc/emby-server.conf  

 

I noticed several directories had my username from the existing config and not the "emby" username; additionally I noticed the config file was owned by root, something I may have actually broken myself while trying to fix things.  In any case, at least for me, my existing Emby configuration is back from the brink.  When I saw the number of updates Ubuntu wanted to apply, I had a bad feeling and sure enough, it was true this time. :)

Edited by LongDono
Link to comment
Share on other sites

arussell

You can get the service commands working again by moving the upstart script:

sudo mv /etc/init/emby-server.conf /etc/init/emby-server.conf.disabled

You can then use the service commands to call the script in /etc/init.d (the service command tries upstart first, and then if it doesn't find a valid .conf file it tries sysvinit instead):

service emby-server start
Edited by arussell
Link to comment
Share on other sites

 

You can get the service commands working again by moving the upstart script:

sudo mv /etc/init/emby-server.conf /etc/init/emby-server.conf.disabled

You can then use the service commands to call the script in /etc/init.d (the service command tries upstart first, and then if it doesn't find a valid .conf file it tries sysvinit instead):

service emby-server start

This worked for me! Although it didn't allow emby to start on ubuntu 14.04 for me. I'm not good with start scripts but I did a little research and found a fix. I did this:

sudo update-rc.d emby-server defaults 99
  • Like 1
Link to comment
Share on other sites

HI,

 

i'm facing the same issue after upgrading my Ubuntu 14.04 server. Emby does not start up anymore but the Init.d command works.

 

Now i can start emby manually but i see the configuration is gone. Is there any way to get it back again?

Link to comment
Share on other sites

LongDono

The service commands are working now for me and it's continuing to use my existing configuration.

 

A final piece to this whole annoying thing is that Emby now uses the /etc/emby-server.conf as it's config file, so you'll need to edit that if you were using a different user.  By default, Emby will revert back to emby as the user name, and in my case, broke write access to the drives in order to write thumbnails, .nfo, etc.  Prior to finding that new config file, I could see all of the errors in the log (which hides under Help, which makes is not the most obvious place), I was going back to the previous /etc/init/emby-server.conf file and not understanding why there was a permissions error. 

 

As can be sometimes heard about a certain system at work, "Another successful update!"   ;)

Thanks to everyone for posting bits and pieces here to figure things out.

 

...Donovan

Edited by LongDono
Link to comment
Share on other sites

jpaytoncfd

On a brand new fresh install of Ubuntu 14.04.3 today upstart is not working and emby will not start normally. 

 

This fix required

  1. changing the ownership of /usr/lib/emby-server recursively to {USER}:{USER}
  2. chmod the emby-server.sh file to 775

After this the upstart seems to work. /usr/lib will require special permission where opt did not. If I knew more about the package install process I would try to help more but hopefully that will help who ever is maintaining it now. Its great to have upstart handeling the server. The auto restart will be helpful.

 

Copy and paste commands: ( you will have to change emby:emby if your not running emby as the user emby. )

sudo chown -R emby:emby /usr/lib/emby-server/
sudo chmod 775 /usr/lib/emby-server/emby-server.sh
Edited by jpaytoncfd
Link to comment
Share on other sites

Kiyoto_protocol

Hey All,

 

So I had issues after upgrading as well, and I think I found the root of the problem.

 

emby-server.conf in /etc/init/ was pointing EMBYSERVER=${EMBY_PATH}/${UPSTART_JOB} to /usr/lib/emby-server/emby-server as the startup script, when in fact it was called /usr/lib/emby-server/emby-server.sh

 

Looking at emby-server.sh, it referred to itself without the extension as well.

 

Renaming emby-server.sh to emby-server fixed that issue.

 

 

The startup file in /etc/init.d/ correctly points to emby-server.sh, so whether you remove the extension, or change the emby-server.conf to point to the file with the extension, you may want to change it.

 

It's the line: 

EMBYSERVER=${EMBY_PATH}/emby-server.sh

After solving that issue, I was getting the server setup wizard, which I thought was strange, but I had upgraded the server from mediabrowser to emby, so my data folder was at /var/lib/mediabrowser/ instead of /var/lib/emby-server/.

 

I just changed the line in /etc/emby-server.conf from:

EMBY_DATA="/var/lib/emby-server"
to:

EMBY_DATA="/var/lib/mediabrowser"

These steps, along with making sure the /usr/lib/emby-server/ is owned by the correct user and the /usr/lib/emby-server/emby-server script has the correct permissions, seems to have solved all my issues so far, allowing me to call the service commands and everything is back to normal.

 

Hope this helps someone to keep from pulling their hair out for 2 days like I did. Haha

Edited by Kiyoto_protocol
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...