Jump to content

restart emby does not work from web page


robfantini

Recommended Posts

robfantini

from /var/lib/emby-server/logs

2015-11-28 08:56:23.1316 Error - HttpServer: Error this.ProcessRequest(context)(Exception while writing error to the response)
        *** Error Report ***
        Version: 3.0.5781.3
        Command line: /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
        Operating system: Unix 4.2.3.2
        Processor count: 16
        64-Bit OS: True
        64-Bit Process: True
        Program data path: /var/lib/emby-server
        Mono: 4.0.3 (Stable 4.0.3.20/d6946b4 Wed Aug 19 11:59:01 UTC 2015)
        Application Path: /usr/lib/emby-server/MediaBrowser.Server.Mono.exe
        The object was used after being disposed.
        System.ObjectDisposedException
          at SocketHttpListener.Net.HttpListenerResponse.set_StatusCode (Int32 value) [0x00000] in <filename unknown>:0 
          at MediaBrowser.Server.Implementations.HttpServer.SocketSharp.WebSocketSharpResponse.set_StatusCode (Int32 value) [0x00000] in <filename unknown>:0 
          at MediaBrowser.Server.Implementations.HttpServer.HttpListenerHost.ErrorHandler (System.Exception ex, IRequest httpReq) [0x00000] in <filename unknown>:0 

when restart is attempted the web page hangs.

 

restart from cli works.

Link to comment
Share on other sites

robfantini

thank you for the fast response.... I'll check the notes at the link.

 

docker is not same as lxc . however the permissions in the docker script sould fix the issue..

 

I have a question ,  in the docker install script, where are the vales for MB_USER_ID  and  MB_GROUP_ID  set?

 

# Adjust UID and GID of nobody with environmet variables

 

USER_ID=${MB_USER_ID:-99}

 

GROUP_ID=${MB_GROUP_ID:-100}

Edited by robfantini
Link to comment
Share on other sites

hurricanehrndz

Not the same, but it is still a containerized technology of sort if I'm not mistaken. It's not a permission issue. Emby uses an init system in order to achieve restart. For our docker container we use runsv. You might need to edit the script and ensure the sudoers file is adjust accordingly. 

 

MB_USER_ID and MB_GROUP_ID are set from a docker run command. The docker run command lets you can pass environment variables to the containerized environment.

Edited by hurricanehrndz
Link to comment
Share on other sites

robfantini

Still working on this..

 

== sudoers==

I tested with  this in /etc/sudoers.d/emby  ,  and still could not restart from webpage , so it is not a sudoers issue,  this allows the user to do anything without a password:

emby ALL=(ALL) NOPASSWD: ALL

So I put back that file to original.

 

emby works fine except for the restart issue

 

== init ==

The lxc system is  close to a regular debian jessie system.  

 

systemd is used  .   I think that is different then runsv ?

 

The init script works for root.   I assume the restart button on web page runs /etc/init.d/emby-server  ?

Link to comment
Share on other sites

hurricanehrndz

If your lxc conatiner is using systemd then the init system should be systemd. So I would  adjust the sudoers to something  like so: 

emby ALL=(ALL) NOPASSWD: /bin/systemctl restart emby-server.service

The restart button runs the restart script, found in /var/lib/emby-server. The restart script has not been written for systemd. You will need to write one yourself. Something along the lines of this.

sudo systemctl restart emby-server
Edited by hurricanehrndz
Link to comment
Share on other sites

robfantini

 

 

 

per post #2 the script is:  

/usr/lib/emby-server/restart.sh:

#!/bin/sh

/usr/bin/sudo service emby-server restart

that script works from cli  so the issue is not due to the type on init system [  I think  ].

 

 

when the restart hangs on web page this shows at cli


ps -ef
# right when button is pushed:
emby     29445     1  0 15:48 ?        00:00:00 /bin/sh /usr/lib/emby-server/restart.sh -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
root     29446 29445  0 15:48 ?        00:00:00 /usr/bin/sudo service emby-server restart
root     29447 29446  0 15:48 ?        00:00:00 /bin/sh /etc/init.d/emby-server restart
root     29465 29447  0 15:48 ?        00:00:00 /bin/sh /etc/init.d/emby-server start
root     29469 29465  0 15:48 ?        00:00:00 su -s /bin/sh -c exec "$0" "$@" emby -- env MONO_THREADS_PER_CPU=100 MONO_GC_PARAMS=nursery-size=64m /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
emby     29481 29469  0 15:48 ?        00:00:01 /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh

#a couple of minutes later:
root     29469     1  0 15:48 ?        00:00:00 su -s /bin/sh -c exec "$0" "$@" emby -- env MONO_THREADS_PER_CPU=100 MONO_GC_PARAMS=nursery-size=64m /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
emby     29481 29469  0 15:48 ?        00:00:10 /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh


so the restart hangs running   /etc/init.d/emby-server  .

 

Also during install the same thing happened ...   when  emby-server tried to start it hung. Probably same issue..

 

So the init script works as root, not   as  emby .  

 

Do you think the init script needs changes?

Edited by robfantini
Link to comment
Share on other sites

hurricanehrndz

per post #2 the script is:  

/usr/lib/emby-server/restart.sh:

#!/bin/sh

/usr/bin/sudo service emby-server restart

that script works from cli  so the issue is not due to the type on init system [  I think  ].

 

 

when the restart hangs on web page this shows at cli


ps -ef
# right when button is pushed:
emby     29445     1  0 15:48 ?        00:00:00 /bin/sh /usr/lib/emby-server/restart.sh -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
root     29446 29445  0 15:48 ?        00:00:00 /usr/bin/sudo service emby-server restart
root     29447 29446  0 15:48 ?        00:00:00 /bin/sh /etc/init.d/emby-server restart
root     29465 29447  0 15:48 ?        00:00:00 /bin/sh /etc/init.d/emby-server start
root     29469 29465  0 15:48 ?        00:00:00 su -s /bin/sh -c exec "$0" "$@" emby -- env MONO_THREADS_PER_CPU=100 MONO_GC_PARAMS=nursery-size=64m /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
emby     29481 29469  0 15:48 ?        00:00:01 /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh

#a couple of minutes later:
root     29469     1  0 15:48 ?        00:00:00 su -s /bin/sh -c exec "$0" "$@" emby -- env MONO_THREADS_PER_CPU=100 MONO_GC_PARAMS=nursery-size=64m /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
emby     29481 29469  0 15:48 ?        00:00:10 /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh


so the restart hangs running   /etc/init.d/emby-server  .

 

Also during install the same thing happened ...   when  emby-server tried to start it hung. Probably same issue..

 

So the init script works as root, not   as  emby .  

 

Do you think the init script needs changes?

 

 

Don't see the stop command? Please install the dev package and see if it is the same issue. 

Link to comment
Share on other sites

robfantini

> Don't see the stop command? Please install the dev package and see if it is the same issue.

 

Actually the 'stop' part of restart was done,   that happened fast so the ps output was a second after pressing the restart in web page..

 

could you  please point me to info on dev package install? 

 

 

PS: for some unknown reason  - restart button is actually restarting emby.   where before it was not...  here is log output showing no error:

2015-11-30 07:56:24.0407 Info - Main: Emby
        Command line: /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
        Operating system: Unix 4.2.3.2
        Processor count: 16
        64-Bit OS: True
        64-Bit Process: True
        Program data path: /var/lib/emby-server
        Mono: 4.0.3 (Stable 4.0.3.20/d6946b4 Wed Aug 19 11:59:01 UTC 2015)
        Application Path: /usr/lib/emby-server/MediaBrowser.Server.Mono.exe
2015-11-30 07:56:24.2769 Info - App: Application version: 3.0.5781.3


The following is normal process I think as emby is running.  note the 'restart'  in 1-st line had me think that the restart process was stuck.  it was not..  I should have checked logs after making changes , not just the restart process :

# ps afx|grep emby-server |  grep -v grep
13896 ?        S      0:00 su -s /bin/sh -c exec "$0" "$@" emby -- env MONO_THREADS_PER_CPU=100 MONO_GC_PARAMS=nursery-size=64m /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh
13908 ?        Ssl    0:56  \_ /usr/bin/mono-sgen /usr/lib/emby-server/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -restartpath /usr/lib/emby-server/restart.sh

Probably one of these added to /etc/sudoers.d/emby helped ...   If i get a chance will try reversing some to see if I can recreate the no restart issue:

# I think juse these 2 were added:
emby ALL=(ALL) NOPASSWD:  /usr/bin/mono-sgen
emby ALL=(ALL) NOPASSWD: /usr/lib/emby-server/restart.sh

# this is the rest of file:
emby ALL=(ALL) NOPASSWD: /usr/sbin/service emby-server *
emby ALL=(ALL) NOPASSWD: /usr/lib/emby-server/MediaBrowser.Server.Mono.exe
#Allow the server to mount iso images
emby ALL=(ALL) NOPASSWD: /bin/mount
emby ALL=(ALL) NOPASSWD: /bin/umount
Defaults:emby !requiretty

Edited by robfantini
Link to comment
Share on other sites

hurricanehrndz

Make sure restart.sh is executable,  I was just testing it on some packages I'm building and it wasn't. That could have been a mistake introduce in the last couple of releases.

Link to comment
Share on other sites

  • 1 month later...

Hello and first Happy New Year for all ;)

 

After install the stable package on fresh Stretch, /usr/lib/emby-server/restart.sh has root:root 755 rights.

And i confirm that emby-server stop after click on 'restart button' from web page !

 

I don't understand this line in restart.sh :

restart_cmds=("/bin/s6-svc -t /var/run/s6/services/${NAME}"

In Debian Stretch 's6-svc' command is non existent, and the same for the directory '/var/run/s6', maybe the hole.

 

...Mana...

Link to comment
Share on other sites

hurricanehrndz

Hello and first Happy New Year for all ;)

 

After install the stable package on fresh Stretch, /usr/lib/emby-server/restart.sh has root:root 755 rights.

And i confirm that emby-server stop after click on 'restart button' from web page !

 

I don't understand this line in restart.sh :

restart_cmds=("/bin/s6-svc -t /var/run/s6/services/${NAME}"

In Debian Stretch 's6-svc' command is non existent, and the same for the directory '/var/run/s6', maybe the hole.

 

...Mana...

s6-svc is a binary used in our docker images to monitor the emby server process. 

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...