Need urgent help after oh2-crash

My Rpi3 crashes a few seconds after OH2 is started (sadly automatically). The pi freezes completely. It seems that I don’t even have a chance to

sudo systemctl stop openhab2.service

This happend after I upgraded to 2.1.0~20170609105814-1 (Build #943) and after a neccessary shutdown.
Maybe I have a chance to look into the logfile and locate the problem. But how can I stop openhab from starting automatically?

Hello Frank. Your Pi will not freeze because of the openHAB software.

Could your problem be related to this?

Hello Thom,
I’m not quite sure. My rpi boots until the login screen. Then a few secands after login during the startup of OH2 the pri freezes without anything displayed.
Shall I try the fix from your link?

I made the two changes in config.txt. There is no boot folder shown when I inserted the sd-card into my windows pc, so I simply changed x:\config.txt.
But this didn’t help.
The pi crashes after the first error that is thrown by a binding (mostly caldav, sometimes weather).

The macaddress in config.txt also didn’t work. The pi receives a new ip in every boot

I have another rpi3 with oh2 running. It’s my testing machine. It was setup with ua-netinst from 2017/03/17 but without any upgrade. So it runs OH 2.0.0 stable.

Can I move my configuration and my RaZberry zwave controller to that second machine? What do I have to do? As a first step I made a backup from /etc/openhab2 and /var/lib/openhab2 as described in the docs.
Is it possible to simply restore this to my second rpi? Do I have to update OH2 first to a 2.1.0.SNAPSHOT which was running on my crashed system?

Or should I download a completely new image and install that to another sd-card?

BTW: I am pretty sure that the rpi crashes during OH2 startup. tail -f /var/log/openhab2/openhab.log shows loading my rules, items and so on and also starts my init timer, loads some weather items and then freezes. Also there is no kernel panic during boot procedure.

IHello @ThomDietrich ,
sorry that I have to say, but this really drives me crazy. I set up a fresh sd-card with the normal setup as you described (not the ua-netinst!). Then I upgraded to 2.1.0.SNAPSHOT (latest binding) and - as described in the docs - replaced the conf- and the userdata with my last backup.

But OH2 won’t come up anymore. All I get in openhab.log is tons of these messages:

2017-06-12 23:57:19.595 [SCHWERWIEGEND] [org.apache.karaf.main.Main] - Could not launch framework
java.lang.RuntimeException: Error initializing storage.
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(
        at org.eclipse.osgi.launch.Equinox.<init>(
        at org.eclipse.osgi.launch.EquinoxFactory.newFramework(
        at org.apache.karaf.main.Main.launch(
        at org.apache.karaf.main.Main.main(
Caused by: /var/lib/openhab2/cache/org.eclipse.osgi/.manager/.fileTableLock (Keine Berechtigung)
        at Method)
        at org.eclipse.osgi.internal.location.Locker_JavaNio.lock(
        at org.eclipse.osgi.storagemanager.StorageManager.lock(
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(
        ... 4 more

Please help as I do not know what I did wrong or how to fix this chaos.

What I saw is that all files have openhabian as owner. Maybe because I had saved them on my pc and restored them to home with my ssh client as openhabian . Is that wrong?

Hey Frank,
the freezing thing still baffles me.

Exactly right. Did you see the Readme in the samba network share? It warns about that problem. You can “Fix Permissions” from within sudo openhabian-config

Besides that the Backup and Restore should be fine the way you described it. Also compare:

Hm, well, I must admit that I have seen the readme some months ago but forgot about it. Sorry and thanks for the hint! I will fix this.

Meanwhile I managed to mount the sd-card from the freezing pi with my Debian machine and had a look into openhab.log. The positions where it freezes are filled with some lines of NULL values. From watching the tail -f result it looked like the startup process always freezes at the same position. But that’s only because everything happens so fast and is not the truth. From looking into the log I can clearly see that it’s only around the same position.
Could there be another process from outside OH2 running which then fails? On the other hand there’s only OH2 running and owncloud.

Hi @ThomDietrich,
may thanks for your help,. Setting the permissions di the trick.

But I am afraid I need a little more help as my RazBerry z-wave controller ist offline. In paperui I see:
Status: OFFLINE - BRIDGE_OFFLINE Controller is offline
I checked

ls -l /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 64 Jun 13 21:34 /dev/ttyAMA0
id openhab
uid=109(openhab) gid=114(openhab) Gruppen=114(openhab),5(tty),20(dialout)

in /boot/config.txt I added:

What else might be wrong?

Sorry again and thanks for your patience @ThomDietrich.
I must have mixed some things from older threads. I followed your instructions at Z-Wave serial controller is offline
And now everything works fine.

Had to remove “console=tty0” from /boot/cmdline.txt and set “dt-overlay=pi3-miniuart-bt” in /boot/config.txt instead of “dtoverlay=pi3-disable-bt”.
I changed both at the same time before reboot, so I do not know if both or only one of the changes did the trick.

BTW: There is no /etc/inittab file in my system and therefore I skipped this step.

Hello Frank!
Sorry for the late reply. All of these and more things are actually done via the menu entry openhabian-config -> Serial Port. You could have saved yourself the trouble…
Does everything work now?

Hello Thom,

That’s what I did immediately after the setup (and two more times yesterday) and it did not work. I checked all 3 options in Serial Port.

But now everything works fine. All my zwave things communicate. THANKS!

Are you sure? In this case please tell me what you did in addition to all the things done by all three options:

Hi Thom,
I hope I do remember every detail:
The first problem was that the controller thing reported /dev/ttyAMA0 as not existing.

I saw that /dev/ttyAMA0 belonged to root:tty and the permissions were 620 (!!!). Therefore I did

sudo chgrp dialout /dev/ttyAMA0
sudo chmod g+r /dev/ttyAMA0
In /boot/config.txt I commented out the line "dt-overlay=pi3-miniuart-bt" and inserted "dtoverlay=pi3-disable-bt".
sudo systemctl restart openhab2.service

This led to the following status shown by the controller thing: “OFFLINE - BRIDGE_OFFLINE The controller is offline”

I removed and set again the three options on openhabian-config under Serial Port and rebooted. No change, same status for the controller.

Then I reverted the above changes in /boot/config.txt and also removed “console=tty0” from /boot/cmdline.txt. After a reboot everything worked fine.

Hi Thom,
I made some tests with a fresh sd-card and openhabianpi-raspbian-20170318-git9767b24-crc9616e8a1.img.xz.

Before sudo openhab-config I checked:

ls -l /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 64 Jun 16 21:20 /dev/ttyAMA0

After setting all three options under Serial Port and rebooting:

ls -l /dev/ttyAMA0
crw--w---- 1 root tty 204, 64 Jun 16 22:13 /dev/ttyAMA0

And in /boot/cmdline.txt we have:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

and of course the controller thing reports: “OFFLINE - COMMUNICATION_ERROR Serial Error: Port /dev/ttyAMA0 does not exist”

After removing "console=serial0,115200 " from /boot/cmdline.txt and rebooting again:

ls -l /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 64 Jun 16 22:50 /dev/ttyAMA0

and of course … the controller ist online :slight_smile:

1 Like

Hey @FrankR,
thanks for testing again! I’ve followed along your description and found an error in openHABian! :see_no_evil: After another recent change there was one dot missing :smile:

The whole process will work for the next user now. Your help in resolving this matter is really appreciated! Best Regards and let me know if you encounter any other issue.

Btw. did you see the openHABian v1.3 announcement?

Hi @ThomDietrich,
I received so much help from this forum. So I am happy if I could return a little bit to this great and amazing project.

No, I did not see the announcement. So thanks for your hint! The announcement sounds that there is a lot of very useful stuff and I think I will take some time the next days and install the newest version.

Maybe you can answer a question that is a little bit off-topic. Before the test I reported about, I tried to make a copy of my rpi sd-card using dd on my Debian machine. When dd was finished I put the card back into my rpi, but it did not boot any more telling me something like card was busy (“mmcblk0: card never left busy state” and “mmcblk0: error -110”). That’s only for the backgorund.
Later I saw in openhab-config the option “Move root to usb”. Does this option help reducing the number of read/write access to the sd-card? I am asking this because the web is full of rpi users complaining about broken sd-cards and also the card mentioned above is my second broken card within the last 3 years of using Raspberry PIs. It is said that a high number of read/write access reduces the lifetime of sd-cards.

I’m sorry but I’m not able to help with the first problem without googling first.

As for the second, you can find my opinion on the matter here:

Hi @ThomDietrich

Don’t waste your time. I set up a new sd-card with a fresh openhabian and solved the problem this way. I only mentioned this point just to give the background for my question regarding crashing sd-cards in general.

Thanks therfore. That was the point I was interested in. I will care for improving my backup strategy and also order a ups for my rpi.

Check out