ioBroker.docker icon indicating copy to clipboard operation
ioBroker.docker copied to clipboard

iobroker doesn't start when port 9001 is used by something else but Redis

Open slig2008 opened this issue 3 years ago • 5 comments

Hi,

I have just recently added a portainer agent to listen on 9001 (default) onto the machine iobroker was running in a container as well. As soon as iobroker now is to be restarted, the call into

iobroker object get system.adapter.admin.0 --pretty

will result in something like

The DB port  9001 is occupied by something that is not a Redis protocol server. Please check other software running on this port or, if you use iobroker, make sure to update to js-controller 2.0 or higher!

This then result in

/opt/scripts/iobroker_startup.sh: line 212: [: !=: unary operator expected

within Step 3 of 5 because of the following line:

https://github.com/buanet/ioBroker.docker/blob/d287a79e615d61cb92da9899f68c81c743681673/debian/scripts/iobroker_startup.sh#L212

slig2008 avatar Oct 08 '22 17:10 slig2008

Yes, ioBroker databases by default use port 9001, so the port should be free ... or needs to be changed

Apollon77 avatar Oct 08 '22 17:10 Apollon77

Yep, true, I just wasn't aware about the same and have now changed the portainer agents exposed port. Nevertheless, maybe the above line might be tuned in a way that, whenever the admin adapter comes back with an error, this error might be shown instead of the very generic failure because of the unary operator.

Thanks for your quick response and have a great weekend!

slig2008 avatar Oct 08 '22 17:10 slig2008

The reason for this error is not the already used port, as ioBroker is not started when the error occurs during startup script... But the mentioned error should already be fixed in upcoming beta version v7.1.0-beta.1 (not released yet).

Regards, André

buanet avatar Oct 08 '22 18:10 buanet

Ah, excellent, thanks a lot.

Have just had a look into the diff - I can see a lot changes from

if [ "$myVar" != condition ] 

to

if [ [ "$myVar" != condition ] ]

I might be totally wrong here, but I think when using != within [ [ ] ] now, there is a semantical change to then apply pattern matching, if the right hand side is not quoted. This might apply to all the lines using jq to read from json.

Thanks for all your great work and let me know if I am wrong here please.

Best regards

slig2008 avatar Oct 08 '22 22:10 slig2008

@slig2008 Thanks for the hint. The startup script changes are still work in progress. I agree to you, but as far as I tested it, it was working as it should :) However, I did some more work to the script (also fixed the quotation). Yesterdays tests looked good. Hopefully it will fix the "unary operator" issue...

Regards, André

buanet avatar Oct 12 '22 08:10 buanet

I think this is done now. V7.1.1 is available. Let me know if you are facing the "unary operator" issue again. I'll close this. Thank you.

buanet avatar Nov 01 '22 19:11 buanet