openhab / openhab-qnap-qpkg

openHAB Packages for QNAP NAS systems
Eclipse Public License 2.0
77 stars 21 forks source link

openHAB doesn't start after NAS restart #19

Closed Maverik15 closed 7 years ago

Maverik15 commented 7 years ago

Hello,

I've installed openHAB 2.0.0-0. After installation the server is started and available. But after NAS restart, i get the following error message and openHAB doesn't start: " Java not found! Please read the documentation about details. " But Java is still installed.

When i try to start the server manual via SSH and start.sh, i got the following message: "There is a Root instance already running with name main and pid 25421"

After changing the pid from 25421 to 0 inside "instance.properties" i was able to start the instance but couldn't access to webserver.

Do you have an idea whats going wrong and what shall i do to fix?

Thanks in advance Jan

kregiel commented 7 years ago

I have the same problem - it's ok after installation but after server restart openHAB doesn't work anymore. I think this Java error is just a message if there is no "own JAVA" installed in openHAB directory... it's not the case.

Maverik15 commented 7 years ago

Hello kregiel,

you are right. The Java "error" is not the problem. ( And now it is not longer displayed. ) But before restart I've to set the "pid" value to "0" in "instance.properties" file. Because, during start up of openHAB, these file will be checked.

After that openHAB restarts correctly ( please be patient on my NAS it takes 5 - 8 minutes ).

But I couldn't find the root cause until now.

kind regards Jan

kregiel commented 7 years ago

Hello Maverik15, well... after many tests I finally realized that maybe I was wrong and this Java error could be the case? :( I am still a linux noob and my bash programming is poor so I hadn't interpreted the bash code properly. Next I have read that EXIT in setupEnvironment() function just exit to shell (not just from this function) and command "openHAB.sh stop" is never called during NAS shutdown... Maybe during NAS shutdown JRE is stopped before openHAB and this is source of this Java errror? If so, how to call "openHAB.sh stop" before disabling JRE? But in other case when I've just deleted openHAB link from /etc/init.d and restart NAS - openHAB has started properly...

To be honest - after those all tests and dozens of installation processes my openHAB starts well now - just like that... An Java error has disappeared. I am helpless now :( I have to do more tests.

can you explain how and where can I set this PID to 0? I have no error with root...

kind regards, Piotr

exo1987 commented 7 years ago

Hello all,

I have the same issue. I am using QTS 4.3.3. I did some Tests and installed JRE and after that OpenHab. After a restart OpenHab was still working. I did the config and restarted the qnap again and Openhab was still working. Then I was activating openHAB Cloud Connector and after another restart OpenHab was down and I was not able to activate it using AppCenter. Is there any solution?

Kind regards JC

Maverik15 commented 7 years ago

Hey, sorry for my late reply.

I've only an workaround for this issue. I couldn't find a solution until now. You can change the value "item.0.pid" to 0 in the following file: distribution / runtime / instances / instance.properties This value contains the pid of actual running openHAB process. Set this to "0" before you restart. After that openHAB should start.

Hope this can help.

regards Jan

thopiekar commented 7 years ago

Also have the same problem here with my NAS. The reason is that I found no way to stop the service correctly. So at the moment the QTS OS is killing all processes of openHAB radically. So @Maverik15 fix is correct, which I also have to do when my NAS crashes. QNAP still doesn't want to fix it, tells me to reset it, even when I already did that. Very disappointing!

badplay commented 7 years ago

i have same problem 253 pro and 4.2 x so were do i find this distribution / runtime / instances / instance.properties. i mean were do i find this folder and this file and how putty ???

thopiekar commented 7 years ago

@badplay The latest .qpkg file also resets this file. However, make an backup of your configs and userdata. In case something gets lost, let me know, so I can see whether my script is still wrong or missing something somewhere.

So, since reinstalling the .qpkg fies the problem I'm closing this now...