FS#72882 - [mkinitcpio] 31-1 does uncompress modules which wastes space and RAM

Attached to Project: Arch Linux
Opened by Tobias Powalowski (tpowa) - Tuesday, 30 November 2021, 09:13 GMT
Last edited by Tobias Powalowski (tpowa) - Monday, 21 November 2022, 06:04 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Giancarlo Razzolini (grazzolini)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No



I really don't know why the decompression part was added at all, imho the module should stay at compression level as it was intended by the kernel builder.

The decompression is horrible for archboot, it grows size extremly and so the RAM requirement to handle that too.

initcpio 30-2: 70MB all modules (cause it does not uncompress zstd modules)
initcpio 31-1: 252MB all modules (uncompressed all modules)

2 possible options to fix:
- leave kernel modules as the builder has chosen
- recompress modules with compression set in mkinitcpio.conf

This task depends upon

Closed by  Tobias Powalowski (tpowa)
Monday, 21 November 2022, 06:04 GMT
Reason for closing:  Fixed
Additional comments about closing:  mkinitcpio 33
Comment by Tobias Powalowski (tpowa) - Tuesday, 30 November 2021, 09:35 GMT
Added patch which removes decompression.
Comment by Jonathon (jonathon) - Tuesday, 21 December 2021, 11:43 GMT
I tested this patch locally and it increased the size of my initramfs (both standard and fallback) compared to COMPRESSION="zstd" and COMPRESSION_OPTIONS=(-19). I suspect this means that the second fix option is already in operation? (looks like linux-lqx is already doing zstd module compression)

With patch:
-rw------- 1 root root 24042141 Dec 21 11:34 initramfs-linux-lqx-fallback.img
-rw------- 1 root root 7317177 Dec 21 11:34 initramfs-linux-lqx.img
-rw------- 1 root root 34834862 Dec 21 11:35 initramfs-linux-zen-fallback.img
-rw------- 1 root root 7831695 Dec 21 11:35 initramfs-linux-zen.img

Without patch:
-rw------- 1 root root 24042141 Dec 21 11:36 initramfs-linux-lqx-fallback.img
-rw------- 1 root root 7317177 Dec 21 11:35 initramfs-linux-lqx.img
-rw------- 1 root root 28242424 Dec 21 11:36 initramfs-linux-zen-fallback.img
-rw------- 1 root root 7540827 Dec 21 11:36 initramfs-linux-zen.img
Comment by Tobias Powalowski (tpowa) - Tuesday, 21 December 2021, 11:58 GMT
It's not about file size, that will increase. It's about size during boot, there it is uncompressed and wastes space.
Comment by Jerry Xiao (JerryXiao) - Thursday, 30 December 2021, 14:27 GMT
Also, if decompression is really required, please redirect the zstd -d decompress output elsewhere since it is currently messing up the output of mkinitcpio.
Comment by Christian Hesse (eworm) - Thursday, 30 December 2021, 23:13 GMT
This is a bug in zstd 1.5.1...

See this for a workaround: https://github.com/archlinux/mkinitcpio/pull/85
Probably it will not be merged.