Start Up Error (no log, KARAF_HOME, openhab2.service)

My Openhab2 isnt starting since the first installation. For the first runtime it worked, after this is get the following errorlog.

Its running on a Raspberry Pi 3, Raspbian, Snapshot Release

Thats all running on a Raspbee Image togethter with Homegear. It was working an a very old snapshot release, now i tried to port it to a newer release. Can someone help me?

maybe it has something to do with the following post?

syslog

Jan 15 09:00:35 raspberrypi systemd[1]: Starting openHAB 2 - empowering the smart home...
Jan 15 09:00:35 raspberrypi systemd[1]: Started openHAB 2 - empowering the smart home.
Jan 15 09:00:35 raspberrypi start.sh[23099]: Launching the openHAB runtime...
Jan 15 09:00:37 raspberrypi start.sh[23099]: /var/log/openhab2/openhab.log (No such file or directory)
Jan 15 09:00:37 raspberrypi systemd[1]: openhab2.service: main process exited, code=exited, status=255/n/a
Jan 15 09:00:38 raspberrypi stop[23239]: stop: Ignoring predefined value for KARAF_HOME
Jan 15 09:00:39 raspberrypi stop[23239]: Can't connect to the container. The container is not running.
Jan 15 09:00:39 raspberrypi systemd[1]: openhab2.service: control process exited, code=exited status=1
Jan 15 09:00:39 raspberrypi systemd[1]: Unit openhab2.service entered failed state.
Jan 15 09:00:40 raspberrypi systemd[1]: openhab2.service holdoff time over, scheduling restart.
Jan 15 09:00:40 raspberrypi systemd[1]: Stopping openHAB 2 - empowering the smart home...

java -version

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)

sudo /bin/systemctl status openhab2.service -l

â—Ź openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
   Active: active (running) since Sun 2017-01-15 08:57:21 CET; 96ms ago
     Docs: http://docs.openhab.org
           https://community.openhab.org
  Process: 9142 ExecStop=/usr/share/openhab2/runtime/bin/stop (code=exited, stat                    us=1/FAILURE)
 Main PID: 9294 (karaf)
   CGroup: /system.slice/openhab2.service
           ├─9294 /bin/bash /usr/share/openhab2/runtime/bin/karaf server
           ├─9321 /bin/bash /usr/share/openhab2/runtime/bin/karaf server
           ├─9323 /bin/bash /usr/share/openhab2/runtime/bin/karaf server
           ├─9324 /bin/bash /usr/share/openhab2/runtime/bin/karaf server
           ├─9328 /bin/bash /usr/share/openhab2/runtime/bin/karaf server
           └─9329 expr lrwxrwxrwx 1 root root 22 Nov 25 18:51 /usr/bin/java -> /                    etc/alternatives/java : .*-> \(.*\)$

Jan 15 08:57:21 raspberrypi systemd[1]: Started openHAB 2 - empowering the smart                     home.
Jan 15 08:57:21 raspberrypi start.sh[9294]: Launching the openHAB runtime...

The latest snapshot should create log folder for you. Are your running /var/log as a TMPFS?

Try:

sudo mkdir -p /var/log/openhab2
sudo touch /var/log/openhab2/openhab.log
sudo chown -R openhab:openhab /var/log/openhab2

thank you seems to work now. I still have to do some testing but looks good. I didnt thought the error would be so simple, thats why i didnt test this solution by my self. :confused:

There seems to be something wrong with the apt installation, because i tried this on two fresh image and i was able to reproduce this error…

It might be how your /var/log folder is mounted, if it clears on each boot etc. I can’t seem to reproduce this problem on a normal RPi3 / OH setup.

If you keep running into this problem, it may be best to put the above three lines into a boot script. Either way, let me know how you get on!

yup every restart only the openhab log folder is gone. Every other log folder even the homegear folder is still in place.
Iam not an expert with linux, so how can i fix this exactly? I tried to google this but it confuses me.

Did you ever run or used a tool that did what is written about /var/log/ here? i.e. if you run:

sudo cat /etc/fstab

Does /var/log/ appear as tmpfs? You can remove this line and reboot, create the folder one more time to see if this fixes the problem.

1 Like

okay thats it. thank you so much.

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
tmpfs           /var/tmp        tmpfs    nodev,nosuid,size=10M 0  0
tmpfs           /var/log        tmpfs    nodev,nosuid,size=10M 0  0

if someone else is running into this problem, This is how the file looks like. As described you have to remove the last column…

No problem, but I would like to mention what that particular line does.

TMPFS stops the files in that directory from being written to disk. It gets written to ram instead, many people using SD cards like to have this feature as SD lifespan is limited to number of writes.

One of the side effects as you have seen is that all info in that folder is lost on reboot, so for programs that need files in there, one will have to run a script at boot to create the directory and handle ownership.

Hope that makes things clearer about what happened.

2 Likes

Removing the last line will solve your boot problem but your log folder will go back to the sdcard reducing drasticaly its lifetime as detailled by @Benjy.

Here is a solution that worked for me (add the folder creation into crontab):
sudo crontab -e
add the following lines:
@reboot mkdir /var/log/openhab2
@reboot chown -R openhab:openhab /var/log/openhab2

1 Like