hassio-addons / addon-plex

Plex Media Server - Home Assistant Community Add-ons
https://addons.community
MIT License
138 stars 67 forks source link

Plex Media Server is already running. Will not start #206

Closed marciogranzotto closed 12 months ago

marciogranzotto commented 1 year ago

Problem/Motivation

Usually after a non-graceful reboot, like after a power outage, my plex add-on refuses too start. This seems to be because of a plexmediaserver.pid file that doesn't get deleted.

Expected behavior

Start normally

Actual behavior

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Plex Media Server
 Recorded media, live TV, online news, and podcasts ready to stream.
-----------------------------------------------------------
 Add-on version: 3.3.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.5  (amd64 / generic-x86-64)
 Home Assistant Core: 2023.9.2
 Home Assistant Supervisor: 2023.09.2
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-timezone: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
[10:56:34] INFO: Configuring timezone (America/Sao_Paulo)...
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service base-addon-timezone successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-plex: starting
s6-rc: info: service init-plex successfully started
s6-rc: info: service plex: starting
s6-rc: info: service plex successfully started
s6-rc: info: service legacy-services: starting
[10:56:34] INFO: Starting the Plex Media Server...
Plex Media Server is already running. Will not start...
[10:56:34] INFO: Service Plex Media Server exited with code 1 (by signal 0)
s6-rc: info: service legacy-services successfully started
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service plex: stopping
s6-rc: info: service plex successfully stopped
s6-rc: info: service init-plex: stopping
s6-rc: info: service init-plex successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-timezone: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-timezone successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Steps to reproduce

Force reboot your HA machine.

Proposed changes

Deleting the plexmediaserver.pid file makes the add-on start properly. I think the start script should check if that exists, if it does, try to kill plexmediaserver.pid and delete the file

For reference: https://github.com/linuxserver/docker-plex/issues/134#issuecomment-449815340

s-ol commented 1 year ago

Same issue here. I'm not familiar with s6 and it seems the pidfile (or whatever the equivalent is) is not called that, so I've been unable to solve this without uninstalling, reinstalling, and reconfiguring the plugin from scratch so far, which is very annoying.

Edit: seems like deleting /run/service/.s6-linux-init-shutdownd:plex:* and the whole /run/s6-rc:s6-rc-init:* directory did the trick. Of course since the container won't start you can't really do that, so the only way I found was to find the container's diff directory (docker inspect addon_xxxx_plex, look for GraphDriver/Data/UpperDir), which is something like /mnt/docker/overlay2/<hash>/diff and delete the files from there. You'll need root on the host system for this.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

marciogranzotto commented 12 months ago

Actually, the fix is already merged in. Haven't seen this issue anymore.