Behaviour of OpenHab logs

  • Platform information:

    • Hardware: RPI 4 B, 4 GB, 64 GB SD card
    • OS: Debian Linux 12
    • Java Runtime Environment: ??
    • openHAB version: OpenHab 4.1.2
  • Issue of the topic:

  • If I start a ssh connection and move to the /var/log/openhab folder before the first zsync run, I can see the events.log file being updated, using “cat events.log”.

  • When zsync runs, the content of the /var/log/openhab folder disappears, “ls -la” does not show any files, but “cat events.log” continues showing the contents of the file that is being updated (events before and after the zsync run).

  • If, after zsync runs, I start another ssh connection and move to the /var/log/openhab folder, I can see the files in the folder but the contents of events.log only has events logged before the zync run.

  • The contents of the events remains frozen when I use “cat events.log” with the second ssh connection but is live if I use “cat events.log” with the first ssh connection.

  • Please post configurations (if applicable):

    • Items configuration related to the issue
    • Sitemap configuration related to the issue
    • Rules code related to the issue
    • Services configuration related to the issue
  • If logs where generated please post these here using code fences:

This is expected behavior. You should not have OH running while doing a zsync. It cannot handle syncing files that are changing during the sync.

I apologize, but, my OpenHab installation is “standard”. I just applied OpenHab on top of Debian.
It is not clear for me what I did wrong.
What must I do to mantain the logs?
Zsync runs on an hourly base. I thought it was part of the OpenHab setup,

Right, and zsync has nothing to do with openHAB. There is nothing you can change in openHAB to make this work any better. Whatever is happening is being cause by zsync.

In general, tools like zsync do not like to work with files that are actively changing. Some tools just end up corrupting the copy of the file, others make a local copy and then copy that over or do other things to stop the file from changing while it’s being copied.

I’m not as familiar with what zsync does in this case.

Stop OH before running the zsync, or use some other tool to copy the files which do not have this same behavior when trying to copy an actively changing file. The first is preferable as you rarely want to be copying a file that’s changing.

Zsync may be something related to openHABian but openHABian is not openHAB. openHAB doesn’t do anything with zsync.

I’m not sure openHABian does anything with zsync either. But it does with zram. Are you running openHABian with zram?

Yes.
/var/log is mapped in Zram2

And you set this up yourself or you use openHABian?

This means you ran

sudo apt install openhab

openHABian is a wholly other thing.

But the same advice applies. openHAB should not be running when syncing zram to the SD card. If you are running with an SSD or HDD, you should not run with zram in the first place.

I apologize again, but, if i connect again 24 hours later, 48 later…, I get the same result. The logs before the first zsync,
I would like to understand why.
If the explanation is complicated, please just let me know how I can have access to the logs.

Yes, it’s complicated having to do with file system mounts, file handles, and deep oeprating system stuff.

I have, three times now.

OH must be stopped and not running before syncing ZRAM to the SD card.

Alternatively, if you are not running off of an SD card you should not be using zram.

I apologize, but, my OH is running 24/7 so, none of the solutions is interesting.

Either you don’t run zram or you must stop OH before syncing the logs to the SD card. There are no other options.

It is not technically feasible to dump zram to the SD while the files are changing.

Thanks for the explanation and for your pacience.
I am not an expert on Linux.
How can I stop zsync? Are there any additional effects, if i stop the service?

As far as I’m aware zsync isn’t set up by openHABian nor is a zram sync. Note, zsync doesn’t have anything to do with zram. It’s a version of rsync designed to be used with large files.

But if it’s running every hour or day or whatever, that probably means either there is a cron job (look in the files in the /etc/cron folders) that calls zram-config sync.

I don’t know because it’s still unclear. There are a lot of unaswered questions.

  1. How did you install? Are you really running openHABian or just openHAB?
  2. Are we really talking about ZRAM or zsync? They are not the same thing. They don’t even do the same thing.
  3. What configuration of this machine was done outside of openHABian?
  4. Is this running off of an SD card or an SDD/HDD?

I took a HB configuration and installed it in a new debian SDD.
In the old configuration/OS, I had problems with NTP.
Now, I have problems with logs and zsync.
When will I have a stable configuration/OS?
:slight_smile:
I know you have nothing to do with these questions, but, I hoped HB/RPi/Linux would be more stable.

I don’t know what HB is.

If you are running on an SDD, you should not be running zram.

I still don’t know whether you are running and openHABian configured machine or not. If so disable zram from sudo openhabian-config. If not, we can’t really help because it’s not related to anything openHAB as a project provides.

I still don’t know if you are using zsync (http://zsync.moria.org.uk/) or zram (zram - Wikipedia).

This is the first time you mention an RPi. Note that openHABian is not supported to run on an RPi with an SDD. Only SD.

I have no idea what that means.
I don’t know what HB is, I don’t know what SDD is (HDD? SSD? SD?).
You did not mention what hardware and storage medium you use and you didn’t say if you used openHABian and if not how you installed your system.
Please be clear, else this is a waste of time for everybody.

I had a previous Openhab configuration in the sama RPi. I saved that OH configuraton when I updated the OS
I created a new SD card (RPi debian), and installed the saved OpenHab configuration.
The RPi is not used for any other purposes, but I have some rules based on time.

OH, not HB.
Sorry for the mistake.

Again, sorry for the mistake:
RPi 4 B, 4 GB, 64 GB (SD card)

We still don’t know how you installed. Via openHABian or via apt.

The tiny details matter, but this one isn’t tiny.

What image did you use to create the SD card? Standard Raspberry Pi OS or openHABian?

How did you install OH?

And we still don’t have an answer to whether you are really talking about zsync or zram_config sync.

@mstormi can correct me if I’m wrong, but I don’t think openHABian does anything with zsync and I don’t think it schedules a zram sync by default either though I’m less sure on that.

The RPi has an hourly event associated with zsync, I can send you the contents of journalctl, if it is of any usage,