Systemctl fails to start raspi 3

Having issues getting systemctl to start the shell properly. I can manually start it fine with the shell continuously running. However when I try using systemctl enable openhab, I get the following error when I ping with systemctl status openhab

pi@openhab:~ $ sudo systemctl status openhab
● openhab.service - Starts and stops the openHAB Home Automation Bus
   Loaded: loaded (/lib/systemd/system/openhab.service; enabled)
   Active: failed (Result: start-limit) since Wed 2016-05-04 02:30:14 UTC; 28s ago
     Docs: http://www.openhab.org
  Process: 1809 ExecStart=/openhab/start.sh (code=exited, status=255)
 Main PID: 1809 (code=exited, status=255)

May 04 02:30:14 openhab systemd[1]: openhab.service: main process exited, code=exited, status=255/n/a
May 04 02:30:14 openhab systemd[1]: Unit openhab.service entered failed state.
May 04 02:30:14 openhab systemd[1]: openhab.service holdoff time over, scheduling restart.
May 04 02:30:14 openhab systemd[1]: Stopping Starts and stops the openHAB Home Automation Bus...
May 04 02:30:14 openhab systemd[1]: Starting Starts and stops the openHAB Home Automation Bus...
May 04 02:30:14 openhab systemd[1]: openhab.service start request repeated too quickly, refusing to start.
May 04 02:30:14 openhab systemd[1]: Failed to start Starts and stops the openHAB Home Automation Bus.
May 04 02:30:14 openhab systemd[1]: Unit openhab.service entered failed state.

Is it starting too quickly in the boot sequence? Does it need a delay or something?

You could try to enable
Wait for Network at Boot
in your raspi-config.

Tried that, didn’t solve it unfortunately.

I should have been a little more specific: it only seems to work when I execute /openhab/start.sh, if I try, for instance, sudo systemctl stop openhab and then sudo systemctl start openhab, I get the same failure error.

That means that OH keeps dying almost immediately upon starting and the .service file is configured to autorestart it.

Look in your /var/log/syslog for what OH is spitting out when systemctl tries to start it.

In my experience this is often caused by a permission problem. The .service file may be trying to start OH as a different user than you are when running it with start.sh and that user doens’t have permission to access something (e.g. open a socket, write to /var/log. etc).

That makes a lot of sense actually. Hopefully it is a typo, I will check when I get home. Thanks for the help!

You nailed it. my /openhab/userdata/logs/openhab.log was owned by root instead of the user openhab. Good to know about that log file! Everything starts up now. Thanks!