[pkg-cryptsetup-devel] Bug#559510: generates a huge ramdisk because all modules are copied

Martin Michlmayr tbm at cyrius.com
Fri Dec 4 23:27:24 UTC 2009


Package: cryptsetup
Version: 2:1.1.0~rc2-1
Severity: important
Tags: patch

After installing cryptsetup on my armel machine, the initramfs grew
from 4.5 MB to 15 MB, causing an error because the ramdisk no longer
fit in flash.  All modules were copied to the ramdisk!

This is because armel (and some other arches) don't have a kernel/arch
directory, and you do:

  archcrypto="$(find "$MODULESDIR/kernel/arch" -type d -name "crypto")"
  copy_modules_dir "${archcrypto##*${MODULESDIR}/}"

In my case, copy_modules_dir is executed with an empty argument,
apparently leading to all modules being copied.

The fix is to check if $archcrypto is empty.

I also added some checks for the kernel/arch dir because otherwise
your find calls generate "No such file or directory" messages.

--- cryptroot~	2009-12-04 23:13:44.319569469 +0000
+++ cryptroot	2009-12-04 23:13:39.679818772 +0000
@@ -442,12 +442,14 @@
 	#
 	#   d) /lib/modules/$VERSION/kernel/drivers/crypto/$specific-$mod.ko
 
-	for file in $(find "$MODULESDIR/kernel/arch/" -name "$mod-*.ko"); do
-		altmod="${file##*/}"
-		altmod="${altmod%.ko}"
-		manual_add_modules "$altmod"
-		found="yes"
-	done
+	if [ -e "$MODULESDIR/kernel/arch/" ]; then
+		for file in $(find "$MODULESDIR/kernel/arch/" -name "$mod-*.ko"); do
+			altmod="${file##*/}"
+			altmod="${altmod%.ko}"
+			manual_add_modules "$altmod"
+			found="yes"
+		done
+	fi
 
 	for file in $(find "$MODULESDIR/kernel/crypto/" -name "${mod}_generic.ko"); do
 		altmod="${file##*/}"
@@ -499,8 +501,12 @@
 	setup="yes"
 
 	if [ "$MODULES" = "most" ]; then
-		archcrypto="$(find "$MODULESDIR/kernel/arch" -type d -name "crypto")"
-		copy_modules_dir "${archcrypto##*${MODULESDIR}/}"
+		if [ -e "$MODULESDIR/kernel/arch" ]; then
+			archcrypto="$(find "$MODULESDIR/kernel/arch" -type d -name "crypto")"
+			if [ -n "$archcrypto" ]; then
+				copy_modules_dir "${archcrypto##*${MODULESDIR}/}"
+			fi
+		fi
 		copy_modules_dir "kernel/crypto"
 	else
 		for mod in $modules; do

-- 
Martin Michlmayr
http://www.cyrius.com/





More information about the pkg-cryptsetup-devel mailing list