My 1.8.1 no longer starts as service

Something I did yesterday broke openhab running as a service.
I rebooted my Rpi this AM and openhab wasn’t running and would no longer start with:

The error:

pi@rpiopenhab:~ $ sudo systemctl start openhab -l
Job for openhab.service failed. See 'systemctl status openhab.service' and 'journalctl -xn' for details.
pi@rpiopenhab:~ $ sudo systemctl status openhab.service
● openhab.service - Starts and stops the openHAB Home Automation Bus
   Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled)
   Active: failed (Result: exit-code) since Sat 2016-02-06 09:20:05 CST; 8s ago
     Docs: http://www.openhab.org
  Process: 4717 ExecStartPre=/usr/share/openhab/bin/setpermissions.sh (code=exited, status=203/EXEC)

Feb 06 09:20:05 rpiopenhab systemd[1]: openhab.service: control process exited, code=exited status=203
Feb 06 09:20:05 rpiopenhab systemd[1]: Failed to start Starts and stops the openHAB Home Automation Bus.
Feb 06 09:20:05 rpiopenhab systemd[1]: Unit openhab.service entered failed state.

Prior to yesterday I was running 1.8 but having problems with MQTT and my GUI wasn’t working - which were fixed yesterday when I upgraded to 1.8.1.

How I was running openhab as a service after that yesterday I don’t know - maybe I did something else later that I can’t recall.

I now figured out that I can run openhab manually using:
sudo /usr/share/openhab/bin/openhab.sh^

I want to run as a service again and am suspecting a permissions thing but tried the following with no joy:

sudo chown -hR :openhab /etc/openhab
sudo chown -hR :openhab /usr/share/openhab
#that didn't fix
sudo chmod -R g+w /etc/openhab
sudo chmod -R g+w /usr/share/openhab
#that didn't fix either
sudo chown -hR openhab:openhab /etc/openhab
sudo chown -hR openhab:openhab /usr/share/openhab

Ideas? I don’t understand how services get run under user accounts or where that is set.

How did you upgrade? Was this using the apt-get install method or did you manually install and create your own service script?

Good point.
Original install was apt-get
and upgrade was apt-get

Unfortunately I do it manually so I’m not familiar with the apt-get scripts.

Does setpermissions.sh exist and is it still executable?

Yes, setpermissions.sh exists, is executable by Anyone and it DOES run if I run:
sudo openhab.sh
(openhab.sh calls setpermissions.sh)

[edit: I later found my above statement to be incorrect and that openhab.sh does not call setpermissions.sh]
[so the following where I thought the difference was just the user is probably not correct]

So I suspect the service (however that is configured) runs openhab.sh with user openhab (or something other than root) and something in the setpermissions.sh script (like lots of chown and chmod calls) are not allowed by that services user.

So maybe I somehow changed the rights of a file (or a directory) so that openhab no longer has rights but know of chown openhab:openhab on everything I can think of.

You got me thinking - I am going to walk through all the directories and ownership again…

I ended up burning too many hours on this and decided to rebuild Raspberry Pi from clean OS.
Did that, applied new apt-get of 1.8.1
Copied my config files and things are working fine again.

Nice to have everything starting as a service again but difficult to know when to to keep trying and when to throw in the towel.

I am also facing the same situation once i updated RPi.
However, I installed openhab manually in a separate folder so update should not affect my installation.

After rebooting i am also facing the same issue and in my case there is no /usr/share/openhab directory

I believe that if you used the apt-get method for installing and upgrading openHAB 1.8 on your Raspberry Pi, issues like these would not occur.

Thanks Watou
I am gonna do that now as i have no other option left.