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

Bug#1021918: debian-installer: Kernel module blacklisting inconsistent



Control: reassign -1 rootskel
Control: tags -1 patch d-i

Here are two proposed patches for rootskel.

1) The first patch adds "modprobe" to the ignore list when parsing module parameters in the kernel command line to skip modprobe.blacklist parameters which are intended to modprobe, not to a kernel module.

2) Module parameters passed in the kernel command line after --- or -- are duplicated in both /etc/modprobe.d/local.conf by rootskel and /etc/default/grub by grub-installer. The second patch skips parsing of module parameters after --- or -- to avoid the useless duplicate.

I seek advice from d-i developpers about a third issue in rootskel.

The installer parses "<module>.blacklist=yes" kernel parameters and creates "blacklist <module>" entries in /etc/modprobe.d/blacklist.local.conf. However it happens after udev is started so it is uneffective with modules included in initrd.gz.

Note: "modprobe.blacklist=<module>" kernel parameters are parsed by modprobe so do not have this flaw.

1. Should this flaw be fixed ?
2. If yes, how ?
3. Should the <module>.blacklist=yes method be deprecated in favour of modprobe.blacklist=<module> which is handled directly by modprobe and does not require any special processing by rootskel ?

I tried to delay the start of udev until after blacklist.local.conf has been created, but then /dev/tty* device files are created late and the selected console is /dev/console instead of /dev/tty0|1. As a result, the installer does not seem to use the framebuffer and does not offer languages other than English.
From 51ab95b8e612772b38f48a791aa2227717b4969c Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Fri, 21 Oct 2022 14:29:25 +0200
Subject: [PATCH 1/3] S02module-params: add "modprobe" to ignore list

modprobe.blacklist=<module> kernel command-line parameters are used by
modprobe to blacklist modules.
These parameters should not be added to /etc/modprobe.d/local.conf.
---
 src/lib/debian-installer-startup.d/S02module-params | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lib/debian-installer-startup.d/S02module-params b/src/lib/debian-installer-startup.d/S02module-params
index 751cd24..e292fa0 100644
--- a/src/lib/debian-installer-startup.d/S02module-params
+++ b/src/lib/debian-installer-startup.d/S02module-params
@@ -21,6 +21,7 @@ for word in $(cat /proc/cmdline); do
 
 	# skip things that we know are not modules
 	case "$module" in
+		modprobe|\
 		fsck|\
 		locale|\
 		luks|\
-- 
2.30.2

From 387268eb1398d447aad72a285ecafd546dd85e25 Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Fri, 21 Oct 2022 15:23:11 +0200
Subject: [PATCH 2/3] S02module-params: skip module parameters after -- or ---

Kernel command-line module parameters after -- or --- will be handled by
grub-installer later, so skip them to avoid duplicates between
GRUB_CMDLINE_LINUX and /etc/modprobe.d/local.conf.
---
 src/lib/debian-installer-startup.d/S02module-params | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lib/debian-installer-startup.d/S02module-params b/src/lib/debian-installer-startup.d/S02module-params
index e292fa0..820e146 100644
--- a/src/lib/debian-installer-startup.d/S02module-params
+++ b/src/lib/debian-installer-startup.d/S02module-params
@@ -3,6 +3,12 @@
 # modules are loaded. Also check for modules to be blacklisted.
 
 for word in $(cat /proc/cmdline); do
+	# skip module parameters after -- or --- (handled by grub-installer)
+	if [ "$word" = "--" -o "$word" = "---" ]; then
+		user_param=1;
+		continue
+	fi
+
 	var="${word%%=*}"
 	val="${word#[!=]*=}"
 
@@ -39,7 +45,7 @@ for word in $(cat /proc/cmdline); do
 	if [ "$module" ] && [ "$param" ]; then
 		if [ "$param" = blacklist ]; then
 			register-module -b "$module"
-		else
+		elif [ -z "$user_param" ]; then
 			register-module -p -a "$module" "$param=$val"
 		fi
 	fi
-- 
2.30.2


Reply to: