Problem getting exec binding to execute command

i’ve tried changing the command to a simple mkdir command to create a folder in the home directory of the user that openhab is running under on the openhab server. That rendered the same results. Do we have others here who have a working exec binding?

This is massively basic, but you do have the exec binding jar in your addons folder, right? It seems odd that you are getting no feedback whatsoever.

Perhaps try running openHAB as root and see if that makes a difference, i.e. to eliminate potential permissions issues?

How can I be sure i’m running as root? I’ve done a clean install while logged in as root. Will that do it? I’m not sure if there are any other steps I need to take? After running the install as root, the results are the same.

I’m wondering if I need to try a different linux distrobution? Maybe I should try debian or an older ubuntu server edition.

edit /etc/default/openhab

The fifth line probably reads:

USER_AND_GROUP=openhab:openhab

change the last bit so it reads “root:root” and restart. Then openHAB should be running as root

BINGO! Looks like I had a permissions issue all along, which I guess isn’t too surprising to me, I just didn’t know the correct way to change the running user. Big thanks to Dan12345 for filling me on on how to change the openhab user. I should also thank rlkoshak since he was one of the first post replies that told me to check the OpenHAB user and I just assumed that it was running under the account that I started it from.

So relieved to have this fixed, was driving me nuts.

excellent - you’re very welcome!

Related to the topics you solved in this thread.

I did a clean fresh install on a new SD card. I was running Raspian Debian Wheezy and want to run Debian Jessie.

The openHAB installation went well but I came across a problem which I have not seen before. As I am also using some scripts I need to change the user and group to root

 USER_AND_GROUP=root:root

In Debian Jessie I get the following error when trying to start openHAB

root@raspberryPI:/etc/init.d# systemctl status openhab -l
● 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

Oct 16 17:52:01 raspberryPI openhab.sh[4220]: 2015-10-16 17:52:01.382 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Stopped Classic UI
Oct 16 17:52:01 raspberryPI systemd[1]: Stopped Starts and stops the openHAB Home Automation Bus.
Oct 16 17:52:06 raspberryPI systemd[1]: Starting Starts and stops the openHAB Home Automation Bus…
Oct 16 17:52:06 raspberryPI setpermissions.sh[5173]: setting permissions and owner root:root recursively for /var/lib/openhab
Oct 16 17:52:07 raspberryPI setpermissions.sh[5173]: setting permissions and owner root:root recursively for /var/log/openhab
Oct 16 17:52:07 raspberryPI setpermissions.sh[5173]: setting permissions and owner root:root for /usr/share/openhab/webapps/static
Oct 16 17:52:07 raspberryPI setpermissions.sh[5173]: setting permissions and owner root:root for /etc/openhab/jetty/etc/keystore
Oct 16 17:52:07 raspberryPI setpermissions.sh[5173]: setting permissions and owner root:root for /etc/openhab/configurations/users.cfg
Oct 16 17:52:07 raspberryPI systemd[1]: Started Starts and stops the openHAB Home Automation Bus.
> Oct 16 17:52:08 raspberryPI openhab.sh[5381]: Invalid Configuration LocationThe configuration area at ‘/var/lib/openhab/workspace’ is not writable. Please choose a writable location using the ‘-configuration’ command line option.

Somehow the /var/lib/openhab/workspace is not writeable? Anybody has an idea?

Have you enabled the root user (set a password and can log onto the
terminal as root)?

No have not an account for root / is it required in Jessie? Also have not set it up on the wheezy

To find a solution I did now enable the root account (incl. password). This results in the same behavior as above (/var/lib/openhab/workspace not writeable)

So, what are the permissions on that folder? Can you cd, ls, touch a file in it, etc?

On my install that folder is owned by openhab:openhab and has drwxr-xr-x permissions. So theoretically only root and the openhab user should be able to write to it. But with you running as root there should be no problem unless the permissions are really messed up, or the folder doesn’t exist.

That seems all to be ok - for openhab and root.

When having set USER_AND_GROUP=openhab:openhab the following

root@raspberryPI:/var/lib/openhab/workspace# ls -la
total 24
drwxr-xr-x 6 openhab openhab 4096 Oct 16 22:49 .
drwxr-xr-x 4 openhab openhab 4096 Oct 16 15:58 …
drwxr-xr-x 3 openhab openhab 4096 Oct 16 22:40 .metadata
drwxr-xr-x 3 openhab openhab 4096 Oct 16 15:59 org.eclipse.core.runtime
drwxr-xr-x 3 openhab openhab 4096 Oct 16 15:59 org.eclipse.equinox.app
drwxr-xr-x 3 openhab openhab 4096 Oct 16 22:49 org.eclipse.osgi

When having set USER_AND_GROUP=root:root the following:

drwxr-xr-x 6 root root 4096 Oct 16 22:49 .
drwxr-xr-x 4 root root 4096 Oct 16 15:58 …
drwxr-xr-x 3 root root 4096 Oct 16 22:40 .metadata
drwxr-xr-x 3 root root 4096 Oct 16 15:59 org.eclipse.core.runtime
drwxr-xr-x 3 root root 4096 Oct 16 15:59 org.eclipse.equinox.app
drwxr-xr-x 4 root root 4096 Oct 16 22:51 org.eclipse.osgi

What about the workspace folder itself?

Not convinced anymore that it is a problem but not sure what else it could be.

That folder is also good - permissions are set accordingly (root and openhab).

Well, hope somebody had similar issues with Jessie Debian (and found a solution)

Total WAG. What happens if you stop OH, rename the workspace folder to something else (e.g. workspace.broken), and start it again.

If my suspicion is correct, everything in that folder gets autogenerated so it will get recreated the next time OH starts. It’s the last little trick in my bag.

Have not thought of that WAG. Sounds like worth a try …

  • Start OH as USER_AND_GROUP=openhab:openhab
  • No workspace dir present
  • Result: Directory is created and OH runs. When I stop and start OH again with root:root it runs into the same problems (not able to write to /var/lib/openhab/workspace)

  • Start OH as USER_AND_GROUP=root:root
  • No workspace dir present
  • Result: Directory cannot be created (error - see below).

Oct 17 08:48:53 raspberryPI openhab.sh[25384]: Invalid Configuration LocationThe configuration area at ‘/var/lib/openhab/workspace’ could not be created. Please choose a writable location using the ‘-configuration’ command line option.


I am puzzled here and imho it seems that when running in root:root setup the java process does not have the right permissions for the /var/lib/openhab/workspace dir …? Again I have not seen this on Wheezy only on the (fresh) Jessie distr.

OK finally got it figured out (SOLVED) - to sum things up:

When changing USER_AND_GROUP on Raspian Jessie Debian distr. to root do the following:

1> /etc/default/openhab - change to root (USER_AND_GROUP=root:root)
2> /usr/lib/systemd/system/openhab.service
- change user and group inside the file
User=root
Group=root
- systemctl daemon-reload
- systemctl start openhab

Pretty simple when you know what to change. Maybe we can document it somewhere?

4 Likes

Interesting. So Raspian Jessie appears to have transitioned to systemd instead of Upstart. Good to know.

I’ve left my Pis on Wheezy for now. It works and I don’t want to mess with it for an update that doesn’t really do much for me just yet.