Charlo 0 Posted March 2, 2017 Share Posted March 2, 2017 Hello, using the latest versions (if I mistake not from 3.2 onwards) of Emby on Debian Jessie, if I use the command "systemctl stop emby-server" Emby does not stop gracefully and "Main" process remains alive. The only way to stop Emby is killing the process with the "kill" command. This problem is related to how systemd stops the processes and probably in the last updates you have been changed the start script "/usr/bin/emby-server" or systemd unit configuration file "/lib/systemd/system/emby-server.service". Sorry for my bad English. Thank you for your wonderful work. Carlo Link to comment Share on other sites More sharing options...
Luke 37063 Posted March 2, 2017 Share Posted March 2, 2017 Hi, can you please provide the emby server log? You can learn how to do that here: https://emby.media/community/index.php?/topic/739-how-to-report-a-problem/ Thanks ! 1 Link to comment Share on other sites More sharing options...
gstuartj 39 Posted March 2, 2017 Share Posted March 2, 2017 (edited) It works fine for me. I also run on Debian Jessie with the latest updates. No leftover processes. Edited March 2, 2017 by gstuartj Link to comment Share on other sites More sharing options...
Luke 37063 Posted March 2, 2017 Share Posted March 2, 2017 Thanks @@gstuartj ! Link to comment Share on other sites More sharing options...
Charlo 0 Posted March 3, 2017 Author Share Posted March 3, 2017 (edited) Hi, can you please provide the emby server log? You can learn how to do that here: https://emby.media/community/index.php?/topic/739-how-to-report-a-problem/ Thanks ! Ok luke, this is my setup: Debian Jessie (OpenMediaVault 3) I installed Emby via the apt package manager from your default repository from which it was also installed mono. FFMPEG installed from the repositories of Debian backport Jessie (current version 3.2.4). The file system permissions are configured correctly. Data Directory is located in its default location "/ var / lib / emby-server". Outside the lan emby can be reached via nginx configured as proxy with ssl certificate issued from letsencrypt. This morning I tried removing and reinstalling Emby with the commands "apt-get purge emby-server", "reboot" and "apt-get install emby-server" but I have not solved; Emby always remains running. I attach the following files: - Last Emby log; - The output of the command "pstree" before and after execution of the command "systemctl stop emby-server"; - the output of "systemctl -l status emby-server" before and after execution of the command "systemctl stop emby-server". From the output of pstree please note that before "systemctl stop emby-server" "Main" process is regularly under "su" process. After after attempting to stop, "Main" process is directly connected to "systemd" process at top of the list.A very strange thing. Seems like systemd stops only the main process "su" but not the sub-processes that become orphans and remain active. Thanks for any help Carlo server-63624131992.txt pstree_pre_systemctl_stop_cmd.txt pstree_post_systemctl_stop_cmd.txt systemd_log_status_pre_stop_emby-server.txt systemd_log_status_post_stop_emby-server.txt Edited March 3, 2017 by Charlo Link to comment Share on other sites More sharing options...
CBers 6771 Posted March 3, 2017 Share Posted March 3, 2017 Might be worth posting the output from ps -ef before and after the systemctl command. Link to comment Share on other sites More sharing options...
Charlo 0 Posted March 3, 2017 Author Share Posted March 3, 2017 (edited) Might be worth posting the output from ps -ef before and after the systemctl command. Ok, I attach output of "ps -ef" before and after the systemctl command. Thanks Carlo ps_pre_systemctl_stop_cmd.txt ps_post_systemctl_stop_cmd.txt Edited March 3, 2017 by Charlo Link to comment Share on other sites More sharing options...
CBers 6771 Posted March 3, 2017 Share Posted March 3, 2017 Is that a rogue ffmpeg process still running? Link to comment Share on other sites More sharing options...
Charlo 0 Posted March 3, 2017 Author Share Posted March 3, 2017 Is that a rogue ffmpeg process still running? There are no orphans FFMPEG processes. Emby works perfectly and when a transcoding or remux are required, FFMPEG processes are opened and then closed regularly. The log files and output of the commands I have attached before, were created by me after restarting the system without any user online. Carlo Link to comment Share on other sites More sharing options...
Charlo 0 Posted March 3, 2017 Author Share Posted March 3, 2017 (edited) Probably I have found the cause of the problem. I have performed tests on my virtual machine in which is installed the same OS (Debian Jessie - OpenMediaVault 3) with the same and identical configuration that I have on the production server from where I extrapolated the log file and outputs of commands sent before. The only difference with my production server is that the apt packages of the official Debian repositories were updated two months ago. I installed Emby from scratch on this virtual machine and the command "systemctl stop emby-server" runs properly stopping regularly all Emby processes. The problem with the stop of Emby processes happens after I updated, on virtual machine, following Debian packages from the official repositories to latest official versions (released about a week ago) with the command "apt-get upgrade": bind9-host libbind9-90 libdns-export100 libdns100 libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 liblwres90 linux-compiler-gcc-4.9-x86 linux-libc-dev login passwd I can assume that the problem is due to upgrades of packages "login" or "passwd" that cause some interference with Emby systemd configuration or its startup script "/usr/bin/emby-server". For safety, I tried to simulate the same procedure on another virtual machine with Debian desktop. THE PROBLEM SHOWS UP AGAIN AS SOON AS I INSTALL THE ABOVE UPDATES via "apt-get upgrade". So probably the problem will present itself on any Debian Jessie system as soon above packages will be updated! Indeed, please note that the output of "systemctl -l status emby-server" (that I enclose again) after the execution of the command "stop systemctl emby-server" present at line 10 a strange error that could be logically related to the problem: "March 03 10:47:18 carlo to [987]: + ??? root: emby" It might help if someone that has installed Emby on Debian Jessie can test if the problem exists after an upgrade of packages with command "apt-get upgrade." I attach following files: - output of command "apt-get upgrade" of updated packages; - output of command "apt-cache policy <UPDATE PACKAGES>" to see new version number of updated packages. Probably is needed to check the compatibility of the boot routine of Emby (systemd unit file or the use of "su" in Emby script) with this particular official update packages. I hope that now the situation is more clearer. Thanks in advance for any help. Carlo apt-get_upgrade.txt apt-get_upgrade.txt systemd_log_status_post_stop_emby-server.txt Edited March 3, 2017 by Charlo Link to comment Share on other sites More sharing options...
gstuartj 39 Posted March 3, 2017 Share Posted March 3, 2017 Could this be an OpenMediaVault specific problem? I haven't experienced it on regular, vanilla Debian. As a workaround I suggest you try installing the Docker plugin for OpenMediaVault, then installing the Docker version of Emby. It will keep Emby separate from the rest of your OpenMediaVault system and will probably avoid this issue. You'll also get the stability & security benefits that come with running the service in a separate container. Link to comment Share on other sites More sharing options...
Charlo 0 Posted March 3, 2017 Author Share Posted March 3, 2017 (edited) Could this be an OpenMediaVault specific problem? I haven't experienced it on regular, vanilla Debian. As a workaround I suggest you try installing the Docker plugin for OpenMediaVault, then installing the Docker version of Emby. It will keep Emby separate from the rest of your OpenMediaVault system and will probably avoid this issue. You'll also get the stability & security benefits that come with running the service in a separate container. Hello, according to my tests this morning, the problem should not be related to OpenMediaVault. As written earlier, after detecting the problem on my physical server, I tried Emby either on OpenMediaVault VM or on a just installed Debian genuine desktop VM. The problem is always presented in both cases as soon as you update the system with the mentioned packages. With further analysis I did today, I think with a good chance, that this problem is caused by the updating of "login" package passed to version 4.2-3+deb8u3 about one or two weeks ago. "Login" package just contains the Debian's "essentials" executables as "login" and "su" which is particulary used by the Emby start-up script. More datails: https://packages.debian.org/jessie/login With my tests, I can guarantee that before the update I have never had any issues regarding abnormal shutdown of Emby processes. To test my theory, I invite all of the users of Emby installed on Debian Jessie OS to update the system with "apt-get upgrade", and to check if the malfunction of abnormal shutdown comes out. Hoping to find a solution, thank you Carlo Edited March 3, 2017 by Charlo Link to comment Share on other sites More sharing options...
Animosity022 6 Posted April 5, 2017 Share Posted April 5, 2017 I don't have an upgraded system, but the stop command doesn't shutdown at all for me. I was searching for a proper shutdown command other than just killing out the processes. root@plex:~# systemctl status emby-server ● emby-server.service - Emby Media Server Loaded: loaded (/lib/systemd/system/emby-server.service; enabled) Active: active (running) since Wed 2017-04-05 18:33:33 EDT; 13s ago Process: 4865 ExecStopPost=/usr/bin/emby-server clear (code=exited, status=0/SUCCESS) Main PID: 5124 (su) CGroup: /system.slice/emby-server.service ‣ 5124 su -s /bin/sh -c umask $0; exec "$1" "$@" emby -- 002 env MAGICK_HOME=/usr/lib/emby-server MAGICK_CODER_FILTER_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagi... Apr 05 18:33:33 plex systemd[1]: Started Emby Media Server. Apr 05 18:33:33 plex su[5124]: Successful su for emby by root Apr 05 18:33:33 plex su[5124]: + ??? root:emby Apr 05 18:33:33 plex su[5124]: pam_unix(su:session): session opened for user emby by (uid=0) root@plex:~# root@plex:~# root@plex:~# systemctl stop emby-server root@plex:~# root@plex:~# root@plex:~# systemctl status emby-server ● emby-server.service - Emby Media Server Loaded: loaded (/lib/systemd/system/emby-server.service; enabled) Active: failed (Result: exit-code) since Wed 2017-04-05 18:33:51 EDT; 3s ago Process: 5278 ExecStopPost=/usr/bin/emby-server clear (code=exited, status=0/SUCCESS) Process: 5124 ExecStart=/usr/bin/emby-server start (code=exited, status=223) Main PID: 5124 (code=exited, status=223) Apr 05 18:33:33 plex systemd[1]: Started Emby Media Server. Apr 05 18:33:33 plex su[5124]: Successful su for emby by root Apr 05 18:33:33 plex su[5124]: + ??? root:emby Apr 05 18:33:33 plex su[5124]: pam_unix(su:session): session opened for user emby by (uid=0) Apr 05 18:33:51 plex systemd[1]: Stopping Emby Media Server... Apr 05 18:33:51 plex systemd[1]: emby-server.service: main process exited, code=exited, status=223/n/a Apr 05 18:33:51 plex systemd[1]: Stopped Emby Media Server. Apr 05 18:33:51 plex systemd[1]: Unit emby-server.service entered failed state. root@plex:~# root@plex:~# root@plex:~# root@plex:~# root@plex:~# ps -ef | grep emby emby 5143 1 0 18:33 ? 00:00:00 /lib/systemd/systemd --user emby 5145 5143 0 18:33 ? 00:00:00 (sd-pam) emby 5147 1 8 18:33 ? 00:00:02 /usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh root 5345 1359 0 18:34 pts/2 00:00:00 grep emby I just shut it down from the GUI and then it starts up without a problem. Link to comment Share on other sites More sharing options...
Charlo 0 Posted April 6, 2017 Author Share Posted April 6, 2017 I don't have an upgraded system, but the stop command doesn't shutdown at all for me. I was searching for a proper shutdown command other than just killing out the processes. root@plex:~# systemctl status emby-server ● emby-server.service - Emby Media Server Loaded: loaded (/lib/systemd/system/emby-server.service; enabled) Active: active (running) since Wed 2017-04-05 18:33:33 EDT; 13s ago Process: 4865 ExecStopPost=/usr/bin/emby-server clear (code=exited, status=0/SUCCESS) Main PID: 5124 (su) CGroup: /system.slice/emby-server.service ‣ 5124 su -s /bin/sh -c umask $0; exec "$1" "$@" emby -- 002 env MAGICK_HOME=/usr/lib/emby-server MAGICK_CODER_FILTER_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagi... Apr 05 18:33:33 plex systemd[1]: Started Emby Media Server. Apr 05 18:33:33 plex su[5124]: Successful su for emby by root Apr 05 18:33:33 plex su[5124]: + ??? root:emby Apr 05 18:33:33 plex su[5124]: pam_unix(su:session): session opened for user emby by (uid=0) root@plex:~# root@plex:~# root@plex:~# systemctl stop emby-server root@plex:~# root@plex:~# root@plex:~# systemctl status emby-server ● emby-server.service - Emby Media Server Loaded: loaded (/lib/systemd/system/emby-server.service; enabled) Active: failed (Result: exit-code) since Wed 2017-04-05 18:33:51 EDT; 3s ago Process: 5278 ExecStopPost=/usr/bin/emby-server clear (code=exited, status=0/SUCCESS) Process: 5124 ExecStart=/usr/bin/emby-server start (code=exited, status=223) Main PID: 5124 (code=exited, status=223) Apr 05 18:33:33 plex systemd[1]: Started Emby Media Server. Apr 05 18:33:33 plex su[5124]: Successful su for emby by root Apr 05 18:33:33 plex su[5124]: + ??? root:emby Apr 05 18:33:33 plex su[5124]: pam_unix(su:session): session opened for user emby by (uid=0) Apr 05 18:33:51 plex systemd[1]: Stopping Emby Media Server... Apr 05 18:33:51 plex systemd[1]: emby-server.service: main process exited, code=exited, status=223/n/a Apr 05 18:33:51 plex systemd[1]: Stopped Emby Media Server. Apr 05 18:33:51 plex systemd[1]: Unit emby-server.service entered failed state. root@plex:~# root@plex:~# root@plex:~# root@plex:~# root@plex:~# ps -ef | grep emby emby 5143 1 0 18:33 ? 00:00:00 /lib/systemd/systemd --user emby 5145 5143 0 18:33 ? 00:00:00 (sd-pam) emby 5147 1 8 18:33 ? 00:00:02 /usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh root 5345 1359 0 18:34 pts/2 00:00:00 grep emby I just shut it down from the GUI and then it starts up without a problem. Hello, After a long analysis, I solved the problem by removing (or by commenting) the line: session optional pam_systemd.so in file: /etc/pam.d/common-session Comparing the above file with the original version shipped in Debian Jessie, it seems "probably" a modification made from an old version of OpenMediaVault installer. The option interferes with PAM authentication that is used by the executable "su" which is used in Emby startup and shutdown script. Now, when I stop service, it always return error in systemd the log: "Unit emby-server.service entered failed state." but at least the demon stops properly and does not restart by itself. With this, I hope I have helped you. Link to comment Share on other sites More sharing options...
Animosity022 6 Posted April 6, 2017 Share Posted April 6, 2017 Nice find! That does seem to stop the server and it remains failed for me as well. I can confirm after that it seems stopped and I think I see the same error that you do. root@plex:~# systemctl stop emby-server root@plex:~# root@plex:~# systemctl status emby-server ● emby-server.service - Emby Media Server Loaded: loaded (/lib/systemd/system/emby-server.service; enabled) Active: failed (Result: exit-code) since Thu 2017-04-06 07:39:50 EDT; 4s ago Process: 6805 ExecStopPost=/usr/bin/emby-server clear (code=exited, status=0/SUCCESS) Process: 4066 ExecStart=/usr/bin/emby-server start (code=exited, status=160) Main PID: 4066 (code=exited, status=160) Apr 06 07:38:28 plex emby-server[4066]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.6E-05 seconds Apr 06 07:38:28 plex emby-server[4066]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 07:38:28 plex emby-server[4066]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0.003739 seconds Apr 06 07:38:28 plex emby-server[4066]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 07:38:28 plex emby-server[4066]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Duration: 5E-06 seconds Apr 06 07:38:28 plex emby-server[4066]: Info, App, All entry points have started Apr 06 07:39:50 plex systemd[1]: Stopping Emby Media Server... Apr 06 07:39:50 plex systemd[1]: emby-server.service: main process exited, code=exited, status=160/n/a Apr 06 07:39:50 plex systemd[1]: Stopped Emby Media Server. Apr 06 07:39:50 plex systemd[1]: Unit emby-server.service entered failed state. root@plex:~# Link to comment Share on other sites More sharing options...
Charlo 0 Posted April 6, 2017 Author Share Posted April 6, 2017 Nice find! That does seem to stop the server and it remains failed for me as well. I can confirm after that it seems stopped and I think I see the same error that you do. root@plex:~# systemctl stop emby-server root@plex:~# root@plex:~# systemctl status emby-server ● emby-server.service - Emby Media Server Loaded: loaded (/lib/systemd/system/emby-server.service; enabled) Active: failed (Result: exit-code) since Thu 2017-04-06 07:39:50 EDT; 4s ago Process: 6805 ExecStopPost=/usr/bin/emby-server clear (code=exited, status=0/SUCCESS) Process: 4066 ExecStart=/usr/bin/emby-server start (code=exited, status=160) Main PID: 4066 (code=exited, status=160) Apr 06 07:38:28 plex emby-server[4066]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.6E-05 seconds Apr 06 07:38:28 plex emby-server[4066]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 07:38:28 plex emby-server[4066]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0.003739 seconds Apr 06 07:38:28 plex emby-server[4066]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 07:38:28 plex emby-server[4066]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Duration: 5E-06 seconds Apr 06 07:38:28 plex emby-server[4066]: Info, App, All entry points have started Apr 06 07:39:50 plex systemd[1]: Stopping Emby Media Server... Apr 06 07:39:50 plex systemd[1]: emby-server.service: main process exited, code=exited, status=160/n/a Apr 06 07:39:50 plex systemd[1]: Stopped Emby Media Server. Apr 06 07:39:50 plex systemd[1]: Unit emby-server.service entered failed state. root@plex:~# Yes, yours is the same situation. I get the error but the demon stops properly. Link to comment Share on other sites More sharing options...
Animosity022 6 Posted April 6, 2017 Share Posted April 6, 2017 It seems that the shutdown of the server by using the child pid of the running process causes the main process to exit out with a bad return code: root@plex:~# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; disabled) Active: active (running) since Thu 2017-04-06 09:21:56 EDT; 2min 49s ago Main PID: 31806 (su) CGroup: /system.slice/emby.service ├─31806 su -s /bin/sh -c umask $0; exec "$1" "$@" emby -- 002 env MAGICK_HOME=/usr/lib/emby-server MAGICK_CODER_FILTER_PATH=/u... └─31824 /usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-ser... Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Sync.SyncManagerEntryPoint. Duration: 0.003...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Sync.SyncNotificationEntryPoint Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Sync.SyncNotificationEntryPoint. Duration: ...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.7E-05 seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0....seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Du...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, All entry points have started Hint: Some lines were ellipsized, use -l to show in full. root@plex:~# pgrep -P 31806 31824 root@plex:~# kill 31824 root@plex:~# ps -ef | grep emby root 32266 27149 0 09:23 pts/1 00:00:00 vi emby-server root 32732 27058 0 09:25 pts/0 00:00:00 grep emby root@plex:~# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; disabled) Active: failed (Result: exit-code) since Thu 2017-04-06 09:25:33 EDT; 11s ago Process: 31806 ExecStart=/usr/bin/emby-server start (code=exited, status=143) Main PID: 31806 (code=exited, status=143) Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.7E-05 seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0....seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Du...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, All entry points have started Apr 06 09:25:33 plex su[31806]: pam_unix(su:session): session closed for user emby Apr 06 09:25:33 plex systemd[1]: emby.service: main process exited, code=exited, status=143/n/a Apr 06 09:25:33 plex systemd[1]: Unit emby.service entered failed state. Hint: Some lines were ellipsized, use -l to show in full. I just made a simple systemd script to play around with and it starts and stops it, but ends in failed state just like the included script. [Unit] Description=Emby After=syslog.target network.target [Service] Type=simple ExecStart=/usr/bin/emby-server start TimeoutStopSec=20 Restart=on-abnormal GuessMainPID=no KilLMode=control-group [Install] WantedBy=multi-user.target Link to comment Share on other sites More sharing options...
Charlo 0 Posted April 6, 2017 Author Share Posted April 6, 2017 (edited) It seems that the shutdown of the server by using the child pid of the running process causes the main process to exit out with a bad return code: root@plex:~# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; disabled) Active: active (running) since Thu 2017-04-06 09:21:56 EDT; 2min 49s ago Main PID: 31806 (su) CGroup: /system.slice/emby.service ├─31806 su -s /bin/sh -c umask $0; exec "$1" "$@" emby -- 002 env MAGICK_HOME=/usr/lib/emby-server MAGICK_CODER_FILTER_PATH=/u... └─31824 /usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-ser... Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Sync.SyncManagerEntryPoint. Duration: 0.003...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Sync.SyncNotificationEntryPoint Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Sync.SyncNotificationEntryPoint. Duration: ...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.7E-05 seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0....seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Du...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, All entry points have started Hint: Some lines were ellipsized, use -l to show in full. root@plex:~# pgrep -P 31806 31824 root@plex:~# kill 31824 root@plex:~# ps -ef | grep emby root 32266 27149 0 09:23 pts/1 00:00:00 vi emby-server root 32732 27058 0 09:25 pts/0 00:00:00 grep emby root@plex:~# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; disabled) Active: failed (Result: exit-code) since Thu 2017-04-06 09:25:33 EDT; 11s ago Process: 31806 ExecStart=/usr/bin/emby-server start (code=exited, status=143) Main PID: 31806 (code=exited, status=143) Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.7E-05 seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0....seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 09:21:59 plex emby-server[31806]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Du...seconds Apr 06 09:21:59 plex emby-server[31806]: Info, App, All entry points have started Apr 06 09:25:33 plex su[31806]: pam_unix(su:session): session closed for user emby Apr 06 09:25:33 plex systemd[1]: emby.service: main process exited, code=exited, status=143/n/a Apr 06 09:25:33 plex systemd[1]: Unit emby.service entered failed state. Hint: Some lines were ellipsized, use -l to show in full. I just made a simple systemd script to play around with and it starts and stops it, but ends in failed state just like the included script. [Unit] Description=Emby After=syslog.target network.target [Service] Type=simple ExecStart=/usr/bin/emby-server start TimeoutStopSec=20 Restart=on-abnormal GuessMainPID=no KilLMode=control-group [Install] WantedBy=multi-user.target The problem could be in the script "/usr/bin/emby-server" and its use of executable "su" that interacts with mono runtime. In first lines of the script is specified that it was modified for CentOS/Fedora and I suppose that was adopted also in Debian, probably without any further changes Different versions or configurations of systemd and PAM Auth in two OS may be the cause of the problem. Unfortunately I do not have much time to carry out further tests. I look forward to other ideas about it. Edited April 6, 2017 by Charlo Link to comment Share on other sites More sharing options...
Animosity022 6 Posted April 6, 2017 Share Posted April 6, 2017 (edited) I put together just a rough systemd script that works with start and stop status. I would need to pretty it up but this seems to work ok. emby.service script [Unit] Description=Emby After=syslog.target network.target RequiresMountsFor=/media [Service] User=emby Group=emby Environment=MAGICK_HOME=/usr/lib/emby-server Environment=MAGICK_CODER_FILTER_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/filters Environment=MAGICK_CODER_MODULE_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/coders Environment=MONO_THREADS_PER_CPU=500 Environment=MONO_GC_PARAMS=nursery-size=512m Environment=LD_LIBRARY_PATH=/usr/lib/emby-server/x86_64-linux-gnu Type=simple ExecStart=/usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh TimeoutStopSec=20 Restart=on-failure GuessMainPID=no [Install] WantedBy=multi-user.target Environment is passed: root@plex:~# strings -a /proc/3345/environ LANG=en_US.UTF-8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/lib/emby-server LOGNAME=emby USER=emby SHELL=/bin/false MAGICK_HOME=/usr/lib/emby-server MAGICK_CODER_FILTER_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/filters MAGICK_CODER_MODULE_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/coders MONO_THREADS_PER_CPU=500 MONO_GC_PARAMS=nursery-size=512m LD_LIBRARY_PATH=/usr/lib/emby-server/x86_64-linux-gnu Output looks like: root@plex:/etc/systemd/system# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; enabled) Active: active (running) since Thu 2017-04-06 14:07:39 EDT; 1min 25s ago Main PID: 3345 (mono-sgen) CGroup: /system.slice/emby.service └─3345 /usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-serv... Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Sync.SyncManagerEntryPoint. Duration: 0.005496 seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Server.Sync.SyncNotificationEntryPoint Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Sync.SyncNotificationEntryPoint. Duration: 8.... seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.7E-05 seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0.00... seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Dura... seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, All entry points have started Hint: Some lines were ellipsized, use -l to show in full. root@plex:/etc/systemd/system# And on a shutdown, it seems to close out everything properly with a kill. root@plex:~# systemctl stop emby root@plex:~# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; enabled) Active: inactive (dead) since Thu 2017-04-06 14:07:25 EDT; 2s ago Process: 30469 ExecStart=/usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh (code=killed, signal=TERM) Main PID: 30469 (code=killed, signal=TERM) Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Server.Sync.SyncNotificationEntryPoint. Duration: 0... seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 3E-05 seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0.0... seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Dur... seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, All entry points have started Apr 06 14:07:25 plex systemd[1]: Stopping Emby... Apr 06 14:07:25 plex systemd[1]: Stopped Emby. Edited April 6, 2017 by Animosity022 Link to comment Share on other sites More sharing options...
Charlo 0 Posted April 7, 2017 Author Share Posted April 7, 2017 I put together just a rough systemd script that works with start and stop status. I would need to pretty it up but this seems to work ok. emby.service script [Unit] Description=Emby After=syslog.target network.target RequiresMountsFor=/media [Service] User=emby Group=emby Environment=MAGICK_HOME=/usr/lib/emby-server Environment=MAGICK_CODER_FILTER_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/filters Environment=MAGICK_CODER_MODULE_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/coders Environment=MONO_THREADS_PER_CPU=500 Environment=MONO_GC_PARAMS=nursery-size=512m Environment=LD_LIBRARY_PATH=/usr/lib/emby-server/x86_64-linux-gnu Type=simple ExecStart=/usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh TimeoutStopSec=20 Restart=on-failure GuessMainPID=no [Install] WantedBy=multi-user.target Environment is passed: root@plex:~# strings -a /proc/3345/environ LANG=en_US.UTF-8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/lib/emby-server LOGNAME=emby USER=emby SHELL=/bin/false MAGICK_HOME=/usr/lib/emby-server MAGICK_CODER_FILTER_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/filters MAGICK_CODER_MODULE_PATH=/usr/lib/emby-server/x86_64-linux-gnu/EmbyMagick-6.9.6/modules-Q8/coders MONO_THREADS_PER_CPU=500 MONO_GC_PARAMS=nursery-size=512m LD_LIBRARY_PATH=/usr/lib/emby-server/x86_64-linux-gnu Output looks like: root@plex:/etc/systemd/system# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; enabled) Active: active (running) since Thu 2017-04-06 14:07:39 EDT; 1min 25s ago Main PID: 3345 (mono-sgen) CGroup: /system.slice/emby.service └─3345 /usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-serv... Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Sync.SyncManagerEntryPoint. Duration: 0.005496 seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Server.Sync.SyncNotificationEntryPoint Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Sync.SyncNotificationEntryPoint. Duration: 8.... seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 2.7E-05 seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0.00... seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Dura... seconds Apr 06 14:07:41 plex mono-sgen[3345]: Info, App, All entry points have started Hint: Some lines were ellipsized, use -l to show in full. root@plex:/etc/systemd/system# And on a shutdown, it seems to close out everything properly with a kill. root@plex:~# systemctl stop emby root@plex:~# systemctl status emby ● emby.service - Emby Loaded: loaded (/etc/systemd/system/emby.service; enabled) Active: inactive (dead) since Thu 2017-04-06 14:07:25 EDT; 2s ago Process: 30469 ExecStart=/usr/bin/mono-sgen --optimize=all /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh (code=killed, signal=TERM) Main PID: 30469 (code=killed, signal=TERM) Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Server.Sync.SyncNotificationEntryPoint. Duration: 0... seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Starting entry point Emby.Security.PluginSecurityManager Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Security.PluginSecurityManager. Duration: 3E-05 seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Starting entry point Emby.Server.Core.IO.LibraryMonitorStartup Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Server.Core.IO.LibraryMonitorStartup. Duration: 0.0... seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Starting entry point Emby.Server.Core.EntryPoints.ExternalPortForwarding Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, Entry point completed: Emby.Server.Core.EntryPoints.ExternalPortForwarding. Dur... seconds Apr 06 14:06:04 plex mono-sgen[30469]: Info, App, All entry points have started Apr 06 14:07:25 plex systemd[1]: Stopping Emby... Apr 06 14:07:25 plex systemd[1]: Stopped Emby. WOW that's nice. The statup script of official Emby deb package completely ported to systemd unit file...REALLY A GREAT JOB Thanks Animosity022. In the coming days I will test on both my installations of Emby to check how it works. At first glance I think that is better to remove the line: RequiresMountsFor=/media It is usually best to generalize configuration so its installation can be applied to all Debian derivatives. The mounting point of the external devices varies from distribution to distribution. For example in OpenMediaVault, after latest updates (one week ago), default mountpoint folder is no longer "/media" but "/srv". I hope that after test phase this new systemd unit file will be included in the official Emby deb package. Thanks Carlo Link to comment Share on other sites More sharing options...
Animosity022 6 Posted April 7, 2017 Share Posted April 7, 2017 Ah nice. Yeah for me "/media" is my Amazon Cloud Drive so I want to make sure that before the server starts up, I have my mount point so my library doesn't get hosed and need a deeper rescan. That definitely can come out and to make it nicer, it should probably be a nice file to read in, but I wanted to make sure it works before I cleaned it up. 1 Link to comment Share on other sites More sharing options...
geaves 13 Posted May 11, 2017 Share Posted May 11, 2017 @@Charlo @@Animosity022 I just might have a similar issue although I'm running OMV 2 which is Debian Wheezy, whilst I can so some within the OS when it comes to something such as this thread it's a bit beyond me. If I were to replace that script what am I replacing and where and where? That part I can manage Link to comment Share on other sites More sharing options...
Charlo 0 Posted May 11, 2017 Author Share Posted May 11, 2017 @@Charlo @@Animosity022 I just might have a similar issue although I'm running OMV 2 which is Debian Wheezy, whilst I can so some within the OS when it comes to something such as this thread it's a bit beyond me. If I were to replace that script what am I replacing and where and where? That part I can manage Debian wheeze does not use systemd but the old init.d. This solution is valid for Debian Jessie with systemd and higher. I advise you to update the OS. Link to comment Share on other sites More sharing options...
geaves 13 Posted May 11, 2017 Share Posted May 11, 2017 Debian wheeze does not use systemd but the old init.d. This solution is valid for Debian Jessie with systemd and higher. I advise you to update the OS. Ah!! Thanks, the more I ask the more I learn as I installed omv rather than Debian to upgrade the OS I would have to move to omv v3 then? Link to comment Share on other sites More sharing options...
Charlo 0 Posted May 11, 2017 Author Share Posted May 11, 2017 Direct upgrade from OMV 2 to OMV 3 is not well supported. Is better to reistall from scratch entire OS OMV 3. In it's forum you Can find step by step guides. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now