Raspberry wont boot / Kernel Panic !?

Hi Guys,

my system was running with a Raspb. 3 and openhabian ( without any big problems since 2017.
Today some lamps in the garden didnt turn on and i thought i reboot my raspberry. (sudo reboot)

All was looking normally via ssh before reboot. And now “Host is down”. (aaaahhhhhhhhhh)
Via HDMI i get KERNEL PANIC now !?

What is happening ? Can someone help me to get my system back ?
i can see all my data with “linux reader” (boot and files) on windows and already created an image of my files.

i have done nothing the last few months with my raspberry/openhab, only today to reboot.

Thank you!

The part “since 2017” scared me the most :smiley: I just assume you are using a sd-card then I have to bring bad news. The sd-card is DEAD.
I hope you made some backups.

i can see all my data from the SD Card on windows !?

Then try to save your data.
and after you saved your data try to write a simple text.txt file to the sdcard and/or use an sd-card check tool.

The same thing has happened to me. I could not find any corrupted files but the card was dead alright. A new card fixed it.

how did you clone your sd card and openhabian files?

It’s a dead card, you can hope to read some data of it.
Try to just copy the data to save it example the openHAB conf /etc/openHAB2/ files and database files for example /var/lib/influxdb. (or the whole data)

For the future, I highly advice to use an ssd/usb for your RaspBerryPI. I had like 5-10 sd-cards failing.

any suggestions what i should buy ? i’ll be later buying a new ssd for my computer as well. so it would be perfect timing :wink:

i have backups from my conf/userdata from 2018 ( last changes made there ) done via ssh stored on my mac.

but as i said already, i can still read the whole sd card files.

sd card doesnt look that damaged :grimacing:

… Yes because it’s internally dead , see Wear_Leveling.

Depends on what you want. Cheap? Low capacity? yada yada
I went for dirt cheap and more storage and so far since 22. Dec 2018 no Problem.

For your main PC I would not advice to go dirt cheap :smiley:
Also go for an NVME SSD if your Motherboard supports it.

I copied the data over to a new installation, like Elias said. I will also go the SSD route sooner or later.

Here’s a little back story.

There is some binary file that is part of the operating system kernel that has become corrupted. There are two ways this can happen.

Most Common: Power Loss
If the RPi loses power while it is writing to the SD card, it will lose that file write. No big deal, right? Wrong, because of the way SD cards work. Let’s say that OH is writing to it’s log file when power is lost. When writing to an SD card, what happens is it writes the full contents of a sector to another sector with the changes made. But more than one file can share the same sector, meaning that when you lose power, you lose not only part of openhab.log, but you also lose those parts of the other files that also were stored in that sector. Thus, on a power failure you can lose a part of the operating system kernel while writing to openhab.log.

Less Common: SD card wear out
Each sector of an SD card has a finite number of writes that it will support. When you hit that limit, the SD card simply just fails to save the writes. But there is no error. There is no indication that the write failed. It just doesn’t make the change, or when you reboot the changes made are lost. For example, I once had an SD card that would come up full when I restarted it. It turns out that the log rotation was failing. I’d manually delete the log files and when I rebooted the files would come right back.

Again, there is no error from the write. It just fails. And because of the way flash memory is written to, when it fails to write that log statement to openhab.log, it might just take a part of the kernel with it.

ALL flash memory has this problem: USB thumb drives, SD cards, eMMC, and SDDs. But SDDs are the safest of the group as they possess more circuitry and fail safes and have way more space to wear level across. But they still can wear out (but HDDs can also wear out) and they are very much susceptible to the power loss problem discussed above.

So honestly, you would be better off investing in a battery backup for your RPi rather than or in addition to an SDD. And there are alternatives to an UPS that can preserve your SD card such as moving most of the writes to RAM disk (see the zram option in openHABian) and configuring your root FS as read only (which is very effective but it can be a pain to then administer the device, AdaFruit has a script to help setting this up).