[Solved] Unable to start OH2 as user "openhab"


I am running OH2 on Ubuntu 14.04.5 LTS for a while now (with several snapshots, currently with build #643) but I am not able to start it via /usr/share/openhab2/runtime/bin/start as the user “openhab” or start it as a service as root. Therefore I alwas have to start it manually by running /usr/share/openhab2/runtime/bin/start as root which works flawless. Today evening I’ve had some time trying to find the cause of this problem, but without success. The effective command composed by the startscript is

/usr/lib/jvm/jdk-8-oracle-x64/jre/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/lib/openhab2/config -Dorg.osgi.service.http.port=8090 -Dorg.osgi.service.http.port.secure=8443 -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime  -Dkaraf.data=/var/lib/openhab2 -Dkaraf.etc=/var/lib/openhab2/etc -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/lib/openhab2/config -Dorg.osgi.service.http.port=8090 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Djava.awt.headless=true -XX:+UseG1GC -Dkaraf.instances=/usr/share/openhab2/runtime/instances -Dkaraf.home=/usr/share/openhab2/runtime -Dkaraf.base=/var/lib/openhab2  -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/var/lib/openhab2/tmp -Djava.util.logging.config.file=/var/lib/openhab2/etc/java.util.logging.properties -Djava.endorsed.dirs=/usr/lib/jvm/jdk-8-oracle-x64/jre/jre/lib/endorsed:/usr/lib/jvm/jdk-8-oracle-x64/jre/lib/endorsed:/usr/share/openhab2/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/jdk-8-oracle-x64/jre/jre/lib/ext:/usr/lib/jvm/jdk-8-oracle-x64/jre/lib/ext:/usr/share/openhab2/runtime/lib/ext  -Dkaraf.startLocalConsole=true  -classpath /usr/share/openhab2/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.0.4.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.jaas.boot-4.0.4.jar:/usr/share/openhab2/runtime/lib/boot/org.apache.karaf.main-4.0.4.jar:/usr/share/openhab2/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

As root this runs well, but as user “openhab” it just hangs without showing any error messages. There is not even a single line written to the console or into /var/log/openhab2/openhab.log even though the file is created when not present, but doen’t get filled with messages. Because of the lack of any messages while starting I am unable to track down the cause of the issue. Does anyone have an idea what could be the reason? Are there any options to get a verbose output while starting?

Thanks in advance for all hints!


Did you install via apt-get?

How are you trying to run it as a service?

If guess there is something messed up with permissions somewhere. I doubt there is anything to print out while it is starting up as I believe it is getting stuck before it would have anything to print.

Yes, I did

As root I issue:
service openhab2 start

I also do assume that there is some kind of permission issue. Is there any documentation on what needs to be read or even writeable for the openhab user?

If you installed using apt-get and you haven’t changed anything, all of the user permissions should be set up appropriately. I wonder if your install got corrupted somehow. Have you tried a purge and reinstall?

I haven’t tried to purge everything because I don’t want to lose my configs. I haven’t found a description what exactly to backup an restore to keep my config, yet. Is there some kind of documentation about that?

Purge won’t eliminate your configs. But you may have to reinstall/configure your add-ons again, depending on how you installed them in the first place. But it is easy enough to back them up if you are worried.

All you need is the stuff in /etc/openhab2. If you happened to have edited anything in /var/lib/openhab2/etc grab those as well.

Well, I think its more than that. For example the uuid and secret files needed for the myopenhab connection are located in other directories than the ones mentioned. And I’m afraid that there are even more files like that that I would lose when purging the openhab. Or doesn’t purging also remove all config files and directories?

Try running the start script when logged in with the openhab user with the debug option

/usr/share/openhab2/runtime/bin/start debug

If I remember well, the start script triggers the karaf script which parses this debug option at startup
I am not sure if the debug output is going to the console or the log file… I don’t have access not to my system to test this.

Those will be regenerated upon reinstall. Even if you backed them up you wouldn’t be able to use the backups. You must use the newly created files.

Purging typically leaves any files you have edited or created alone. But please do make a backup of /etc/openhab2 before doing so.

Everything in /var/lib/openhab2 is automatically generated. If you used PaperUI or Habmin for making some settings then those settings are stored in the DB located in /var/lib/openhab2. However, I don’t think that DB is all that backupable yet. BUT, if you have a corruption or permission problem, the problem will most likely be in that folder.

This is definitly NOT TRUE! I’ve purged the openhab package and it deleted all config files I created under /etc/openhab2/ and its subdirectorys; such as item configs, sitemap configs, rules configs etc! Thank god I have made a backup before!

Furthermore purging didn’t solve my problem, because it didn’t delete all OH2 directorys. Obviously some of them had the wrong permissions, but they were not fixed by purging and reinstalling. After reinstalling OH2 it still wasn’t able to start with the script / as an openhab user.

What solved the problem was to get a complete list of all files contained in the OH2 package:
dpkg -L openhab2-offline
And to change the owner of all files and directorys under the few top directories to “openhab”:

chown -R openhab /etc/openhab2
chown -R openhab /usr/share/openhab2
chown -R openhab /var/lib/openhab2

Afterwards I was able to start OH2 with command

service openhab2 status

as root as well as by calling


directly a user “openhab”.

kind regards,
Stephan Boldt