Problem at Karaf - java

Hello,

I’m having problems after the upgrade after I did the OH2.4 release.

I deleted the cache files and after I restarted it, but KARAF and the IP:8080 stopped working.

I looked at the log files and appeared the following:

Jan 14 22:09:27 raspberrypi karaf[482]: Caused by: java.lang.RuntimeException: Karaf can’t startup, make sure the log file ca…denied)
Jan 14 22:09:27 raspberrypi karaf[482]: at org.apache.karaf.main.lock.SimpleFileLock.(SimpleFileLock.java:55)
Jan 14 22:09:27 raspberrypi karaf[482]: … 8 more
Jan 14 22:09:27 raspberrypi karaf[482]: Caused by: java.io.FileNotFoundException: /var/lib/openhab2/tmp/lock (Permission denied)"

any help will be appreciated!

Paulo

  • Platform information:
    • Hardware: Raspberry Pi 2 model B
    • OS: Raspbia GNU Linux 8
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 2.4

You may need to restart a few times and even do a reboot for everything to settle out.

sudo systemctl stop openhab2

sudo reboot

1 Like

I did it already 2 or 3 times… Will try again…

Did that already a couple of times, but it seems that nothenig changed:

● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
Active: active (running) since Ter 2019-01-15 08:10:46 -02; 26min ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Main PID: 480 (java)
CGroup: /system.slice/openhab2.service
└─480 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/…

Jan 15 08:11:02 raspberrypi karaf[480]: … 3 more
Jan 15 08:11:02 raspberrypi karaf[480]: Caused by: java.lang.RuntimeException: Karaf can’t startup, make sure the log file can be accessed and written by t…on denied)
Jan 15 08:11:02 raspberrypi karaf[480]: at org.apache.karaf.main.lock.SimpleFileLock.(SimpleFileLock.java:55)
Jan 15 08:11:02 raspberrypi karaf[480]: … 8 more
Jan 15 08:11:02 raspberrypi karaf[480]: Caused by: java.io.FileNotFoundException: /var/lib/openhab2/tmp/lock (Permission denied)
Jan 15 08:11:02 raspberrypi karaf[480]: at java.io.RandomAccessFile.open0(Native Method)
Jan 15 08:11:02 raspberrypi karaf[480]: at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
Jan 15 08:11:02 raspberrypi karaf[480]: at java.io.RandomAccessFile.(RandomAccessFile.java:243)
Jan 15 08:11:02 raspberrypi karaf[480]: at org.apache.karaf.main.lock.SimpleFileLock.(SimpleFileLock.java:53)
Jan 15 08:11:02 raspberrypi karaf[480]: … 8 more

What type of hardware are you on? If you’re using an SD card, perhaps it is failing.

1 Like

I’m using SD card, I’m sure it’s not failing.

I really don’t know what to do, maybe if I reinstall everything again will solve the problem?

How do you know that?

This might suggest some sort of permissions problem creating/accessing/deleting the lock file.

Jan 15 08:11:02 raspberrypi karaf[480]: Caused by: java.io.FileNotFoundException: /var/lib/openhab2/tmp/lock (Permission denied)

Try using the openhabian-config tool to fix permissions.

1 Like

I there were any kind of SD problem, I think that it will not respond to my commands consistently. I think that I would face other problems such as an unstable system. I really don’t feel that. The problem started after the upgrade to OH 2.4. Due to the new MQTT protocol I was following the procedures to make it work. But every change made things worse. After I deleted the cache Karaf and myIP:8080 stopped working…

Something I have found useful when I encounter odd problems that could result from a failing SD card is the command debsums. It doen’t provide definitive proof of a failing SD card, but it can provide supporting evidence.

Entered on the command line in an SSH session on my RPi 3B:

sudo debsums -s

From man debsums, Verify installed Debian package files against MD5 checksum lists from /var/lib/dpkg/info/*.md5sums.

[Updated to include comparable command for RPM-based linux distributions]
I am more familiar with the RPM packaging system, which offers an even better command for this sort of thing:

sudo rpm --verify

Not only does this command verify MD5 checksums, it also checks permissions of installed packages.

1 Like

To check permissions, what is the output of the command:

openhab-cli info
1 Like

I got this result:

Version: 2.4.0 (Build)

User: openhab (Active Process 472)
User Groups: openhab tty dialout audio bluetooth gpio

Directories: Folder Name | Path | User:Group
----------- | ---- | ----------
OPENHAB_HOME | /usr/share/openhab2 | openhab:openhab
OPENHAB_RUNTIME | /usr/share/openhab2/runtime | openhab:openhab
OPENHAB_USERDATA | /var/lib/openhab2 | openhab:pi
OPENHAB_CONF | /etc/openhab2 | openhab:openhab
OPENHAB_LOGDIR | /var/log/openhab2 | openhab:openhab

URLs: http://192.168.15.20:8080
https://192.168.15.20:8443

Let’s try bringing everything up to the same permissions:

sudo chown -R openhab:openhab /var/lib/openhab2
sudo systemctl restart openhab2
3 Likes

I did that, now I got better results but is seems to me that Karaf is still not active

● openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled)
Active: active (running) since Ter 2019-01-15 14:48:25 -02; 1min 6s ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Process: 14062 ExecStop=/usr/share/openhab2/runtime/bin/karaf stop (code=exited, status=3)
Main PID: 14180 (java)
CGroup: /system.slice/openhab2.service
└─14180 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/va…

Jan 15 14:48:25 raspberrypi systemd[1]: Started openHAB 2 - empowering the smart home.

BTW after this change, mypi:8080 started working!

There’s nothing to indicate there that the console isn’t working, perhaps it was still loading. What is the output of:

openhab-cli console

BTW, for text dumps on the forums please place the text inside three backticks:

```
For example paste text inside here.
```

just did that! It worked! thank you!!

1 Like

Solved it for me, thank you!