openhab / openhab-qnap-qpkg

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

Error - Failure to start - Port 8090 or 8444 already in use #4

Open nodecentral opened 7 years ago

nodecentral commented 7 years ago

Hi,

I have just installed the latest .qpkg (2.0.0.b4-2) and when I try to start it up via App Centre, it fails, and the logs report the following.

Server Name: MYNAS00123 IP Address: 10.168.2.111 Date/Time: 23/10/2016 09:44:07 Level: Warning Port 8090 or 8444 already in use

Any advice on how to address this error would be appreciated..

thopiekar commented 7 years ago

Well, if it says that you are already using 8090 or 8444, then you should find out which application or service on your NAS is using this port and choose a different one. Alternatively you can login as root via SSH or Telnet and change the port in the startup script (called openHAB.sh). But remember on every update (using a new QPKG) you will probably correct the port again.

However, I'm taking this issue report as an idea for a enhancement. In the future I think I'll a fuction which looks for files like openhab-qpkg-port-http and openhab-qpkg-port-https in the distribution or distribution/conf/qpkg directory. So this change will be permanent in your case.

Sorry for the late reply, but I missed the notification by mail for a reason. If you have further questions just ask :wink:

nodecentral commented 7 years ago

Hi, I've change the openHAB.sh file, to 8099 & 8444 but when I try to Start the app up, I get the following error : Any ideas ?

Type Date Time Users Source IP Computer name Content

Warning 2016/11/08 23:27:07 System 127.0.0.1 localhost openHAB is still running as <21906> with status: Name:

nodecentral commented 7 years ago

I've tried to kill the process and rerun it but still no joy :(

thopiekar commented 7 years ago

Are there any other Java applications running? What have you killed the pid of the error message or all java instances.

PS: which NAS do you own?

nodecentral commented 7 years ago

Hi,

There are likely other Java apps running e.g Crash Plan? My NAS is the TS-453 Pro.

I just tried to kill the PID using the following..

kill -9 21906

But the app still will not start

thopiekar commented 7 years ago

Try to login via SSH, go to the location where openHAB is installed and do: ./openHAB.sh stop

It should manage to stop openHAB correctly. However, I wonder why kill -9 21906 doesn't work here.

nodecentral commented 7 years ago

Hi,

Sorry I should have been clearer.. I think I have killed the process OK (, as I do not get that error message anymore when I try to run it ) - the issue is that it still does not start up/run.

Any ideas ?

thopiekar commented 7 years ago

Ah, ok.

Then there is also ./openHAB.sh console. If there are any errors during startup, they should appear directly as an output. If not, remove all logs at userdata/log and retry. At least something should appear there :confused:

nodecentral commented 7 years ago

Update : it looks like it is actually running , however the App Centre screen/icon is saying that its not ?(The icon is greyed out and it still has the start button) yet if I go to https://192.168.1.234:8555 (the ports I change to earlier) - I can see a OpenHAB page giving me 4 options to choose the UI )

Any ideas why the .qpkg is not reporting it as running ?

thopiekar commented 7 years ago

No idea. But yes, there are known problems.

For example when starting or stopping openHAB, the App Center executes /etc/init/openHAB.sh start or /etc/init/openHAB.sh stop. The problem here is that if you are starting or stopping openHAB, it won't wait until the service is completely up or shut down. The recommended way by QNAP to tell the App Center about the service's status is to use PID files, but at the moment as we don't know how the state of the service is, we can't be sure whether the PID taken from the runtime is correct or not. So I decided to wait until the maintainers of openHAB or Karaf add an option to wait for the service until it is almost completely started, so I can use the PID files correctly.

As the App hangs now in off mode in the App Center it might be needed to start the service after reboot. After that it won't be needed to touch the switch again :wink:

nodecentral commented 7 years ago

Thanks,

QQ: What is the command line to restart openHAB qpkg ?

Or do you need to do the two commands mentioned above - to stop and then start again ?

/etc/init/openHAB.sh stop /etc/init/openHAB.sh start

Nether of the above commands worked "No such file or directory" or the following (where the file is)

/share/CACHEDEV1_DATA/.qpkg/openHAB/openHAB.sh start /share/CACHEDEV1_DATA/.qpkg/openHAB/openHAB.sh stop

I'm trying to add a Hue bridge and it seems to suggest I need to restart the service (and this will likely be a recurring thing as things need to be added/changed)

thopiekar commented 7 years ago

No problem.

The best is to do a stop. Wait for a while, because my script doesn't know when the service is really of (as I described before). And then do a start. If you've got Entware installed you can install htop and check whether openHAB is running or not: Eg. by sorting via memory usage: (openHAB should be one of the fattest applications here) htop_nofilter

or filtering via [F4]: htop_filter1

Hope it helps

PS: Oopss..

nodecentral commented 7 years ago

Hi

Thanks so much for your prompt responses :)

I'm afraid I've not got Entware installed - but if possible is there a simple command line I can use?

I'd like to try and create a simple script (via my iOS workflow app) to stop and then wait a 1 minute before sending a start command ?

thopiekar commented 7 years ago

Yes, 1 minute sounds good. If you don't hurry, you can also try to use a greater time range. Just to be sure ;)

nodecentral commented 7 years ago

Could you help me with the command line I would use?

nodecentral commented 7 years ago

Ohh maybe some progress..

[/] # /etc/init.d/openHAB.sh restart stop: Ignoring predefined value for KARAF_HOME Java HotSpot(TM) Embedded Server VM warning: G1 GC is disabled in this release. start: Ignoring predefined value for KARAF_HOME [/] #

thopiekar commented 7 years ago

Yes, there is a restart command, but it won't wait until the service is shut down and start a new one in the meantime.

I would suggest to do:

/etc/init.d/openHAB.sh stop
sleep 90
/etc/init.d/openHAB.sh start

This will stop openHAB, wait for 90sec and start it again.

thopiekar commented 7 years ago

Does it work?

nodecentral commented 7 years ago

It seems to be ok with the stop command, but sadly i get this when i try to start command?

[/] # /etc/init.d/openHAB.sh start openHAB is disabled.

nodecentral commented 7 years ago

if i click on the start option button under the openHAB icon under App Centre that seems to start it up? any ideas..

thopiekar commented 7 years ago

Yes, clicking in the AppCenter should work then. But don't get confused and click another time, if it falls back to "turned off" or "disabled" (However it was called before..). Just let the service start for a while...

Stefan136 commented 7 years ago

Hello, I got the same problem on my QNAP. After QNAP restart the OpenHAB App isn't working anymore. I tried to stop/start from via SSH but fail with below Java Message - any clue?

[/etc/init.d] # ./openHAB.sh stop JAVA_HOME is: /usr/local/jre [/etc/init.d] # ./openHAB.sh start JAVA_HOME is: /usr/local/jre [/etc/init.d] #

thopiekar commented 7 years ago

The message is intended. It is only an indicator, which Java installation you are using. The openHAB.sh script is now able to download the latest version of Java incl. SSL certificates, which is needed to connect to the openHAB Cloud.

thopiekar commented 7 years ago

With the 2.0.0-2 package you shall be able to set the http and https port to a port you like. Just create config/qpkg/http.port or config/qpkg/https.port and write only the port number into these files. Re-/starting openHAB should use these ports then.

(Currently practically untested, but should work.)

Kaskadeur111 commented 7 years ago

2.0.0-1 works just fine even after 2 Weeks of daylie restarts. 2.0.0-2 is dead after restart and i get this message "Port 8090 or 8444 already in use". But thats definately not the case. I even changed the Ports of Openhab to 8099 or 64322. After changing, stopping and starting Openhab Package everythin is fine and i can access openhab through this new ports... But after restarting the NAS (TS-253A) Openhab is unreachable and i get the message "Port 64322 or 25446 already in use" ... no matter which ports i use, after restart Openhab is dead. So i dont Think this is a Port issue as 2.0.0-1 works flawless. Hope i could help someway :-)

peelos commented 7 years ago

fixed in 2.0.0-3 I believe

Cadsters commented 7 years ago

I'm sorry to say that the issue discribed by Kaskadeur111 is stil there. I'm on the same type of nas (TS-253a).

Kaskadeur111 commented 7 years ago

I need to say. I installed 2.0.0.3 and i dont have this problem anymore. Mysterious. 2.0.0.3 restarted about one week once a day... Openhab works fine everytime.