initramfs cryptroot hook bloats armel initrd by adding >13M of compressed modules

Bug #495161 reported by Alexander Sack on 2009-12-10
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cryptsetup (Ubuntu)
Critical
Unassigned
Lucid
Critical
Unassigned

Bug Description

Binary package hint: cryptsetup

on armel our initrd size got bloated for alpha-1 from 3.8M to now over 16M ... i narrowed this down to the cryptroot hook that seems to add basically all modules to the initrd.

Alexander Sack (asac) wrote :

this busted our alpha-1 image as the initrd size exceeded what we reserve on install disk for it. making RC as going from 3.8M to 16.5M sounds like a bad regression ;).

Changed in cryptsetup (Ubuntu):
importance: Undecided → Critical
milestone: none → lucid-alpha-2
status: New → Triaged
tags: added: armel
Alexander Sack (asac) wrote :

adding a diff of the modules in karmic vs. lucid initrd.

dropping/adding the cryptroot hook makes the huge difference, so i expect that there is something fishy with the finds or something leading to a full copy of the modules dir.

Steve Langasek (vorlon) wrote :

Could you please capture the output of "version=$(uname -r) MODULESDIR=/lib/modules/$(uname -r) DESTDIR=/tmp/initramfs-test sh -x /usr/share/initramfs-tools/hooks/cryptroot"?

Oliver Grawert (ogra) wrote :
Alexander Sack (asac) wrote :

more info, these lines in cryptroot hook:

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

seem to cause a increase of initrd of about 10M.

commenting out makes the install finish.

Alexander Sack (asac) wrote :

i think the command from comment #3 should also set MODULES=most at least:

version=$(uname -r) MODULESDIR=/lib/modules/$(uname -r) MODULES=most DESTDIR=/tmp/initramfs-test sh -x /usr/share/initramfs-tools/hooks/cryptroot"

Oliver Grawert (ogra) wrote :

setting MODULES=most makes quite some difference, here the log of the same command prefixed with MODULES=most

Alexander Sack (asac) wrote :

so evaluation is that :

archcrypto="$(find "$MODULESDIR/kernel/arch" -type d -name "crypto")"
is empty for us on arm, which causes

copy_modules_dir "${archcrypto##*${MODULESDIR}/}"

to copy all modules.

two things to do here:

a) add a safety belt: dont call copy_modules_dir if archcrypto is empty
b) find out why on arm archcrypto is empty in the first place; if the find needs to be adjusted to it.

Oliver Grawert (ogra) wrote :

 if [ "$MODULES" = "most" ]; then
  archcrypto="$(find "$MODULESDIR/kernel/arch" -type d -name "crypto")"
  copy_modules_dir "${archcrypto##*${MODULESDIR}/}"
  copy_modules_dir "kernel/crypto"
 else

thats the function at fault ...
archcrypto is empty, that makes copy_modules_dir being called with an empty string, which in turn copies the toplevel modules directory

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cryptsetup - 2:1.1.0~rc2-1ubuntu2

---------------
cryptsetup (2:1.1.0~rc2-1ubuntu2) lucid; urgency=low

  * cryptroot-hook: dont call copy_modules_dir with empty arguments when
    archcrypto isnt found (LP: #495161)
 -- Oliver Grawert <email address hidden> Fri, 11 Dec 2009 14:39:00 +0100

Changed in cryptsetup (Ubuntu Lucid):
status: Triaged → Fix Released
Oliver Grawert (ogra) wrote :

the b) case doesnt apply for imx51 at least, where the sahara crypto device is built into the kernel:

root@ubuntu:/# grep SAHARA boot/config-2.6.31-601-imx51
CONFIG_MXC_SAHARA=y
# CONFIG_MXC_SAHARA_POLL_MODE is not set
# CONFIG_MXC_SAHARA_USER_MODE is not set
root@ubuntu:/#

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers