[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Ensuring initramfs is compressed with zstd



I did a test installation with d-i bookworm alpha 2, and I noticed a
warning message from update-initramfs during base installation that it
was falling back from zstd to gzip compression.  zstd has been the
default compressor in initramfs-tools for a while, but since the
compressor is configurable it only Recommends zstd.

It looks like later package upgrades lead to a new initramfs being
generated with zstd.  However, it is possible that in some conditions
an installation would not include zstd, or would leave the initramfs
compressed with gzip even though zstd is installed.

Does the patch below for base-installer seem like a reasonable change?
(I haven't tested it yet, but may do so tomorrow.)

Ben.

diff --git a/library.sh b/library.sh
index e7fb8f60..120a39ae 100644
--- a/library.sh
+++ b/library.sh
@@ -542,12 +542,16 @@ EOF
 	if [ "$do_initrd" = yes ]; then
 		rd_generator=initramfs-tools
 
-		# initramfs-tools needs busybox pre-installed (and only
-		# recommends it)
+		# initramfs-tools may need busybox, and prefers to use
+		# zstd over gzip, but only recommends them
 		if ! log-output -t base-installer apt-install busybox; then
 			db_subst base-installer/kernel/failed-package-install PACKAGE busybox
 			exit_error base-installer/kernel/failed-package-install
 		fi
+		if ! log-output -t base-installer apt-install zstd; then
+			db_subst base-installer/kernel/failed-package-install PACKAGE zstd
+			exit_error base-installer/kernel/failed-package-install
+		fi
 
 		# Make sure the ramdisk creation tool is installed before we
 		# change its configuration

-- 
Ben Hutchings
Q.  Which is the greater problem in the world today,
    ignorance or apathy?
A.  I don't know and I couldn't care less.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: