Jump to content


Photo

[Ubuntu] "Exiting because another instance is already running" after reboot


Best Answer alucryd , 05 September 2019 - 10:07 AM

The emby-server unit should be enabled upon installation, but we've seen people who somehow masked the unit, so enabling can't work. Can you try enabling it (systemctl enable) and post the log?

Go to the full post


  • Please log in to reply
16 replies to this topic

#1 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 04 September 2019 - 02:14 PM

Every time I reboot my server, Emby is down.

 

systemctl status emby-server gives me that:

● emby-server.service - Emby Server is a personal media server with apps on just about every device.
   Loaded: loaded (/usr/lib/systemd/system/emby-server.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2019-09-04 20:04:43 CEST; 7min ago
 Main PID: 1131 (code=exited, status=0/SUCCESS)


Sep 04 20:04:38 nuc systemd[1]: Started Emby Server is a personal media server with apps on just about every device..
Sep 04 20:04:43 nuc emby-server[1131]: Exiting because another instance is already running.
A simple "systemctl start emby-server" solves the issue but I have do that every time I reboot.

 

I don't believe I made any change to the systemd settings:

[Unit]
Description=Emby Server is a personal media server with apps on just about every device.
After=network.target


[Service]
EnvironmentFile=/etc/emby-server.conf
WorkingDirectory=/opt/emby-server
ExecStart=/opt/emby-server/bin/emby-server
RestartForceExitStatus=3
User=emby


[Install]
WantedBy=multi-user.target

I don't have any issue with my other services.

 

Any idea how to fix this?


Edited by sephrat, 04 September 2019 - 02:14 PM.


#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 139859 posts
  • Local time: 10:44 PM

Posted 04 September 2019 - 02:25 PM

Hi, was any emby server log generated?

#3 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 04 September 2019 - 02:42 PM

Hi, was any emby server log generated?

No there was not. Last entry in the log is about shutting down:

2019-09-04 19:21:18.869 Info HttpServer: Stopping HttpListener...
2019-09-04 19:21:18.890 Info HttpServer: HttpListener stopped
2019-09-04 19:21:18.940 Info App: Disposing CoreAppHost
2019-09-04 19:21:18.941 Info App: Disposing LoopUtilEntryPoint
2019-09-04 19:21:18.941 Info App: Disposing SyncNotificationEntryPoint
2019-09-04 19:21:18.962 Info App: Disposing SyncManagerEntryPoint
2019-09-04 19:21:18.968 Info App: Disposing ConnectEntryPoint
2019-09-04 19:21:18.968 Info App: Disposing Notifications
2019-09-04 19:21:18.970 Info App: Disposing EncodingManagerEntryPoint
2019-09-04 19:21:18.970 Info App: Disposing MediaEncoderEntryPoint
2019-09-04 19:21:18.970 Info App: Disposing ActivityLogEntryPoint

After that in journalctl I can see this:

Sep 04 19:21:19 nuc systemd[1]: Stopped Emby Server is a personal media server with apps on just about every device..
-- Reboot --
Sep 04 20:04:38 nuc systemd[1]: Started Emby Server is a personal media server with apps on just about every device..
Sep 04 20:04:43 nuc emby-server[1131]: Exiting because another instance is already running.

(timestamp seem off but I truncated the log for independant reasons)



#4 alucryd OFFLINE  

alucryd

    Advanced Member

  • Members
  • 346 posts
  • Local time: 04:44 AM
  • LocationLille, France

Posted 05 September 2019 - 10:07 AM   Best Answer

The emby-server unit should be enabled upon installation, but we've seen people who somehow masked the unit, so enabling can't work. Can you try enabling it (systemctl enable) and post the log?


  • sephrat likes this

#5 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 05 September 2019 - 10:11 AM

I'm pretty sure I already tried that when I troubleshot a few weeks ago but it seems to work!
Maybe it gets reset upon upgrade? I'll keep an eye on that.
Thanks!

#6 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 139859 posts
  • Local time: 10:44 PM

Posted 21 September 2019 - 02:16 PM

@sephrat how did this go?



#7 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 21 September 2019 - 02:21 PM

So far so good. Since I enabled the service, Emby has always been up after a reboot. No idea what happened in the first place.

#8 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 139859 posts
  • Local time: 10:44 PM

Posted 21 September 2019 - 02:29 PM

Thanks for the feedback.



#9 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 17 October 2019 - 09:59 AM

Well I still don't understand the pattern but it keeps happening every now and then. I know for sure it happened twice since the last update but not after every reboot. I just enable the service again and pray for it to last.



#10 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 139859 posts
  • Local time: 10:44 PM

Posted 17 October 2019 - 03:19 PM

What exactly happens?



#11 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 18 October 2019 - 09:42 AM

Starting from some point in time, Emby service doesn't start after a reboot.

I just did a test during the upgrade to 4.3.0.15. The reboot before the upgrade went well. I tried 2 reboots after the update and after none of them did Emby start automatically. A simple "systemctl start emby-server" boots it up, and after that we're back to normal: Emby starts upon the next reboot. 



#12 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 139859 posts
  • Local time: 10:44 PM

Posted 21 October 2019 - 01:54 AM

When you reboot, how are you doing that? Is Emby server running when you reboot, or do you stop it first?



#13 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 21 October 2019 - 02:26 AM

I reboot with "sudo reboot". Yes Emby is running when I reboot, just like all my other services. Emby is the only one I have issue with.

#14 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 315 posts
  • Local time: 10:44 PM

Posted 21 October 2019 - 09:35 AM

Are there internal or external dependencies not ready yet for Emby to start cleanly? Could changing the startup order correct it? A delay for Emby?

#15 sephrat OFFLINE  

sephrat

    Advanced Member

  • Members
  • 48 posts
  • Local time: 04:44 AM

Posted 21 October 2019 - 10:06 AM

I haven't set up any dependencies based on Emby. My systemd service is pasted in my first post, and I don't believe any of my services is set to start after or before Emby.

 

This may be nothing but I noticed that there are 2 files for emby service, is that normal?

$ ls -l /usr/lib/systemd/system/emby*
-rw-r--r-- 1 root root 316 Aug 22  2017 /usr/lib/systemd/system/emby-server.service
-rw-r--r-- 1 root root 314 Aug 22  2017 /usr/lib/systemd/system/emby-server@.service

emby-server@.service:

[Unit]
Description=Emby Server is a personal media server with apps on just about every device.
After=network.target


[Service]
EnvironmentFile=/etc/emby-server.conf
WorkingDirectory=/opt/emby-server
ExecStart=/opt/emby-server/bin/emby-server
RestartForceExitStatus=3
User=%i


[Install]
WantedBy=multi-user.target

(the only difference with the other file is "User=%i" instead of "User=emby")

 

 

Could changing the startup order correct it? A delay for Emby?

 

I'm not an Ubuntu guru, how can you influence systemd by other means than "Wants"/"After"/"Before" instructions?

 

 

What's puzzling me is that it seems to start OK everytime I reboot, except right after an Emby update. This makes it hard to trackdown because I have to wait for an update to run another test.



#16 Q-Droid OFFLINE  

Q-Droid

    Advanced Member

  • Members
  • 315 posts
  • Local time: 10:44 PM

Posted 21 October 2019 - 11:02 AM

I meant dependencies along the lines of external storage or devices not yet ready when Emby is started.

I think your dir listing is valid, '@' file is a template.

Yes, those instructions would be a way to alter the startup if you had service dependencies in your config. I believe overrides are the "clean" way to do so in systemd.

#17 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 139859 posts
  • Local time: 10:44 PM

Posted 21 October 2019 - 01:10 PM

The message that you get about instance already running is the mutex lock we use on the machine to make sure only a single instance of the server can run at a time.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users