Losing rules (+more) on reboot

Hi,
I am running OH3 and have not used so much in last 12 months.

openhab:
** Installed: 3.2.0~S2535-1**
** Candidate: 3.4.0-1**

In last few weeks, I have added some new rules for my Tado thermostats however, when I rebooted my RPI4 I lost all the new rules & it appears that system has reverted to a snapshot from August 2022. I’ve tried this multiple times an same behaviour each time.
The new rules had been working perfectly for over a week until I rebooted to change the resolution for VNC server.
Anyone have any ideas of how I could work around this?
Thanks,
Declan.

How did you install openHAB?

If it’s openHABian, it’s very likely that you did not reboot “correctly” :slight_smile: please be aware, that openHABian by default activates ZRAM on Pi to prevent wearout of the SD-Card.
The downside of that feature: you have to reboot/shutdown the Pi in a specific way to ensure, that ZRAM will write all changes made so far to the SD-Card.
openHABian will never rollback to an old version, there is no option for his functionality.

Hi,

I purchased Raspberry Pi 4 Model B Starter Kit - 4GB from The Pi Hut in August 2019.
Don’t remember all the details but I believe there was an SD card with a pre-installed image.
I think I used “apt” for the installation.
I have used “sudo reboot” to restart my device.
I do not know that zram is activated - I cannot see a file called /etc/ztab in my installation.

sudo /bin/systemctl status openhab.service
● openhab.service - openHAB - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2022-12-22 06:17:07 GMT; 10 months 13 days ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
 Main PID: 520 (java)
    Tasks: 197 (limit: 4915)
   CGroup: /system.slice/openhab.service
           └─520 /usr/bin/java -XX:-UsePerfData -Dopenhab.home=/usr/share/openhab -Dopenhab.conf=/

Dec 22 06:17:07 raspberrypi systemd[1]: Started openHAB - empowering the smart home.

Thanks,
Declan.

Do you have a folder /opt/openhabian/?

Maybe rour Micro SD Card has worn out and the OS has switched to use the card read only.

1 Like

Hi @Udo_Hartmann,

I do not have a folder /opt/openhabian/ so does this mean I need a new SD card?

Thanks,
Declan.

Well, not necessarily :slight_smile: but this is another option what could cause the “amnesia” of openHAB.

When I log in via SSH, I get the following:

Linux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Dec 22 06:17:14 2022```

Since you are not running openHABian and it is unlikely you’ve configured tmpfs or zram yourself the most likely things that could cause this are:

  • yanking the power instead of shutting down; even without zram or tmpfs, yanking the power of an RPi can cause file system corruption

  • strange behaviors like described can be indication of a worn out SD card.

1 Like

Thanks all!

When I checked the SD card on my laptop I did see that some areas were corrupted.
I’m back up and running again with a new SD card and all is well in the world.
I’m using the latest 64-bit OS:

  • Release date: October 10th 2023
  • System: 64-bit
  • Kernel version: 6.1
  • Debian version: 12 (bookworm)

Any recommendations for zram (or equivalent)?
I believe that I had ordered a pre-imaged SD card with my original HW purchase.

This is kind of a catch-22. If you know what you are doing you don’t have to ask this question. If you don’t know what you are doing, it might be better not to try to configure something like this yourself.

If you want to go down that path I’d recommend using openHABian. Or failing that, at least look at what openHABian does.

The nice thing about zram is it compresses the file system so you can fit more in the ramdisk than the amount of RAM dedicated to it. Of course that means more CPU gets used.