I just installed a Raspberry Pi with the latest version of openHABian & openHAB 2.4.0. and it works fine.
It seems by default the openHAB instance does not start automatically during the boot process. This post led me here. So /etc/init.d/openhab2 was already there. I just added the two lines below to boot routine by using sudo nano /etc/rc.local
# start openhab
When I reboot the Pi openHAB still does not come up. What am I missing here?
Raspbian uses systemd, not initd so I don’t think rc.local is used any more to control what boots and when.
To enable something to start when the machine boots one typically uses:
sudo systemctl enable openhab2
Thanks for clarification. I tried to do so, but when I reboot openHAB still does not come up. When I check the process with sudo systemctl status openhab2 It looks like this:
Do I need to fix the mentioned permission issue? If yes, how? Mar 06 21:32:54 openHABianPi karaf: Caused by: java.lang.RuntimeException: Karaf can’t startup, make sure the log file can be accessed and written by the user starting Karaf : /var/lib/openhab2/tmp/lock (Permission denied)
The lock file could be from an old startup that wasn’t cleaned up properly, you could rename (move the file into the same dir with a different name) and try restarting openhab and verify if the log reports the same errors.
I renamed the file with this command: sudo mv /var/lib/openhab2/tmp/lock /var/lib/openhab2/tmp/lock2
Then I did a reboot with sudo shutdown -r now
It seems the result is still the same:
What else can I do about it?
what do you get with?
sudo ls -ld /var/lib/openhab2/tmp
Maybe the directory doesn’t have the correct permissions? But that calls into question the entire installation - did it get wrong ownership somehow?
It looks like this:
When I start openHAB with openhab-cli start it works fine (as long as the service is not running yet with systemd), but it goes done as soon as I close the terminal session.
Those permissions are all wrong. That folder and all the files in it should be owned by the openhab user.
I think there is a “fix permissions” option in openhabian-config. If not there there is an option in openhab-cli. I forget which.
Alright, I found the option by using sudo openhabian-config
After finishing & reboot the process looks like this (As recommended to me by @rlkoshak above I used sudo systemctl enable openhab2 to make sure the process will be started during boot process):
openHAB is up now, I can toogle my items. Everything looks fine.
I think we are done. Thank you very much!
had a similar issue just now after updating to 2.5m2 - i used
and then it worked…
i think i caused it after starting openhad as root.
All good now
Yep, starting openhab as root leaves a bunch of root-owned files around.
I find I rarely have to do anything as root on my OH machine; I log in as the OH user and do the things I need to do, and if root is needed I’ll use sudo for that command. Keeps me from accidentally leaving a bunch of files around that OH won’t be able to manage when it runs normally.
i have same issues here. my openhab wont start… never had that.
i just stopped OH and “openhab-cli clean-cache”, wanted to get Homekit back. now nothing works…
30 mins later, i see no OH running in log
Apply Improvements -> Fix Permissions
Manual/Fresh Setup -> System Tweaks
openHAB Stable and Update
nothing helps… PLEASE HELP