here’s an example with my item “WT_RN_2”…
events.log
2020-07-24 22:56:11.889 [ome.event.ItemCommandEvent] - Item 'WT_RN_2' received command ON
2020-07-24 22:56:11.899 [vent.ItemStateChangedEvent] - WT_RN_2 changed from OFF to ON
/var/log/openhab2/openhab.log
2020-07-24 22:56:11.896 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for WT_RN_2
2020-07-24 22:56:11.899 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'WT_RN_2' with state 'ON' in mapdb database
this tells me, the service registered the change, right?
after reboot - events.log:
2020-07-24 22:59:57.537 [vent.ItemStateChangedEvent] - WT_RN_2 changed from NULL to OFF
i didn’t have any problems with my previous setup…
what can i do?
edit: and also rrd4j doesn’t work properly… the values in my temps chart remain the same and are not updated.
Yes indeed. But did it write the change to a permanent file that can survive reboot?
Feels a bit like this report -
so we’d like to confirm your OH version, and if you have ZRAM in use.
It might be helpful to use REST API to inspect the persisted data for a sample Item that hasn’t been updated yet, just after boot. Expect only one record of course, but is there one at all? No record, no restore.
i have lastest stable OH and zram is enabled. log files are present after reboot so i think zram syncs as intended. if there would be a problem with zram the item wouldn’t get any value on restart but remain NULL, right?
when should i check via REST API? before or after reboot? i checked before one of my multiple updates and the value was “there”.
2020-07-26 08:56:26.782 [ome.event.ItemCommandEvent] - Item 'WT_2' received command ON
2020-07-26 08:56:26.795 [vent.ItemStateChangedEvent] - WT_2 changed from OFF to ON
openhab.log:
2020-07-26 08:56:26.785 [DEBUG] [pdb.internal.MapDBPersistenceService] - store called for WT_2
2020-07-26 08:56:26.792 [DEBUG] [pdb.internal.MapDBPersistenceService] - Stored 'WT_2' with state 'ON' in mapdb database
All looks like a successful mapdb write.
The record you manually read back with REST API has a timestamp July 26, 2020 6:56:26.787 AM
which you might find odd, but persistence records in UTC and corrects for timezone, so that looks right to me. matching your events.log for a +2 timezone
Okay.
I am suspicious of this NULL-to-OFF change event.
because
restore-on-startup does NOT usually log events like that, doing its restore silently.
Maybe that’s changed; or maybe this Item is linked to a binding that provides this change log (in which case, where did the restore go?)
Something I don’t understand here.
Nevertheless, we certainly don’t get the expected (silent) restore to ON.
This record after reboot is timestamped July 24, 2020 8:49:08.111 PM
so clearly your previous ON record has been lost (or replaced).
I would assume we get a view back into the “hard” database because nothing new is yet written to the “zram” copy.
I know nothing about ZRAM but it’s a pretty obvious candidate for the supposition that whatever the reason, it is not writing an in-memory copy of mapdb to permanent storage when system shut down.
As a final curiosity - did you take this REST API sample after that null-to-off change in the events log? Why didn’t that get recorded?
Anyway, I’ve come to the end of my knowledge. Need some ZRAM expertise here.
bah, i’ve had more than enough problem with ZRAM (this is the reason i went for a new setup…).
zramctl gives no output, so i assume something with ZRAM is the cause of my problems - again.
I’m gonna try a last time with fresh openHABian, manual backup (copying files and installing binding manually). if that doesn’t work i’m back to move root to USB (ssd) - even if that is not recommended. worked fine for over 3 years
i just flashed the actual openhabian image to a new sd card a waited until the setup was done.
i installed “needed and recommended system packages” and mosquitto via openhabian-config.
then i installed all needed bindings and copied all my *.things *items etc. files from my previous install.
that with the ZRAM config from the actual openHABian persisted data is lost on reboot.
i have no idea why and i’m pretty sure i’m not gonna find out on my own.
imho this isn’t a problem caused by my “private” setup but related to the acutal openHABian.
sorry, i thought it’s related to ZRAM and would fit here. wasn’t my intention to spam your tutorial.
why? They’re already there after installation.
You must not run anything else other than to install components marked as optional.
And why did you manually copy files instead of using openhab-cli backup/restore ?
If so then everybody must be having that problem, right ? But you’re the only one to report.
It must have to do with the things you did that others do not.
So stop pointing at openHABian again and again just because you don’t find your error.
I don’t know what your problem is and frankly I’ve lost motivation to help.
As a last attempt: Take a systematic approach. Stop rebooting all the time. That is a useless action. It never cures anything but creates new problems only. I believe I have told you that already.
I’d suggest you edit /usr/local/bin/zram-config and append a “-x” to the first line.
Then stop openhab and execute /usr/local/bin/zram-config stop (as root of course) to see what it is copying and if somethings fails in doing so.
Run openhab-cli reset-ownership and check the access rights of your persistence files. The original ones on the filesystem BEFORE ZRAM is started (don’t uninstall ZRAM. You can enable/disable startup during boot with systemctl disable|enable zram-config).
Then it isn’t active so it can’t be causing whatever problem you’re seeing.
No they are not. Why do people always do stuff other than what the installation guide tells them ? *sigh*
Did you even also install ZRAM from the menu ?
Your output is missing /var/log. Did you mess with that ?
okay (copied data from link) and pasted on console with sudo nano …
reboot
[11:09:00] openhabian@oha2:~$ cat /etc/systemd/system/zram-config.service
[Unit]
Description=zram-config
After=local-fs.target
Before=reboot.target halt.target smbd.service openhab2.service
PartOf=openhab2.service
[Service]
Type=oneshot
ExecStartPre=-/bin/rm -f /usr/local/share/zram-config/zram-device-list /usr/local/share/zram-config/zram-device-list.rev
ExecStart=-/usr/local/bin/zram-config start
ExecStop=-/usr/local/bin/zram-config stop
TimeoutSec=180
RemainAfterExit=yes
[Install]
WantedBy=basic.target
[11:09:11] openhabian@oha2:~$ cat /etc/ztab
# To comment out any line Add new drives with the first collumn providing the drive type and then drive details seperated by tab
# All algorithm in /proc/crypto are supported but only lzo/lz4 have zramctl text strings.
# lz4 is the fastest whilst deflate(zlib) has much better text compression.
# mem_limit is compressed memory limit and will set a hard memory limit for sys admin.
# disk_size is virtual uncompressed size approx 220-450% of mem allocated depending on algorithm and input file.
# Much higher than the compression alg is capable will waste mem as there is an approx 0.1% mem overhead even when empty.
# swap_priority set zram over alternative swap devices.
# page-cluster 0 means tuning to singular pages rather than default 3 which caches 8 for HDD tuning, which can lower latency.
# swappiness 80 due to improved performance of zram allows more usage without effect of raising from default 60.
# Can be up to 100 but will increase process queue on intense load such as boot.
# zram_dir is the directory you wish to hold in zram, the original is moved to a bind mount bind_dir and is synchronised on start/stop and write commands.
# bind_dir is a directory where the original dir will be mounted for sync purposes. Usually in /opt or /var, name optional.
# oldlog_dir will enable logrotation to an off device directory whilst retaining only live logs in zram. Usually in /opt or /var, name optional.
# If you need multiple zram swaps or zram dirs just create another entry in /ect/ztab.
# Stop the service sudo service zram-config stop edit /etc/ztab sudo nano /etc/ztab start the service sudo service zram-config start
# swap alg mem_limit disk_size swap_priority page-cluster swappiness
swap lz4 200M 600M 75 0 90
# dir alg mem_limit disk_size target_dir bind_dir
dir lz4 150M 500M /var/lib/openhab2/persistence /persistence.bind
# do not enable as long as you make substantial config changes
#dir lz4 30M 100M /var/lib/openhab2/jsondb /jsondb.bind
# log alg mem_limit disk_size target_dir bind_dir oldlog_dir
log lzo 150M 500M /var/log /log.bind
[11:09:21] openhabian@oha2:~$ zramctl
[11:09:27] openhabian@oha2:~$ /usr/local/bin/zram-config start
+ ZSHARE=/usr/local/share/zram-config
+ ZLOG=/usr/local/share/zram-config/log/zram-config.log
+ ZDIR=/opt/zram
+ [[ -f /boot/cmdline.txt ]]
+ grep -q init=/bin/ro-root.sh /boot/cmdline.txt
+ ZEPHEMERAL=false
+ case "$1" in
++ date +%Y-%m-%d-%H:%M:%S
+ echo 'zram-config start 2020-07-28-11:09:57'
/usr/local/bin/zram-config: line 256: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ rm -f /usr/local/share/zram-config/zram-device-list.new
/usr/local/bin/zram-config: line 257: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ file=/etc/ztab
+ ZTAB_EMPTY=true
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ set -- swap lz4 200M 600M 75 0 90
+ echo 'ztab create swap lz4 200M 600M 75 0 90 '
/usr/local/bin/zram-config: line 274: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ ZTAB_EMPTY=false
+ ZTYPE=swap
+ ALG=lz4
+ MEM_SIZE=200M
+ DISK_SIZE=600M
+ '[' -f /usr/local/share/zram-config/zram-device-list ']'
+ test -f /usr/local/share/zram-config/zram-device-list.new
+ case "$1" in
+ PRIORITY=75
+ PAGE_CLUSTER=0
+ SWAPPINESS=90
+ createZswap
+ createZdevice
+ '[' '!' -d /sys/class/zram-control ']'
+ modprobe --verbose zram
/usr/local/bin/zram-config: line 85: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ return 1
+ return 1
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ set -- dir lz4 150M 500M /var/lib/openhab2/persistence /persistence.bind
+ echo 'ztab create dir lz4 150M 500M /var/lib/openhab2/persistence /persistence.bind '
/usr/local/bin/zram-config: line 274: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ ZTAB_EMPTY=false
+ ZTYPE=dir
+ ALG=lz4
+ MEM_SIZE=150M
+ DISK_SIZE=500M
+ '[' -f /usr/local/share/zram-config/zram-device-list ']'
+ test -f /usr/local/share/zram-config/zram-device-list.new
+ case "$1" in
+ TARGET_DIR=/var/lib/openhab2/persistence
+ BIND_DIR=/persistence.bind
+ '[' false = false ']'
+ createZdir
+ '[' '!' -z /persistence.bind ']'
+ mkdir -p /opt/zram/persistence.bind
/usr/local/bin/zram-config: line 31: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ return 1
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ continue
+ read -r line
+ case "$line" in
+ set -- log lzo 150M 500M /var/log /log.bind
+ echo 'ztab create log lzo 150M 500M /var/log /log.bind '
/usr/local/bin/zram-config: line 274: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ ZTAB_EMPTY=false
+ ZTYPE=log
+ ALG=lzo
+ MEM_SIZE=150M
+ DISK_SIZE=500M
+ '[' -f /usr/local/share/zram-config/zram-device-list ']'
+ test -f /usr/local/share/zram-config/zram-device-list.new
+ case "$1" in
+ TARGET_DIR=/var/log
+ BIND_DIR=/log.bind
+ OLDLOG_DIR=
+ '[' false = false ']'
+ createZlog
+ invoke-rc.d rsyslog stop
/usr/local/bin/zram-config: line 66: /usr/local/share/zram-config/log/zram-config.log: Permission denied
+ return 1
+ read -r line
+ '[' false = true ']'
[11:09:57] openhabian@oha2:~$ date > /var/lib/openhab2/persistence/date
-bash: /var/lib/openhab2/persistence/date: Permission denied
[11:12:09] openhabian@oha2:~$ sudo date > /var/lib/openhab2/persistence/date
-bash: /var/lib/openhab2/persistence/date: Permission denied
that’s as far as i got, i don’t think it makes sense to proceed until permission problem is solved?
You messed up the order of commands I gave.
“cat …/date” must be AFTER zram-config stop. The point of that command is to see if the file is synced back when you stop ZRAM. Try again.
Something is wrong with your /var/log. It was not mounted as ZRAM and it does not get mounted either when you restart it. I think it’s because you have not setup nginx.
Retrieve the latest zram-config from the link again and retry the commands, but pay attention to the order this time.