BenjV / SYNO-packages

43 stars 10 forks source link

Medusa needs to be repaired every time after restart on DSM7 #36

Open EciruamK opened 3 years ago

EciruamK commented 3 years ago

Medusa 2.0 on DSM7 needs to be repaired as a package on Synology after restart. Any ideas?

McEnnes commented 3 years ago

I have the same problem but repair is not working. I guess i need to re install?

EciruamK commented 3 years ago

Doesn't work. I've reinstalled Medusa a couple of times and still need to repair after reboot. Starting the package gives a link to the logfile of Medusa. I will check that one.

BenjV commented 3 years ago

No idea, Look in the installation log. You can find it here:

/var/log/packages/medusa.log

Did you add read/write permission tot the share where the video files are located?

If not go to the control panel, choose "Shared Folders" and select the share, choose "Edit" and then "Permissions", in the pulldown select "System Internal User" and tik the read/write box for sc-medusa. Then try to start medusa again from the package center.

If it still fails you could try to remove the package first and then install it fresh.

EciruamK commented 3 years ago

Done all that and it still wasnt working. I've read it could be something to do with the Radarr package. Stopped the Radarr package and reinstalled Medusa. Rebooted the Synology and the Medusa package was manually stopped. Running it again works now. Did a reboot again and the packages is working now. Weird shit, I guess :-)

BenjV commented 3 years ago

Very strange. Any pointer where you red that Radarr could be the problem?

McEnnes commented 3 years ago

I connot test this for a couple of days, but i do not have radarr installed I think and hope remove and re install Medusa will do the trick.

EciruamK commented 3 years ago

Very strange. Any pointer where you red that Radarr could be the problem?

Somewhere on Reddit when I had problems with Sickchill and was switching to Medusa. Can’t seem to find it anymore. Btw have medusa and Radarr both on a DSM6 Synology and works like a charm. Only had this problem on a DSM7 synology

BenjV commented 3 years ago

I checked the Radarr package and although it has some leftovers that only worked on DSM 6, I could not find any interference with other packages. Sickchill has deviated from Medusa by using all kinds of binary libraries and that could collide with Radarr if they use the same binary libraries (just a wild guess). But I no longer support a SickChill package, so I will not investigate that.

I also cannot reproduce the problem, although it is impossible for me to test an upgrade from DSM 6 to DSM 7. The only thing I can think of is that the DSM 6 version left something behind that the packagecenter triggers to display this message. A complete remove, reboot(just to be certain) and new install of medusa should fix such a problem.

EciruamK commented 3 years ago

OK, same problem this morning. It was working yesterday before my autoshut of my Synology. I shut down my Synology at 00:00 hrs and start automatically at 07:30 hrs. The package says repair and I can't get the rpair to finish. Unable to start the package and syas I need to check the log at var/log/pacakes/medusa.log

This are the last lines: 2021/09/13 00:01:34 (system) trigger medusa 2.0 End start-stop-status stop ret=[0] 2021/09/13 07:32:19 (system) trigger medusa 2.0 Begin start-stop-status start PID file: /volume1/@appdata/medusa/medusa.pid already exists. Exiting. 2021/09/13 07:34:48 (system) trigger medusa 2.0 End start-stop-status start ret=[3] 2021/09/13 07:34:50 (system) trigger medusa 2.0 Begin start-stop-status stop /var/packages/medusa/scripts/start-stop-status: line 66: kill: (17414) - No such process 2021/09/13 07:35:10 (system) trigger medusa 2.0 End start-stop-status stop ret=[0] 2021/09/13 20:21:42 start medusa 2.0 Begin start-stop-status start PID file: /volume1/@appdata/medusa/medusa.pid already exists. Exiting. 2021/09/13 20:21:59 start medusa 2.0 End start-stop-status start ret=[3] 2021/09/13 20:22:02 (system) trigger medusa 2.0 Begin start-stop-status stop /var/packages/medusa/scripts/start-stop-status: line 66: kill: (17414) - No such process 2021/09/13 20:22:22 (system) trigger medusa 2.0 End start-stop-status stop ret=[0] /09/13 20:22:22 (system) trigger medusa 2.0 End start-stop-status stop ret=[0]

The time of 20.22 is when I manually tried to start the package again. Th time of 00.00 is auto shutdown The time of 07:30 is automatically startup

BenjV commented 3 years ago

It seems to me that when your Nas shuts down, the package center gives a stop command to the medusa package. Then medusa would shut down and remove it's pidfile. But apperently the Nas does not wait for a gracefull shutdown of medusa and just kills the process, resulting in a leftover pidfile. This will prevent the package to start again, because the pidfile already exists, so the package conclude medusa is already running.

On my Nas this does not happen, but I will try to find a solution for this issue. The package start command script must check if process with the pid from the pidfile is running and if not just remove this pidfile and start medusa. I will keep you posted here when I have this fixed.

EciruamK commented 3 years ago

The weird thing is that I have the same setup on my other DSM6 Synology with the auto shutdown and auto startup. My Medusa package there gives no problem. Just so you know. Thanks in advance.

BenjV commented 3 years ago

I know, on my own Nas this is also no problem at all. The point is that on some devices DSM does not wait for medusa to do a gracefull shutdown and just kill the process or maybe just does not wait long enough to let medusa shutdown gracefull. And medusa itself checks if the pidfile is already there and won't start is so. This message from your log is from medusa.

PID file: /volume1/@appdata/medusa/medusa.pid already exists. Exiting.

I am testing a solution right now and let you know when it is done so you can test it.

EDIT: @EciruamK I have made a new package so if you download it and do a install it will upgrade the startup script and hopefully fix the problem. So maybe you would be so kind to test if this fixed the problem?

EciruamK commented 3 years ago

I know, on my own Nas this is also no problem at all. The point is that on some devices DSM does not wait for medusa to do a gracefull shutdown and just kill the process or maybe just does not wait long enough to let medusa shutdown gracefull. And medusa itself checks if the pidfile is already there and won't start is so. This message from your log is from medusa.

PID file: /volume1/@appdata/medusa/medusa.pid already exists. Exiting.

I am testing a solution right now and let you know when it is done so you can test it.

EDIT: @EciruamK I have made a new package so if you download it and do a install it will upgrade the startup script and hopefully fix the problem. So maybe you would be so kind to test if this fixed the problem?

Wow fast! Gonna test it today!

EciruamK commented 3 years ago

Seems ok now! Gonna do my normal routine with autoshutdown and start at midnight and will check it once more tomorrow. Already thank you for the quick release.

BenjV commented 3 years ago

Your'e welcome. Let me know if the autoshutdown and restart also works ok

EciruamK commented 3 years ago

Checked it this morning and works like a charm. Thanks (bedankt!) Again

BenjV commented 3 years ago

Top

McEnnes commented 3 years ago

Works on my Synology too, thanks BenJV!! I still have a very small problem. When i do a restart from within Medusa. i have to run it from the package center first. No big deal, but maybe a nice puzzle. This did not happen on the DSM 6 version.

BenjV commented 3 years ago

This is an inconsistente problem. Sometimes medusa restarts fine and sometimes it fails and has to be started from the package center. I experienced this also on DSM6.

I cannot pinpoint this and there is nothing in the log to be found. Of course this outside the control of my package, so if it bothers you create an issue on the medusa github.

enrique131 commented 3 years ago

Downloading to try the 2.1 version. Having to reinstall every week was a bit of a pain. Hope this version fix it. Thanks