[BUG] zram-generator 1.2.1: unit-suffixed zram-size (e.g. 15G) yields disksize 2^20x too large - zram setup always fails with ENOMEM
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- linux, shell
- Domain
- operating-systems
Research direction
The report traces the failure to process_size() in the upstream zram-generator's src/config.rs and names the pinned tests test_eval_size_expression_32g and test_eval_size_expression_500k. Read that function and those tests first, then check how the CachyOS packaging obtains the generator; done means unit-suffixed sizes produce the intended disk size and the regression tests cover both examples.
Written by the indexing model from the issue text.
Description
Packages: zram-generator 1.2.1-1.1, systemd 262-1, linux-cachyos 7.2.9-2 (same on 7.2.9-1)
/etc/systemd/zram-generator.conf:
[zram0]
compression-algorithm = zstd
zram-size = 15G
swap-priority = 100
fs-type = swap
Every setup attempt fails (repro: systemctl restart [email protected]):
zram-generator[1587]: Error: Failed to configure disk size into /sys/block/zram0/disksize
zram-generator[1587]: Caused by:
zram-generator[1587]: Cannot allocate memory (os error 12)
kernel: zram-generator: vmalloc error: size 61440000000000, exceeds total pages, mode:0xdc0(GFP_KERNEL|__GFP_ZERO)
kernel: vzalloc_noprof+0x5f/0x70
kernel: disksize_store+0x6b/0x370 [zram]
kernel: kernfs_fop_write_iter+0xe4/0x190
kernel: __x64_sys_write+0x24a/0x450
The generator hands the kernel a disksize of 15,728,640,000,000,000 bytes (15.7 PB) for zram-size = 15G. process_size() (src/config.rs) multiplies the evaluated expression result by 1024*1024 unconditionally, while unit suffixes inside the expression are decimal — the v1.2.1 tests pin these semantics:
// test_eval_size_expression_32g
dev_with_zram_size_size(Some("32G"), 5000) == 32 * 1000_000_000 * 1024 * 1024
// test_eval_size_expression_500k
dev_with_zram_size_size(Some("500k"), 5000) == 500 * 1000 * 1024 * 1024
So any unit-suffixed zram-size ends up 2^20x larger than intended. The kernel's metadata table for that disksize is (disksize >> 12) * 16 = 61,440,000,000,000 bytes — exactly the vzalloc size in the log — which exceeds total memory, so disksize_store fails with -ENOMEM. Kernel side is fine; the requested value is absurd.
Bare MB expressions are unaffected (zram-size = ram, the cachyos-settings default), which is why only configs with a unit suffix break.
First occurrence in the retained journal: 2026-10-12 00:00:02 on 7.2.9-1; identical on 7.2.9-2. zram-generator, systemd and the config file predate both kernels (2026-05-04 / 2026-09-28 / 2026-07-16), so this is not a kernel regression. Side note: the zram module was not auto-loaded at boot on the 2026-10-10 boot (no modules-load.d entry, no zram: Added device until 2026-10-12 00:00:02), so the unit does not always fire at all.
Workaround: express the size as a bare MB value — zram-size = 15360 for 15 GiB.
Upstream: systemd/zram-generator, v1.2.1, src/config.rs (test_eval_size_expression_32g, test_eval_size_expression_500k).
- Dominant language
- Shell
- Stars
- 4.9k
- Forks
- 190
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CachyOS/linux-cachyos
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
CachyOS/linux-cachyos#1196 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CachyOS/linux-cachyos#1091 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
CachyOS/linux-cachyos#961 · 1 comment ·
-
[FEATURE] Pre-signed hwmon / fan control modules (nct6687d, it87) for linux-cachyos-eacPossibly taken @ventureoo claimed this 1 day ago. Openenhancement
CachyOS/linux-cachyos#1206 · 3 assignees ·
-
[Feature Request] Add prebuilt signed linux-cachyos-eac-tuxedo-drivers modulePossibly taken @ventureoo claimed this 1 day ago. Openenhancement
CachyOS/linux-cachyos#1205 · 3 assignees ·
All issues in CachyOS/linux-cachyos
Similar issues
-
documentation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-networking-best-practices#256 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
smores56/homelab-platform#289 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omacom/omarchy#21787 · 3 comments ·
Maintainers usually reply within 1 day