Autostart on Raspberry2 stopped working

Hi there.
I don’t know why, but autostart stopped working suddenly.
I used this tutorial: https://openhabdoc.readthedocs.org/de/latest/Autostart/
And it worked.

Today i restarted my PI and OH didn’t went online. And i can’t find why it won’t startup automatic. /etc/init.d/openhab start works fine

Try running:

sudo update-rc.d openhab defaults

This should put it back in the rc folders which controls what starts at boot.

And for your and other’s information, if you install openHAB using apt-get the configuration to start it at boot is all done for you.

More info on http://superuser.com/questions/852610/how-to-tell-which-services-run-at-startup-on-raspberry-pi-raspbian

That is what i did when installing with apt-get and that update-rc i did many times today.
Is there a way to look what is going wrong?

Look at /var/log/syslog for errors from upstart in starting openhab.

Look at openHAB’s log files to see if it is crashing due to an error. These are in /var/log/openhab/openhab.log.

service openhab status will tell you if it is running, stopped and something if there was an error.

Can’t find anything in the logs.

sudo service --status-all gives me [ - ] openhab

grep -nrI Default-Start /etc/init.d gives me /etc/init.d/openhab:6:# Default-Start: 2 3 4 5

So for me everything looks fine. But no autostart.

/etc/init.d/openhab status
● openhab.service - Starts and stops the openHAB Home Automation Bus Loaded: loaded (/usr/lib/systemd/system/openhab.service; disabled) Active: inactive (dead) Docs: http://www.openhab.org

The (dead) implies it crashed. What do the openhab logs say?

Can’t tell right now bc i’m omw 2 bed now :wink:

But a /etc/init.d/openhab start / stop works fine

Maybe some service that needs to be up and running BEFORE openHAB starts is delayed. I would look at order of services startup. Like /var/log/boot created by bootlogd…

Logs say nothing. Just normal shutdown:
2015-12-02 15:53:22.148 [INFO ] [penhab.io.rest.RESTApplication] - Stopped REST API 2015-12-02 15:53:26.197 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Stopped Classic UI

Moved priority to S99 … but changed nothing :frowning: no autostart

I meant /var/log/boot.log to show services on starup:

[ OK ] Started irqbalance daemon. Starting RPC bind service... Starting Network Time Service... Starting Preprocess NFS configuration... Starting GSSAPI Proxy Daemon... Starting Open Home Automation Bus... Starting Login Service... Starting D-Bus System Message Bus... [ OK ] Started D-Bus System Message Bus.

It is not a standard on Rpi, you need bootlogd if I am not mistaken. See here.

Or modify the start part of the openhab starting/stopping script to log something to learn if it gets invoked.

The hint with bootlogd helped me to find the “bug”
So bootlogd only logged (Nothing has been logged yet.) so i started to find out why.
and tadaaaaa … SystemD is my new friend :confused:
I don’t know why, but somehow with a update my Raspian switched to SystemD and i didn’t regcognized.

sudo systemctl enable openhab.service

And everything works fine.

But is it that every Raspian switches to SystemD as init? So maybe that documentation must be edited? ( https://openhabdoc.readthedocs.org/de/latest/Autostart/ )

2 Likes

They switched to SystemD when they released Jessie. Since Jessie is only a few months old almost everything you read out there will be for Wheezy.

A lot of people have experienced problems upgrading and running OH on Jessie so I think many on this forum are refusing to update.

oh okay. so i did that update bc my sd-card crashed and i had to start from scratch.

OMG.
I observed the same problem, checked all settings and followed your advice “sudo systemctl enable openhab.service”.
It did result in starting openhab after restart, HOWEVER it can’t be reached by a GUI. The AndroidAPP tells the items-file is empty, the browser tells the Sitemap is empty.
I am lost!

Are you sure OH is running? Are there errors printed to the logs?

Sure? NO. I checked service, it was reported running.
Like:

pi@OpusPi ~ $ service openhab status ● openhab.service - Starts and stops the openHAB Home Automation Bus Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled) Active: active (running) since Sun 2016-03-20 11:05:24 CET; 31s ago Docs: http://www.openhab.org Process: 483 ExecStartPre=/usr/share/openhab/bin/setpermissions.sh (code=exited, status=0/SUCCESS) Main PID: 1309 (openhab.sh) CGroup: /system.slice/openhab.service ├─1309 /bin/sh /usr/share/openhab/bin/openhab.sh -o └─1323 /usr/bin/java -Dlogback.configurationFile=/etc/openhab/logb...

My SetUp was using a manual installation (all in opt/openhab). However I did try to get the apt-get installation, which should be started manually and automatically using the same files (???, that’S what I understand from GitHub-Link). However that didn’t work (at least not the autostart part).
When using the “sudo systemctl enable openhab.service” the following is happening:
The “normal” logs in opt/openhab…are empty, instead I’m getting log-entries in var/log/openhab. It seems that openhab is started now automatically, however from a different location AND without my settings.
So I need to find the correct spot where mysettings should go.

OK, I found the correct spot as stated in the above GitHUB-Link (settings in: etc/openhab/configurations andAddons in :usr/share/openhab/addons).
Openhab starts with systemstart now. However the “old” way to start and stop while the system vis running is broken now. I assume that is because the script “openhab.conf” in still points to the old location of the source files. But where are they now for the apt-get installation?