October 31st, 2006

Enterprise Bridge

busybox and initrd subtlety

The lesson I learned at the end of last week was this: If you're using an initrd (initial RAM disk) to boot a system, with busybox as your jack-of-all-trades shell and binaries combination, and you want to run a script which will do things like mount network shares and load modules and configure interfaces, and you want that script to exec /sbin/init on one of those shares you've mounted as your root partition, your script needs to be run as init, not by init.

Basically, when you set up busybox on your initrd image, do NOT create a link to busybox called "init". If you do, the kernel will see it and execute busybox as init. If it calls your script as an rc file, your script will not be able to exec another init. You want to save your script as "linuxrc" in the root directory of your initrd. This way, the script will be run as init, and will retain the ability to chain into another init.

Once I work all the rough edges off my NFS slackware environment, I'll post details...