Openhab.service: Main process exited, code=exited, status=255/EXCEPTION

Hello, after clearing the cache (I turned off openhab and then clearing the cache (sudo openhab-cli clean-cache)). I can’t restart openhab anymore, it tries every 5 seconds to restart and I get this error “openhab.service: Main process exited, code=exited, status=255/EXCEPTION” every time…
Here is the debug I managed to get at +/- 4 seconds after booting :

sep 17 12:31:03 GC-Silent systemd[1]: Started openHAB - empowering the smart home.
sep 17 12:31:05 GC-Silent karaf[1482]: java.io.FileNotFoundException: /var/lib/openhab/tmp/karaf.pid (Permission non accor>
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.open0(Native Method)
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:126)
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.InstanceHelper.writePid(InstanceHelper.java:126)
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.Main.launch(Main.java:278)
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.Main.main(Main.java:183)
sep 17 12:31:05 GC-Silent karaf[1482]: java.lang.RuntimeException: /var/log/openhab/openhab.log (Permission non accordée)
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlerInternal>
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlersInterna>
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlers(Bootst>
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager.configureLogger(Bootstrap>
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.Main.launch(Main.java:279)
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.Main.main(Main.java:183)
sep 17 12:31:05 GC-Silent karaf[1482]: Caused by: java.io.FileNotFoundException: /var/log/openhab/openhab.log (Permission >
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.open0(Native Method)
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
sep 17 12:31:05 GC-Silent karaf[1482]:         at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager$SimpleFileHandler.open(Bo>
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager$SimpleFileHandler.<init>(>
sep 17 12:31:05 GC-Silent karaf[1482]:         at org.apache.karaf.main.util.BootstrapLogManager.getDefaultHandlerInternal>
sep 17 12:31:05 GC-Silent karaf[1482]:         ... 5 more
sep 17 12:31:07 GC-Silent karaf[1482]: !SESSION 2022-09-17 12:31:07.348 -----------------------------------------------
sep 17 12:31:07 GC-Silent karaf[1482]: eclipse.buildId=unknown
sep 17 12:31:07 GC-Silent karaf[1482]: java.version=11.0.15
sep 17 12:31:07 GC-Silent karaf[1482]: java.vendor=Azul Systems, Inc.
sep 17 12:31:07 GC-Silent karaf[1482]: BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=fr_BE
sep 17 12:31:07 GC-Silent karaf[1482]: !ENTRY org.eclipse.osgi 4 0 2022-09-17 12:31:07.382
sep 17 12:31:07 GC-Silent karaf[1482]: !MESSAGE Error reading configuration: /var/lib/openhab/cache/org.eclipse.osgi/.mana>
sep 17 12:31:07 GC-Silent karaf[1482]: !STACK 0
sep 17 12:31:07 GC-Silent karaf[1482]: java.io.FileNotFoundException: /var/lib/openhab/cache/org.eclipse.osgi/.manager/.fi>
sep 17 12:31:07 GC-Silent karaf[1482]:         at java.base/java.io.RandomAccessFile.open0(Native Method)
sep 17 12:31:07 GC-Silent karaf[1482]:         at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:345)
sep 17 12:31:07 GC-Silent karaf[1482]:         at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
sep 17 12:31:07 GC-Silent karaf[1482]:         at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:214)
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.internal.location.Locker_JavaNio.lock(Locker_JavaNio.ja>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.storagemanager.StorageManager.lock(StorageManager.java:>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:219>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:2211)
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.storage.Storage.<init>(Storage.java:256)
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:184)
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxConta>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:53)
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:>
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.apache.karaf.main.Main.launch(Main.java:291)
sep 17 12:31:07 GC-Silent karaf[1482]:         at org.apache.karaf.main.Main.main(Main.java:183)
sep 17 12:31:07 GC-Silent systemd[1]: openhab.service: Main process exited, code=exited, status=255/EXCEPTION
sep 17 12:31:07 GC-Silent systemd[1]: openhab.service: Failed with result 'exit-code'.
sep 17 12:31:07 GC-Silent systemd[1]: openhab.service: Consumed 2.241s CPU time.
sep 17 12:31:12 GC-Silent systemd[1]: openhab.service: Scheduled restart job, restart counter is at 1.
lines 1-54

Does anyone have a similar problem and can help me? I am on linux. Thanks in advance.

Check the permissions of the directories for the listed files as well as of the files themselves in case they exist:

ls -ld /var/log/openhab/ /var/log/openhab/openhab.log /var/lib/openhab/ /var/lib/openhab/tmp/ /var/lib/openhab/tmp/karaf.pid 
drwxrwxr-x 17 openhab openhab   4096 Aug  6 22:20 /var/lib/openhab/
drwxr-xr-x  8 openhab openhab   4096 Sep 11 15:09 /var/lib/openhab/tmp/
-rw-r--r--  1 openhab openhab      3 Aug  6 22:20 /var/lib/openhab/tmp/karaf.pid
drwxr-xr-x  1 openhab openhab   4096 Sep  6 08:30 /var/log/openhab/
-rw-r--r--  1 openhab openhab 503603 Sep 17 15:00 /var/log/openhab/openhab.log
1 Like

I’ll go take a look at that, thanks :upside_down_face:. Do you know what the access denial could have caused? And how can I restore access to the files to OpenHab? Thanks a lot !

I would assume that the file(s)/directory/(ies) is/are owned by root.
They should be owned by openhab. This could happen if a process is started by using root. The normal startup switches over to user openhab.
May be it is a glitch of what happened a few days ago when the jfrog repo was not available - but that is just a guess.

In case you use openhabian use the menu entry that is available to fix permissions.
In case you don’t use openhabian you manually need to fix the permissions using

sudo chown -R openhab:openhab /var/lib/openhab  /var/log/openhab
1 Like

Thank you for your interest in my problem. Know that the problem is solved thanks to you, a big thank you.

1 Like