OpenHAB not auto starting after reboot

I am not strong in Linux, and I know there are several ways of doing things, but I want to do it the “OpenHAB way.”

I followed this guide, and every time I reboot my RPi, I need to log in and manually start OpenHAB. How do I set OpenHAB to autostart? I spoke with the author of the guide and he is under the impression that simply following his steps should automatically set it to start.

Take a look:

The Sample-Tricks are very helpful for beginners projects!

1 Like

Thank you for your reply,

I read through that and frankly a lot of the lines confuse.me. I am running OpenHAB on Raspbian Jesse and what I have done so far with the above walkthrough seems to have already created a service. I just need to know the recommended way to set it to auto start.

pi@OpenHAB ~ $ sudo service openhab status
● openhab.service - Starts and stops the openHAB Home Automation Bus
   Loaded: loaded (/usr/lib/systemd/system/openhab.service; disabled)
   Active: active (running) since Wed 2015-10-21 20:38:11 CDT; 1 day 13h ago
     Docs: http://www.openhab.org
  Process: 1702 ExecStartPre=/usr/share/openhab/bin/setpermissions.sh (code=exited, status=0/SUCCESS)
 Main PID: 1898 (openhab.sh)
   CGroup: /system.slice/openhab.service
           ├─1898 /bin/sh /usr/share/openhab/bin/openhab.sh -o
           └─1919 /usr/bin/java -Dlogback.configurationFile=/etc/openhab/logback.xml -Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=8080 -Dopenhab.configfile=/etc/openhab/configurations/openhab.cfg -Dop...

Oct 23 10:14:53 OpenHAB openhab.sh[1898]: 2015-10-23 10:14:53.616 [INFO ] [runtime.busevents             ] - Nest_last_connection state updated to 2015-10-23T09:22:38
Oct 23 10:14:53 OpenHAB openhab.sh[1898]: 2015-10-23 10:14:53.621 [INFO ] [runtime.busevents             ] - NestHumidity state updated to 45
Oct 23 10:14:53 OpenHAB openhab.sh[1898]: 2015-10-23 10:14:53.625 [INFO ] [runtime.busevents             ] - Nest_target_temp_f state updated to 74
Oct 23 10:14:53 OpenHAB openhab.sh[1898]: 2015-10-23 10:14:53.629 [INFO ] [runtime.busevents             ] - Nest_hvac_state state updated to off
Oct 23 10:15:54 OpenHAB openhab.sh[1898]: 2015-10-23 10:15:54.545 [INFO ] [runtime.busevents             ] - Nest_temperature_scale state updated to F
Oct 23 10:15:54 OpenHAB openhab.sh[1898]: 2015-10-23 10:15:54.548 [INFO ] [runtime.busevents             ] - NestAmbTemp state updated to 74
Oct 23 10:15:54 OpenHAB openhab.sh[1898]: 2015-10-23 10:15:54.552 [INFO ] [runtime.busevents             ] - Nest_last_connection state updated to 2015-10-23T09:22:38
Oct 23 10:15:54 OpenHAB openhab.sh[1898]: 2015-10-23 10:15:54.556 [INFO ] [runtime.busevents             ] - NestHumidity state updated to 45
Oct 23 10:15:54 OpenHAB openhab.sh[1898]: 2015-10-23 10:15:54.558 [INFO ] [runtime.busevents             ] - Nest_target_temp_f state updated to 74
Oct 23 10:15:54 OpenHAB openhab.sh[1898]: 2015-10-23 10:15:54.560 [INFO ] [runtime.busevents             ] - Nest_hvac_state state updated to off

Apparently you’re using systemd to start your services. I have not much experience with it, but according to this page, you can use

# systemctl enable openhab.service

to start a service at boot. You might also want to use

# systemctl is-enabled openhab.service

to check whether your service is enabled.

HTH,
-Mathias

2 Likes

Did you follow the official instructions (specifically step 8) for enabling startup on boot?

As good as the external guides are, they can still leave out important details compared to the official documentation.

1 Like

Thank you @watou and @gonium. This was indeed my issue. OpenHAB is now starting as expected. I have also notified the author of the oversight in hopes of sparing others the frustration. I will now review the official guide and make sure nothing else is missed.

Hey, I am facing the same issue, can you clarify what did you change??