Openhab Web services stops and needs manual restarting

I have installed Openhab recently and it worked well for a couple of days then started to play up. It seemed like it would hang and I needed to restart to get it back to to work. Then I read somewhere about clearing cache. I did that and since then the web services goes down regularly. I then need to run this command to bring the web services back online so I can access via the web.

sudo openhab-cli start

Even the I can’t access via web, I can still SSH into the PI and I can access all files through network and Visual Studio but the.

Also, the command line seems to change from Openhabian to Openhab after I run the command as well. See screenshot attached. Not sure what that means.

Another thing to note, I installed Openhab on a Micros SD card then moved system root a USB drive through “37 | Move Root To USB” feature in Config.

Clearly, I am new to this so any help would be highly appreciated.

On the pi you need to use the command sudo systemctl start openhab. OpenHAB will start automatically after a reboot.

The command you are using is not starting it as a service it is starting it in a separate process that is why you see the window change to openHAB. You are getting into the openHAB console vs the Linux console.

Do this reboot the pi then after a few mins once the web ui is running, ssh into the pi and run sudo systemctl status openhab2 make sure openHAB is running.

The next time you experience the web service stop you can log in and run the status command if it’s not running you can then review the logs and try to restart.

Thanks @Thedannymullen

Just so I get the steps right, are you suggesting, I run “sudo systemctl start openhab” after I reboot the PI? Will this set Openhab to start on startup?

And this command "“sudo systemctl status openhab2"” to check the status of openhab web service whether it’s running or not?

no need to do that after boot, openhab normally starts automatically. even if you stopped it before to clear the cache.

for example before i create a backup of the comlete sd-card, i stop openhab with:

sudo systemctl stop openhab2

then i run my backup and when finished i start openhab again with

sudo systemctl start openhab2

i can check the state with:

sudo systemctl status openhab2

It was running for a few hours then again the same problem, can’t access it via web but can access SSH, local network or Visual Studio Code. Ran “sudo systemctl status openhab2” and looks like everything is working fine. See image below.

Ran this command “sudo systemctl start openhab2” but it doesn’t come back online.

When I try to access the UI from the web, I get the following:

This site can’t be reached

openhab refused to connect.

take a look into the logs (mainly openhab.log).

and prvide the errrors/exceptions here (use proper formatting ).

screenshots are mostly not helpful.

and finally, openhab runs as a service and adds a listener to access the webui via browser. it is not a web service.

Thanks @HaKuNa.

I used this command to get the log:
tail -f /var/log/openhab2/openhab.log

This is what I got so far:

[18:27:24] openhabian@openhab : ~ $ tail -f /var/log/openhab2/openhab.log -f /var/log/openhab2/events.log

==> /var/log/openhab2/openhab.log <==

2020-04-10 17:26:56.004 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Set random image URLs’: The name ‘urlList’ cannot be resolved to an item or type; line 135, column 15, length 7

2020-04-10 17:26:56.004 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Set random image URLs’: The name ‘urlList’ cannot be resolved to an item or type; line 135, column 15, length 7

2020-04-10 17:26:56.006 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Set random image URLs’: The name ‘resList’ cannot be resolved to an item or type; line 136, column 15, length 7

2020-04-10 17:27:18.764 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Set random image URLs’: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ArrayExtensions.length(java.lang.Object[]) on instance: null

2020-04-10 17:27:18.766 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Set random image URLs’: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ArrayExtensions.length(java.lang.Object[]) on instance: null

2020-04-10 17:27:18.787 [WARN ] [nce.extensions.PersistenceExtensions] - There is no queryable persistence service registered with the id ‘rrd4j’

2020-04-10 17:27:18.797 [WARN ] [nce.extensions.PersistenceExtensions] - There is no queryable persistence service registered with the id ‘rrd4j’

2020-04-10 17:27:18.805 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule ‘Set daily max and min temperature’: null

2020-04-10 17:27:23.442 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing ‘openhab-binding-4491519’

2020-04-10 17:27:46.780 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing ‘openhab-binding-4491519’

Hope this gives some insights into what’s going on.

Tried to use the < code > to format the code. Hope I did it right. :slight_smile:

The logs show an error in a rules file. I would remove that file by renaming for now see if openHAB runs for a while. This is most likely the source of at least one issue.

You can debug the rules file at a later time. But it would be good to see if openhab can run with no issues with this rule file renamed.

Tips on the systecmctl command. There is a few things you can do.
-start - starts something that is not running
-stop - stops something
-restart - stops then restarts
-status - give the status.

Thanks @Thedannymullen. I wouldn’t know where the rules file is and what’s it called. Would you able to point me to the right direction?

1 Like

This also is bad. It’s complaining about trying to install a non-existent binding. This must be fixed as there’s a slow memory leak somewhere in openHAB core, which occurs each time the binding installation fails (which is every minute).

I don’t know enough about your setup to tell you. Usually in the rules folder.

@xclusive: it looks like you do not have the basics. please go to https://dev.to/javinpaul/5-free-courses-to-learn-linux-for-beginners-367f and come back when you have openhab specific questions.

1 Like