Today I noticed that the openHab app didn’t show any data, so I restarted the Pi with sudo shutdown -r now. After that, it still wasn’t possible to reach openHab. After trying some service reboots, all logfiles of openhab were deleted. Then I started digging deeper. If I tried to start it, the following error appears:
openhabian@openhabian:~ $ sudo openhab-cli start --debug
A systemd service configuration exists...
Use 'sudo /bin/systemctl start openhab.service' to start an openHAB service
Launching an instance in this terminal..
Launching the openHAB runtime...
Error occurred during initialization of boot layer
java.lang.ClassFormatError: Incompatible magic value 2331949758 in class file jdk/internal/module/DefaultRoots
The same error also appears in the service log file. What I have tried to fix it:
switching openhab branch back and forth in openhabian-config
switching the java runtime in openhabian-config
Also in Grafana there isn’t any data anymore. There still was data during the first reboots and attempts to restart everything. The data is stored in an influxdb and the data source check in Grafana is OK.
The items, things etc. have not changed since some weeks so I don’t think they are part of the problem.
What has changed since it did work and now? Did you do any updates to the OS or change anything? Do you have a UPS that stops power from being cut to the pi3 when you have power outages? A UPS is very important to have.
Can you run backups successfully and do you have another card to install from scratch and load the backup onto without touching this card at all? I have no idea on this one so hopefully someone else does but answering the above questions may help. Loading a backup onto a fresh card is a good process to go through, as it shows if you have any holes in your backup procedure. If all goes smoothly you should be able to install and load a backup in under an hour.
So in the first place, you run openHABian not Raspbian.
Just like the output tells you, openHAB on openHABian is installed to run as a service so you must not start it manually like this. It even tells you how.
Seems some part of Java is corrupted. I wouldn’t know how that would happen all by itself except due to SD card corruption. Yes your simplemost way out is to do a fresh install.
To be very clear I don’t know the cause, nor am I saying the following is the cause. The following is advice that will make your setup more reliable. Your SD card will be fine to use if you refresh its contents, but it is safer to not touch it in case your backups miss something, you can go back and grab what you need.
Make sure you buy SD cards from a reliable source you can trust, counterfeit cards are common if you look for the cheapest source. If we rule out a counterfeit card, then it could be corruption due to not having a UPS.
If the power fails in the middle of a flash based write, it does not just corrupt the file that is being written but because of the way flash needs to write in BLOCKS, it can corrupt files which were not being written to. A UPS stops this to some extent up until the battery is flat and if the power fails off and on, with a flat battery some UPS can actually make this worse. The way that commercial devices that boot from flash storage get around this like your wifi router, is to stop writing to flash completely. No writes = no chance for corruption. So make sure you use openhabian’s zram features.
Same for me. I have already seen that Java issue elsewhere and it was actually because a wrong binary (wrong processor architecture in that case it was) was installed. Could have been a bad package build or anything, we will not find out.
As the OP said he didn’t update anything this cannot apply here, then again his statement may or may
not be right. But I would have expected a java swap like he did to cure that if that had been the cause.
Zram is enabled on fresh installs.
FYI however the more relevant background link is this.
Sorry for the typo, of course it’s openHabian and of course I am running openhab as a service. Starting it manually was only one of the things I tried to find out more information without having logfiles.
My SD card is a kingston which I bought about 3 years ago, but I took it out of the package about 1-2 months ago when I upgraded to openhab3.