Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
On Mon, Nov 25, 2024 at 04:17:03PM +0100, Michal Koutný wrote:
> On Wed, Nov 20, 2024 at 02:58:57PM GMT, Zbigniew Jędrzejewski-Szmek
> wrote:
> > I don't think we can change this now, because this was documented
> > behaviour and people may have used something like '4k' to get 4000 MB.
>
> If you're referring to
> ae46c78 ("Obsolete zram-fraction and max-zram-size in favour of new,
> arbitrary-expression, zram-size"
> it also quite unfortunately removed units from the manpage.
> So, technically speaking behavior of 4k was undocumented.
It's all actually documented in the readme and examples. If docs are
missing somewhere, we should improve that.
After sleeping a bit on this, I'm not sure if it's worth the trouble.
It hasn't come up before, it seems most people put 'ram * 0.5' or
something like that. As a much simpler solution, we could just add
a warning if the configured value is much too large, e.g. above 100*ram.
WDYT?
> > I think the nice backwards-compatible solution would
> > be to add a new setting, e.g. disk-size that is evaluated as bytes,
> > and soft-deprecate zram-size.
>
> Please Cc me (Werkov) on any related PR.
Zbyszek
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
On Wed, Nov 20, 2024 at 02:58:57PM GMT, Zbigniew Jędrzejewski-Szmek
wrote:
> I don't think we can change this now, because this was documented
> behaviour and people may have used something like '4k' to get 4000 MB.
If you're referring to
ae46c78 ("Obsolete zram-fraction and max-zram-size in favour of new,
arbitrary-expression, zram-size"
it also quite unfortunately removed units from the manpage.
So, technically speaking behavior of 4k was undocumented.
> I think the nice backwards-compatible solution would
> be to add a new setting, e.g. disk-size that is evaluated as bytes,
> and soft-deprecate zram-size.
Please Cc me (Werkov) on any related PR.
Thanks,
Michal
signature.asc
Description: PGP signature
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
On Wed, Nov 20, 2024 at 04:03:22PM +0100, Torstein Sørnes wrote: > I have now set it to > ``` > [zram0] > zram-size = 32*1024 > ``` > and tried > ``` > sudo systemctl daemon-reload > sudo systemctl restart systemd-zram-setup@zram0 > ``` > nov. 20 16:01:21 D2S3Q34 zram-generator[162009]: Device or resource > busy (os error 16) You probably need to call swapoff and 'zramctl --reset' or reboot. Zbyszek
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
On Thu, Nov 07, 2024 at 07:35:43PM +0100, Michal Koutný wrote: > Hello Torstein. > > On Tue, Nov 05, 2024 at 03:51:31PM GMT, Torstein Sørnes > wrote: > > I have a Fedora 41 laptop with 32GB of ram. > > > > On startup, this shows in the journal: > > ``` > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Error: Failed to configure > > disk size into /sys/block/zram0/disksize > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Caused by: > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Cannot allocate memory > > (os error 12) > > nov. 05 13:58:32 D2S3Q34 kernel: zram-generator: vmalloc error: size > > 1310720, exceeds total pages, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), > ^^^ > This value looks suspicious. The value specified as 'zram-size' is in megabytes. To specify 32GB, you need to say '32*1024'. The parsing of suffixes was a bit accidental. We originally had simpler parser that only parsed ints, and then when fasteval was added to parse formulas, I guess we didn't consider how suffixes would be handled. I don't think we can change this now, because this was documented behaviour and people may have used something like '4k' to get 4000 MB. I think the nice backwards-compatible solution would be to add a new setting, e.g. disk-size that is evaluated as bytes, and soft-deprecate zram-size. Zbyszek
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
I have now set it to ``` [zram0] zram-size = 32*1024 ``` and tried ``` sudo systemctl daemon-reload sudo systemctl restart systemd-zram-setup@zram0 ``` But it fails with ``` Job for [email protected] failed because the control process exited with error code. See "systemctl status [email protected]" and "journalctl -xeu [email protected]" for details. nov. 20 16:01:21 D2S3Q34 systemd[1]: Starting [email protected] - Create swap on /dev/zram0... nov. 20 16:01:21 D2S3Q34 zram-generator[162009]: Error: Failed to configure disk size into /sys/block/zram0/disksize nov. 20 16:01:21 D2S3Q34 zram-generator[162009]: Caused by: nov. 20 16:01:21 D2S3Q34 zram-generator[162009]: Device or resource busy (os error 16) nov. 20 16:01:21 D2S3Q34 systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE nov. 20 16:01:21 D2S3Q34 systemd[1]: [email protected]: Failed with result 'exit-code'. nov. 20 16:01:21 D2S3Q34 systemd[1]: Failed to start [email protected] - Create swap on /dev/zram0. ``` On Wed, Nov 20, 2024 at 3:59 PM Zbigniew Jędrzejewski-Szmek < [email protected]> wrote: > On Thu, Nov 07, 2024 at 07:35:43PM +0100, Michal Koutný wrote: > > Hello Torstein. > > > > On Tue, Nov 05, 2024 at 03:51:31PM GMT, Torstein Sřrnes < > [email protected]> wrote: > > > I have a Fedora 41 laptop with 32GB of ram. > > > > > > On startup, this shows in the journal: > > > ``` > > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Error: Failed to > configure > > > disk size into /sys/block/zram0/disksize > > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Caused by: > > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Cannot allocate > memory > > > (os error 12) > > > nov. 05 13:58:32 D2S3Q34 kernel: zram-generator: vmalloc error: size > > > 1310720, exceeds total pages, > mode:0xdc0(GFP_KERNEL|__GFP_ZERO), > > ^^^ > > This value looks suspicious. > > The value specified as 'zram-size' is in megabytes. To specify 32GB, you > need to say '32*1024'. > > The parsing of suffixes was a bit accidental. We originally had > simpler parser that only parsed ints, and then when fasteval was added > to parse formulas, I guess we didn't consider how suffixes would be > handled. I don't think we can change this now, because this was > documented behaviour and people may have used something like '4k' > to get 4000 MB. I think the nice backwards-compatible solution would > be to add a new setting, e.g. disk-size that is evaluated as bytes, > and soft-deprecate zram-size. > > Zbyszek >
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
On Fri, 8 Nov 2024 at 18:31, Torstein Sørnes wrote: > I get an error that the device is not found even though it seems to exist > with ls. > $ /usr/lib/systemd/system-generators/zram-generator --setup-device > /dev/zram0 > (base) 19:25:17 > Error: Device /dev/zram0 not found > $ ls -Ah -l /dev/zram0 > > (base) 19:25:19 > brw-rw. 1 root disk 252, 0 2024-11-08 19:22 /dev/zram0 > > $ cat /etc/systemd/zram-generator.conf > > (base) 19:25:26 > [zram0] > zram-size = 32G > > >From the user manual zram-size= Sets the size of the zram device as a function of MemTotal, available as the ram variable. Arithmetic operators (^%/*-+), e, π, SI suffixes, log(), int(), ceil(), floor(), round(), abs(), min(), max(), and trigonometric functions are supported. Defaults to min(ram / 2, 4096) Do you have >32G in your machine, how much. Maybe set the value a bit lower or define it as a fraction
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
Do you have any more advice on this? On Fri, Nov 8, 2024 at 7:26 PM Torstein Sørnes wrote: > I get an error that the device is not found even though it seems to exist > with ls. > $ /usr/lib/systemd/system-generators/zram-generator --setup-device > /dev/zram0 > (base) 19:25:17 > Error: Device /dev/zram0 not found > $ ls -Ah -l /dev/zram0 > > (base) 19:25:19 > brw-rw. 1 root disk 252, 0 2024-11-08 19:22 /dev/zram0 > > $ cat /etc/systemd/zram-generator.conf > > (base) 19:25:26 > [zram0] > zram-size = 32G > > On Thu, Nov 7, 2024 at 7:35 PM Michal Koutný wrote: > >> Hello Torstein. >> >> On Tue, Nov 05, 2024 at 03:51:31PM GMT, Torstein Sørnes < >> [email protected]> wrote: >> > I have a Fedora 41 laptop with 32GB of ram. >> > >> > On startup, this shows in the journal: >> > ``` >> > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Error: Failed to >> configure >> > disk size into /sys/block/zram0/disksize >> > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Caused by: >> > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Cannot allocate >> memory >> > (os error 12) >> > nov. 05 13:58:32 D2S3Q34 kernel: zram-generator: vmalloc error: size >> > 1310720, exceeds total pages, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), >> ^^^ >> This value looks suspicious. >> >> > After starting up, I can execute this series of commands, and >> successfully >> > create a 32GB swap: >> > ``` >> > sudo swapoff /dev/zram0 >> >sudo zramctl --reset /dev/zram0 >> >sudo zramctl --find --size 32G >> >> Notice zramctl operation may differ from zram-generator, >> perhaps try with: >> /usr/lib/systemd/system-generators/zram-generator --setup-device >> /dev/zram0 >> >> and what is in your zram-generator.conf? >> >> Thanks, >> Michal >> >
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
I get an error that the device is not found even though it seems to exist with ls. $ /usr/lib/systemd/system-generators/zram-generator --setup-device /dev/zram0 (base) 19:25:17 Error: Device /dev/zram0 not found $ ls -Ah -l /dev/zram0 (base) 19:25:19 brw-rw. 1 root disk 252, 0 2024-11-08 19:22 /dev/zram0 $ cat /etc/systemd/zram-generator.conf (base) 19:25:26 [zram0] zram-size = 32G On Thu, Nov 7, 2024 at 7:35 PM Michal Koutný wrote: > Hello Torstein. > > On Tue, Nov 05, 2024 at 03:51:31PM GMT, Torstein Sørnes < > [email protected]> wrote: > > I have a Fedora 41 laptop with 32GB of ram. > > > > On startup, this shows in the journal: > > ``` > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Error: Failed to configure > > disk size into /sys/block/zram0/disksize > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Caused by: > > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Cannot allocate memory > > (os error 12) > > nov. 05 13:58:32 D2S3Q34 kernel: zram-generator: vmalloc error: size > > 1310720, exceeds total pages, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), > ^^^ > This value looks suspicious. > > > After starting up, I can execute this series of commands, and > successfully > > create a 32GB swap: > > ``` > > sudo swapoff /dev/zram0 > >sudo zramctl --reset /dev/zram0 > >sudo zramctl --find --size 32G > > Notice zramctl operation may differ from zram-generator, > perhaps try with: > /usr/lib/systemd/system-generators/zram-generator --setup-device /dev/zram0 > > and what is in your zram-generator.conf? > > Thanks, > Michal >
Re: [systemd-devel] Fwd: System fails to create zram on startup, but I can do so manually
Hello Torstein. On Tue, Nov 05, 2024 at 03:51:31PM GMT, Torstein Sørnes wrote: > I have a Fedora 41 laptop with 32GB of ram. > > On startup, this shows in the journal: > ``` > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Error: Failed to configure > disk size into /sys/block/zram0/disksize > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Caused by: > nov. 05 13:58:32 D2S3Q34 zram-generator[1059]: Cannot allocate memory > (os error 12) > nov. 05 13:58:32 D2S3Q34 kernel: zram-generator: vmalloc error: size > 1310720, exceeds total pages, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), ^^^ This value looks suspicious. > After starting up, I can execute this series of commands, and successfully > create a 32GB swap: > ``` > sudo swapoff /dev/zram0 >sudo zramctl --reset /dev/zram0 >sudo zramctl --find --size 32G Notice zramctl operation may differ from zram-generator, perhaps try with: /usr/lib/systemd/system-generators/zram-generator --setup-device /dev/zram0 and what is in your zram-generator.conf? Thanks, Michal signature.asc Description: PGP signature
