Page MenuHomeVyOS Platform

Missing compression algorithms in kernel config regarding initrd
Open, WishlistPublicBUG

Description

The current kernel config supports xz and zstd among other compression algorithms regarding the kernel itself (xz is selected):

https://github.com/vyos/vyos-build/blob/168a86e1dba06d4f464a23cc7f1b79003cb777e9/packages/linux-kernel/arch/x86/configs/vyos_defconfig

CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_HAVE_KERNEL_ZSTD=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_ZSTD is not set

But when it comes to available compression algorithms for initrd the list is limited:

CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_RD_ZSTD=y

The above means if attempting to configure initramfs.conf to use xz the result becomes gzip as fallback:

$ file initrd.img-6.1.56-amd64-vyos 
initrd.img-6.1.56-amd64-vyos: gzip compressed data, max compression, from Unix, original size modulo 2^32 106998272

While when using default zstd compression in initramfs.conf:

$ file initrd.img-6.1.56-amd64-vyos 
initrd.img-6.1.56-amd64-vyos: Zstandard compressed data (v0.8+), Dictionary ID: None

Suggested fix is to add at least support for xz like so:

CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
CONFIG_RD_XZ=y
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_RD_ZSTD=y

If size matters then gzip can be unset like so:

# CONFIG_RD_GZIP is not set

Support for both xz and zstd should remain due to most likely upcoming changes for initrd:

https://www.phoronix.com/news/Ubuntu-2023-Initramfs-Compress

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.5-rolling-202310070623
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Related Objects