[2.4] initrd + linuxrc woes

Dec 08, 2006 2 Replies

Hello!



I'm trying to boot up a loop-aes encrypted root disk and created an initrd using cramfs based on the sample linuxrc-program of the loop-aes package (it's using dietlibc).



Using the kernel options "root=100 init=/linuxrc" the kernel unpacks the initrd and executes the linuxrc program.



However, this happens only if the linuxrc is the *only* executable within the initrd. As soon as i pack one more executable or library into the initrd, the kernel doesn't execute the linuxrc anymore!



If i put the additional libs and executables (glibc, ifconfig, losetup, etc.) onto the unencrypted boot partition i can execute them with fork & exec from within my linuxrc.



However, i *really* like to have glibc, ifconfig and losetup



*within* my initrd.

I'm puzzled.



Any clues?



Best regards, Pete


The initrd itself is not encrypted, of course. It's just used to mount an encrypted partition.

Basically i have

/dev/sda1 -> /boot (plain ext2) /dev/sda2 -> / (aes128 encrypted, ext2)

So, the linuxrc program within the initrd basically has to execute this command sequence:

losetup -p5 -e AES128 /dev/loop0 /dev/sda2 5< pwd.txt mount /dev/loop0 /new_root cd /new_root pivot_root . old_root exec chroot . sh -c 'umount /old_root; exec /sbin/init' \ dev/console 2>&1

As said, my initrd doesn't use a shell script. I'm using a simple c program based on the sample in the loop-aes source distribution.

However, this is moot now. Today i discovered that if i'm using EXT2 instead CRAMFS the initrd executes perfectly.

For the CRAMFS version to work i need to put any helper programs and libraries (losetup, mount, etc.) onto the /boot partition that i have to mount within the linuxrc. Adding them to the initrd-image doesn't work (and i checked permissions more than once!).

Seems that i tripped over some obscure CRAMFS bug in this old kernel (2.4.25).

Best regards, Pete

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required