I don’t know. I find my solution better (1.5G is not enough)
But isn’t your solution to compress all data, which means more CPU usage and therefor more battery drain? I mean sure, if you need it, it’s better to you. But for people who can live with less RAM it’s a bad choice - theoretically (I did not test if it makes a real difference).
I’ve been using your solution quite successfully and actually noticed less CPU usage.
Thanks for your report. This was also my feeling but i have not really verified it. Just the stability was a great improvement.
Once they have some sort of way to put processes in the background then I would say the power consumption would drop even more combined with this hack.
I am having trouble making ZRAM persistent, I receive this error code after entering:
sudo systemctl restart systemd-zram-setup@zram0
Job for systemd-zram-setup@zram0.service failed because the control process exited with error code.
See “systemctl status systemd-zram-setup@zram0.service” and “journalctl -xe” for details.
I tried
journalctl -xe
and I received this:
lines 1987-2022/2022 (END)
Jul 24 12:13:37 pureos avahi-daemon[572]: Registering new address record for fe80::33d2:b7c6:81af:a62c on usb0..
Jul 24 12:13:38 pureos NetworkManager[584]: [1721841218.1732] device (usb0): carrier: link connected
Jul 24 12:13:38 pureos login[4723]: pam_unix(login:auth): check pass; user unknown
Jul 24 12:13:38 pureos login[4723]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/ttyGS0 ruser= rhost=
Jul 24 12:13:39 pureos systemd-networkd[460]: usb0: Gained IPv6LL
Jul 24 12:13:42 pureos login[4723]: FAILED LOGIN (1) on ‘/dev/ttyGS0’ FOR ‘UNKNOWN’, Authentication failure
Jul 24 12:13:45 pureos login[4723]: pam_unix(login:auth): check pass; user unknown
Jul 24 12:13:45 pureos login[4723]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/ttyGS0 ruser= rhost=
Jul 24 12:13:48 pureos login[4723]: FAILED LOGIN (2) on ‘/dev/ttyGS0’ FOR ‘UNKNOWN’, Authentication failure
Jul 24 12:13:54 pureos login[4723]: pam_unix(login:auth): check pass; user unknown
Jul 24 12:13:56 pureos login[4723]: FAILED LOGIN (3) on ‘/dev/ttyGS0’ FOR ‘UNKNOWN’, Authentication failure
Jul 24 12:14:01 pureos kernel: edt_ft5x06 2-0038: Unable to fetch data, error: -6
Jul 24 12:14:01 pureos gsd-xsettings[1084]: Failed to get current UI legacy scaling factor
Jul 24 12:14:01 pureos gsd-xsettings[1084]: Failed to get current UI legacy scaling factor
Jul 24 12:14:01 pureos gsd-color[1082]: unable to get EDID for xrandr-DSI-1: unable to get EDID for output
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7474] dhcp4 (usb0): request timed out
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7476] dhcp4 (usb0): state changed unknown → timeout
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7479] device (usb0): state change: ip-config → failed (reason ‘ip-config-unavailable’, sys-iface-state: ‘managed’)
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7538] device (usb0): Activation: failed for connection ‘Wired connection 1’
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7555] device (usb0): state change: failed → disconnected (reason ‘none’, sys-iface-state: ‘managed’)
Jul 24 12:14:22 pureos avahi-daemon[572]: Withdrawing address record for fe80::33d2:b7c6:81af:a62c on usb0.
Jul 24 12:14:22 pureos avahi-daemon[572]: Leaving mDNS multicast group on interface usb0.IPv6 with address fe80::33d2:b7c6:81af:a62c.
Jul 24 12:14:22 pureos avahi-daemon[572]: Interface usb0.IPv6 no longer relevant for mDNS.
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7868] dhcp4 (usb0): canceled DHCP transaction
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7870] dhcp4 (usb0): state changed timeout → terminated
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7919] policy: auto-activating connection ‘Wired connection 1’ (213909bf-9dc1-30aa-b4b1-6a59da98be79)
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.7956] device (usb0): Activation: starting connection ‘Wired connection 1’ (213909bf-9dc1-30aa-b4b1-6a59da98be79)
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.8247] device (usb0): state change: disconnected → prepare (reason ‘none’, sys-iface-state: ‘managed’)
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.8265] device (usb0): state change: prepare → config (reason ‘none’, sys-iface-state: ‘managed’)
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.8293] device (usb0): state change: config → ip-config (reason ‘none’, sys-iface-state: ‘managed’)
Jul 24 12:14:22 pureos NetworkManager[584]: [1721841262.8313] dhcp4 (usb0): activation: beginning transaction (timeout in 45 seconds)
Jul 24 12:14:22 pureos avahi-daemon[572]: Joining mDNS multicast group on interface usb0.IPv6 with address fe80::33d2:b7c6:81af:a62c.
Jul 24 12:14:22 pureos avahi-daemon[572]: New relevant interface usb0.IPv6 for mDNS.
Jul 24 12:14:22 pureos avahi-daemon[572]: Registering new address record for fe80::33d2:b7c6:81af:a62c on usb0..
Jul 24 12:14:22 pureos rygel[4181]: Error creating GUPnP context: Failed to bind socketError binding to address [fe80::33d2:b7c6:81af:a62c%2]:1900: Cannot assign requested address
Jul 24 12:14:24 pureos systemd-networkd[460]: usb0: Gained IPv6LL
~
Can you parse this and maybe help with what I can try to fix?
The output for the restart was also for me because of this:
- an error in the config file
or - I just needed to restart and make the change again immediately, because if the zram is too used (filled) by the opened apps, the restart service always failed.
PS: In order to make the thread clearer, please delete your log (too long and no trace aboutt zram service).
Next time, you can do better with:
sudo journalctl --since "5 minutes ago" | grep zram
If anything, what Kyle described is easier. zramswap
(from zram-tools
) is a script that takes the nitty-gritty away. But if you look at /usr/sbin/zramswap
, it invokes all the same commands.
Maybe use the other suggestion? systemctl status -l systemd-zram-setup@zram0.service
.
Hi I’m trying to set my zram but I’m having same Flanders51 problem and Lionel’s suggestion didn’t work for me (reboot and make the procedure again).
Here my screenshots.
Please some help?
Thank you so much
Show us your /usr/lib/systemd/zram-generator.conf.d/librem5.conf
please.
Maybe, kill some running apps.and restart service again…
Do you have any autostarting apps?
I have not tried the procedure from the original post. Instead, I added the following configuration file and rebooted. I would suggest it instead. The documentation is available in man zram-generator.conf
.
$ cat /etc/systemd/zram-generator.conf.d/librem5.conf
[zram0]
zram-fraction = 2
max-zram-size = none
That configuration file overrides the configuration file with the same name, which is provided by Purism.
$ cat /usr/lib/systemd/zram-generator.conf.d/librem5.conf
[zram0]
So, this combines the following advice.
[zram0]
Thank you
Please I’m trying to do that. What means it?
I’ve to create a second file and save it, like this one, in my microsd?
Thank you
I do not know. However, the following bit of the log seems to indicate that /dev/zram0
is busy by some other process when zram-generator
tries to configure it.
I do not know how to investigate it. But I found the following suggestion:
As far as I know Debian has two packages that makes configuring swap on a zram device fairly easy.
They are “zram-tools” and “systemd-zram-generator”.
You should probably check that you have only one installed.
I only have systemd-zram-generator
installed of the two.
Only do this (don’t follow any other procedure, i cannot help you), or Why and how to extend ZRAM on L5. A revolution for Librem 5 stability! - #34 by riabenko (may be a better procedure):
I did on my 3 librem 5:
1.Reboot
2.Close immediately any running app because of autostart (or better: remove them from the folder temporarily).
3. And immediately in terminal copy past this in terminal:
sudo tee /usr/lib/systemd/zram-generator.conf.d/librem5.conf <<EOF
[zram0]
zram-fraction = 2
max-zram-size = none
EOF
sudo systemctl restart systemd-zram-setup@zram0
That means any path of a script like /home/purism/myscrip.sh, that contains the commands you want to run at boot. has to be replaced by the text you want at this place.
For our purpose, the script /home/purism/myscrip.sh
should contain:
#!/bin/sh
sudo swapoff /dev/zram0
sudo zramctl --reset /dev/zram0
sudo zramctl --find --size 5G
#/dev/zram0
sudo mkswap /dev/zram0
sudo swapon /dev/zram0