prcutler 0 Posted February 1, 2017 Share Posted February 1, 2017 Hi all, I noticed a while back that emby-server isn't starting automatically in systemd for me and I finally had some time to troubleshoot. I'm running Fedora 25 and I've made sure dnf / yum are up to date and made sure I'm using the repos from this post in the Fedora thread: https://emby.media/community/index.php?/topic/13398-fedoracentos-rpm/page-15 emby-server does run if I start manually as sudo, but if I try to enable the service, I get the following error: systemctl status emby-server -l ● emby-server.service - Emby Media Server Loaded: loaded (/usr/lib/systemd/system/emby-server.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2017-02-01 07:19:08 CST; 27min ago Process: 26742 ExecStopPost=/usr/lib/emby-server/emby-server.sh clear (code=exited, status=0/SUCCESS) Process: 26718 ExecStart=/usr/lib/emby-server/emby-server.sh start (code=exited, status=127) Main PID: 26718 (code=exited, status=127) Feb 01 07:19:08 mythtv systemd[1]: Started Emby Media Server. Feb 01 07:19:08 mythtv emby-server.sh[26718]: /usr/lib/emby-server/emby-server.sh: line 118: exec: su: not found Feb 01 07:19:08 mythtv systemd[1]: emby-server.service: Main process exited, code=exited, status=127/n/a Feb 01 07:19:08 mythtv systemd[1]: emby-server.service: Unit entered failed state. Feb 01 07:19:08 mythtv systemd[1]: emby-server.service: Failed with result 'exit-code'. Doing a Google search on status=127, I found this on Github, but it's a status 126: https://github.com/MediaBrowser/Emby/issues/1419 From that thread, if I run: #!/bin/bash MAGICK_LIBRARY_PATH=$(find /usr/lib/emby-server/ -maxdepth 1 -mindepth 1 -type d| grep -v bin) MONO_EXEC_ENV="$MONO_ENV LD_LIBRARY_PATH=${MAGICK_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" echo "$MONO_EXEC_ENV" I get: [pcutler@[member="mythtv"] ~]$ echo "$MONO_EXEC_ENV" LD_LIBRARY_PATH=/usr/lib/emby-server/etc /usr/lib/emby-server/lib64 So I don't think it's embymagick as I see: Package embymagick-6.9.6+6-7.2.x86_64 is already installed. Since I'm able to run it as sudo normally, I don't see anything in the latest log file. At the top I see: 2017-02-01 07:27:03.3492 Info Main: Emby Command line: /usr/lib/emby-server/bin/MediaBrowser.Server.Mono.exe -programdata /var/lib/emby-server -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartpath /usr/lib/emby-server/restart.sh Operating system: Unix 4.8.16.300 64-Bit OS: True 64-Bit Process: True Mono: 4.6.2 (Stable 4.6.2.16/ac9e222 Tue Jan 3 11:51:14 UTC 2017) Processor count: 4 Program data path: /var/lib/emby-server Application directory: /usr/lib/emby-server/bin 2017-02-01 07:27:03.6990 Info ImageMagick: ImageMagick version: ImageMagick 6.9.6-6 Q8 x86_64 2016-12-12 http://www.imagemagick.org 2017-02-01 07:27:04.6188 Info App: Application version: 3.1.5.0 2017-02-01 07:27:04.7586 Info App: Application configuration: Any hints of what I should be looking for or trying to fix systemd? Is it related to the su not found message? (I'm not sure how to fix that). Thanks in advance. Paul Link to comment Share on other sites More sharing options...
Solution dcrdev 251 Posted February 1, 2017 Solution Share Posted February 1, 2017 (edited) Do you have selinux enabled? The fact that your able to run manually with sudo suggests that to be the cause. The emby startup script tries to elevate itself using sudo, selinux does not like the fact that sudo has spawned from a systemd unit. You can trick selinux by creating /etc/systemd/system/emby-server.service with the following content: [Unit] Description=Emby Media Server After=network.target [Service] ExecStart=/bin/sh -c "/usr/lib/emby-server/emby-server.sh start" Restart=on-abort TimeoutSec=20 ExecStopPost=/bin/sh -c "/usr/lib/emby-server/emby-server.sh clear" [Install] WantedBy=multi-user.target Then run "sudo systemctl daemon-reload && sudo systemctl restart emby-server". Alternatively you could just disable selinux if you're not fussed about it. Edited February 1, 2017 by dcrdev 1 Link to comment Share on other sites More sharing options...
prcutler 0 Posted February 1, 2017 Author Share Posted February 1, 2017 Thank you! Creating the service file did the trick. Thanks for the help and the quick response. 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