Location of directory userdata is unclear for bin/client

  • Platform information:
    • Hardware: raspberry pi 2
    • OS: _raspbian
    • Java Runtime Environment: 1.8.0_162 (I guess Oracle?)
    • openHAB version: 2.4.0
  • Issue of the topic:
    There seems to be two places where the userdata directory is defined:
    #1. in /etc/init.d/openhab2 (OPENHAB_USERDATA=/var/lib/openhab2)
    #2. in /usr/share/openhab2/runtime/bin/oh2_dir_layout (OPENHAB_USERDATA=${OPENHAB_HOME}/userdata
    This (#2) gives /usr/share/openhab2/userdata.
    When I start /usr/share/openhab2/runtime/bin/client, I get an error:
    KARAF_BASE is not valid: /usr/share/openhab2/userdata.

I had this error in Openhab 2.3.0. And because I didn’t want to solve it in an old version, I upgraded (apt-get upgrade) to 2.4.0.
The first hours I did not have the problem, but a day later a had this error when I started the client.

What’s the version of Raspbian? :slight_smile:

The current Raspbian Image should use systemd instead of init. Myabe there is something mixed up in your installation.

Please don’t start openHAB directly but only as a service.
Using init it would be

sudo service openhab2 start

or

sudo /etc/init.d/openhab2 start

Using systemd it would be

sudo systemctl start openhab2.service

Please consider to backup your configuration and start from scratch - i.e. install a new raspbian image, install openHAB2… or, even simpler, use openHABian to setup a new system (openHABian will install Raspbian first, then setup the whole system to use openHAB2, there is a config-script to do all the stuff that is needed…)

Hi @cvdenzen,

The file in /usr/share/openhab2 is written for all operating systems and does not change, essentially:

If $OPENHAB_USERDATA doesn’t exist by now, set it $OPENHAB_HOME/runtime.

For packaged installations, this is set through the init.d or systemd service scripts.

You may also find the openhab-cli commands useful:

openhab-cli info

Thank you for the answers. There were some other strange things that could be related to a bad SD card. I ordered a new SD card and will do a fresh install with the latest Raspbian and OpenHAB. I am not (yet) going to use OpenHABian, that would be a too big change for me at this moment.
A backup should not be needed as everything is in github and sourceforge. And the old SD card is the second backup.

1 Like

No SD card problem.
Problem was linux environment, sudo not inheriting its environment (without -E option).

Solved!

Hi.
I have the same issue. Could you please clarify how did you solve it? I do not have very good idea on linux environment.