[SOLVED] Using Zram

Tags: #<Tag:0x00007f7464602fe0>

I’m just stating the facts. I’m not blaming anyone for not knowing this. If it comes across I do please apologize and attribute this to the fact that I’m not a native speaker.

And on the other hand I feel it isn’t fair either to expect a sudden 100% solution to a problem which has been heavily plagueing many users over the years, and to speak frankly, doing so is a little naive, too.

Note the feature is marked to be beta.
I agree documentation should be improved (or created as in fact it is non-existent although that all by itself should already be a word of warning, shouldn’t it ? Then again, I in fact did initially contribute a little more than that but seems someone copy-edited that out).
But as you know well for yourself docs are tedious work and even more so on beta features where we don’t have experiences yet and a moving target.
And even with docs in place, there’s only few people to really read them and even less you can convince to stop doing harmful things on Linux (reboot) that they have been doing ever since.
You have to start somewhere and this is the very first implementation and all of us, including me, need to make and collect our experiences here. I myself didn’t think of that reboot thing until it was mentioned here.
I was hoping to get the online sync to work soon which would resolve that problem for the most part but I currently guess we’re not getting there anytime soon so I’ll have to put some works into the docs first. Maybe add a safety disclaimer to the install menu.

Should be fine AFAIK.

Duh, haven’t seen that variant yet. I’d guess it takes care of stopping services, too, as it’s a frontend command to systemd. But I don’t know, just guessing.

If it’s not 100%, then it shouldn’t be promoted for use, especially by non-technical users and there should be docs and warnings saying so. It’s a radical rethinking about how OH is deployed and even a lot of experienced users are not knowledgeable enough to understand the tradeoffs and limitations of running in zram. I’d argue the feature is at best experimental at this point.

I don’t recall seeing anything in the too itself indicating it is beta.

Since most users will not look beyond the tool, sadly I’m not sure there lack of docs would be sufficient. In my experience, having docs are mostly used by many users only after they run into problems.

That might be enough. If the tool says “danger, do not proceed unless you already know what you are doing” it might be enough of a discouragement.

I can see lots of benefits using zram. However I think the general recommendation to avoid sdcard wear out should be to use an ssd via usb. Zram is complex and imo it will be easier for most users to use external storage.

Anyway it’s definitely a very attractive feature, zram, especially with the rpi4 (4g) where you have an abundance with ram.

Regards s

No, that definitely is not easier (or to be recommended in any way).
Yes zram is complex but making use of it is not (well maybe now in beta it still is but of course that’s what we’re busy working to reduce). The ultimate target of openHABian is to hide all that complexity from OH users by wrapping that in menus and automation.
The majority of (and targeted) users of openHABian have NO Linux experience.
You musn’t expect them to be able to migrate their system to boot from external medium, let alone exposing users to all the things that can go wrong along that process.


and

1 Like

I think it easier to use an external storage compared to zram. I might be the only one, but judging from the number of issues with zram that I read, I have a hard time believing that zram would be a lot easier to everyone. And I do think you are jumping to conclusions a bit too quickly.

I guess time will tell. Anyway, I didn’t come to bash on zram, like I said it’s an amazing feature and I recognize all effort you put into it.

Regards S

Well if you know how to do that then you’re part of the minority. Just as am I and most to contribute to this thread. I assume you’re also striving to understand the implementation because a move to external storage wouldn’t work if you didn’t understand the steps there.
But using zram works without (well, will work when we’re out of beta one day).
openHABian users don’t need to understand how zram works, they just need to enable it in the menu.

1 Like

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.