[SOLVED] Using Zram

Tags: #<Tag:0x00007f7462fec7b0>

Oh come on Rich. You’re right to some extent but that does not entitle you to make that first claim.
We all ourselves do this every day: we recommend OH, milestones and other tools to and for use by non-expert users despite knowing well they aren’t 100% either. Just browse the openhab-* issue lists on GitHub.I don’t even know how long they are right now.
If we ever had been developing and deploying like that we wouldn’t have a working OH today. Your remarks on docs are valid but although I actually didn’t really have the time to today I felt pressurized to quickly put that stuff up so here you are.

I wasn’t aware that I wasn’t entitled to my own opinions. I’ll keep that in mind.

The difference between recommending a milestone release or an updated bindings and this though is:

  • if something goes wrong it’s easy to roll back without starting over from scratch; as far as I can tell there is no way to roll back after you move to zram short of a reinstall of openHABian from scratch

  • there is little to no risk of losing configuration data, especially if one doesn’t have the expertise to know that running sudo reboot means losing all your changes since the last reboot but running sudo shutdown -r will save all your changes

  • zram guarantees the loss of data (logs at a minimum) in cases where the machine loses power.

I argue that in this case it’s different from recommending different versions of OH because of the risk of loss of data *under normal operating conditions." It should have a higher bar to pass before recommending it to users who can not understand the draw backs or limitations nor the risks to their data.

But that’s my opinion which I’m apparently not entitled to.

Nope, you can also uninstall ZRAM via menu, getting you back to where you would have been without.

zram is only activated on/var/log and /var/lib/openhab2, the latter of which stores just a minor part of the config.
And if you take proper precaution (UPS, backup) - and the explicit use of beta SW will make you even more aware of the need for this than if you run release or milestone code -, the risk of really losing that config data isn’t larger than on non-zram systems. Let alone that it isn’t fair to compare say a new binding to zram w.r.t. data loss risk. It’s a little like arguing in favor of zram that it is better because it is 100% compatible with any OH functionality and device while that new binding initially still has some issues. But of course that simply only because zram doesn’t touch that area.

Ok we can have an argument over what sort of specialized knowledge we can expect from a user but I already conceded that docs were weak and went to deliver improved ones.
If you did compare apples to apples, i.e. beta SW and docs quality to other beta SW, I’d say this is rather more than you get on other feature’s very first release.

Which still is the best possible result under the conditions to apply (SBC with no reliable storage medium available). And logs and even persistence data is expendable data only.

Just everything anyone does through the REST API which can include all Items, all Things, and for some all Rules.

I have just run into problems just after installing zram and rebooting without the -r parameter. cannot find the menu entry to uninstall zram. Can you please let me know where is that menu entry?

The line right below the line 6A to install it (it has no own number).
But please check out this post first.
What OS version do you run ?

I’m using
Release = Raspbian GNU/Linux 10 (buster)
Kernel = Linux 4.19.66-v7l+
Platform = Raspberry Pi 4 Model B Rev 1.1

I can’t find the option you mention in the openHABian configuration tool. I installed from this tool.

I sorry to say i will give up. My installation is not running as the openhab2 service cannot start. I will do a clean installation. Thanks anyway.

So you did NOT use openHABian but installed Raspbian first then openHABian next using these Manual Installation notes?
You use “sudo openhabian-config” to start the tool and it does NOT offer to update itself ? (or did you skip that ?)
It does not have TWO menu entries under menu “manual/fresh setup” (6A for zram install and an “empty” number entry right below to uninstall ?)

Well then there’s a couple of things seriously wrong with your install from the beginning. I doubt this is related to zram. Re-install is your best option (unless you’re a Linuxer), but better get and install the latest openHABian image.

By the way you can edit the line in /etc/ztab to begin with log to use zram ONLY for logs in /var/log. Just put a comment sign in front of the line to read dir ... /var/lib/openhab2 .
And even when you don’t/cannot sync, old logs will be rotated off-zram.into the directory (last column of the aforementioned line) so all but the latest will be available if the system crashes or is improperly rebooted.

hey, my “problem” was already solved by pointing me to the wrong reboot command :slight_smile:
Quite the contrary is the case, I’m thinking of adding more folders to it. There should be enough space ?!

/dev/zram1        380360    2996    348692    1% /opt/zram/zram1
/dev/zram2        281176   40188    219484   16% /opt/zram/zram2

and a total RAM usage of 439M / 926M

You can do but don’t forget true RAM need will increase (you’re only at 1%/16% so far) and openHAB needs a lot, too, which is why I’ve restricted zram use to these two dirs to work well even on 1GB Raspis…

That is what I did.

It does offer to update itself and it does in fact appear to be updating itself.

There is no submenu to uninstall under 30 System Settings.

Given that I’ve already an installed and configured openHABian, it is counter intuitive to look in 60 Manual/Fresh Setup for an uninstallation option.

Perhaps foruny was looking in 30 (which is where I was looking for it and expected the option to reside) instead of in 60.

Possibly so. I admit it ain’t intuitive and consistent to have it again under 30 but it clearly reads “6A” not “38” in both, the docs and my post, doesn’t it ?

Which leads us back to “people don’t read the docs”. The only reason I was prompted to look under 60 is because of this post.

The docs don’t even mention zram by name.

  1. (BETA) Reduce wear on SD-card by move write intensive actions temporary to RAM during operation (logs,persistant-data). Warning: powerfailure will result in lost data. [Menu option: 6A]

Given that everything that is in 60 except for the removal of zram is represented in the other menu options, I don’t think it’s unreasonable to expect that there would be a menu option outside of 60 for the removal of zram as well. There is for the installation of it and intuitively one would expect the removal menu option to be colocated with the installation option.

To be consistent with everything else that openhabian-config offers, there really should be an option under 30 to remove zram as well. If not, then perhaps most if not all of those the menu options, 30 in particular, should be removed in their entirety.

I installed from openhabian.

[(https://github.com/openhab/openhabian/releases/download/v1.5/openhabian-pi-raspbian-201908050414-gitca0976f-crc6a66b5a1.img.xz)

then used sudo openhabian-config to update to 2.5.0 M2 and then installed zram.

Below the “38 | Use zram” menu option ther was no further option to ununstall zram.

That’s all I find in the openhabian-config utility.

See 6A in screenshots above …

Guess what, in buster ‘reboot’ and ‘halt’ are also still available and DO properly execute the rundown scripts.

@mstormi I tried to setup zram after a manual install of openhabian-config, but it fails:

2019-09-10_11:33:02_CEST [openHABian] Loading configuration file '/etc/openhabian.conf'... OK
2019-09-10_11:33:02_CEST [openHABian] openHABian configuration tool version: [master]v1.5-519(9af5552)
2019-09-10_11:33:03_CEST [openHABian] Checking for changes in origin... OK
Username for 'https://github.com': removed
Password for 'https://removed@github.com': 
remote: Repository not found.
fatal: repository 'https://github.com/mstormi/zram-config/' not found
/opt/openhabian/functions/zram.bash: line 14: cd: /tmp/openhabian.1Mhof85ivh: No such file or directory
/bin/sh: 0: Can't open ./install.sh
Failed to start zram-config.service: Unit zram-config.service not found.

And sure enough the repo https://github.com/mstormi/zram-config/ does not exist?
Am I missing something?

You’re right it doesn’t exist at the moment.
You can use https://github.com/StuartIanNaylor/zram-config instead, we’re transferring that to my account but it seems that takes more time.

Will do, thanks @mstormi