switch_root and centos

Christopher Barry christopher.barry at rackwareinc.com
Mon Dec 14 19:53:33 UTC 2009

On Sun, 2009-12-13 at 22:30 -0500, Michael Di Domenico wrote:
> Can anyone point me towards a how-to that shows step by step how to
> boot up busybox and then switch_root to Centos installed on a local
> hard drive and start that up?
> After messing with busybox for a few days, i've gotten it to pxe boot
> and run inside QEMU, but i'm having the hardest time getting
> switch_root to startup Centos fully
> The first problem i hit is the infamous "not rootfs", which i can see
> is controlled by conditions, though have no idea which one i'm failing
> on (a more verbose error msg would have been nice).  I commented out
> the conditions and it does seem to pivot root, but doing
> exec switch_root /newroot /etc/rc.d/rc.sysinit
> looks like things are going to startup and it pushes through some of
> the sysinit scripts, but then dumps me back into busybox
> Which led me to believe its not really invoking /sbin/init, but when i do
> exec switch_root /newroot /sbin/init 3
> I get 'timeout opening/waiting for initctl'
> I'm really at a loss to understand what's not working and googling
> hasn't turned up any revelations
> Here's my busybox init script
> ---
> #!/bin/sh
> mount -t proc proc /proc
> mount -t sysfs sysfs /sys
> mount -t tmpfs tmpfs /dev
> echo "Creating initial device nodes"
> mdev -s
> echo "Loading jbd.ko module"
> insmod /lib/modules/jbd.ko
> echo "Loading ext3.ko module"
> insmod /lib/modules/ext3.ko
> echo "Loading scsi_mod.ko module"
> insmod /lib/modules/scsi_mod.ko
> echo "Loading sd_mod.ko module"
> insmod /lib/modules/sd_mod.ko
> echo "Loading libata.ko module"
> insmod /lib/modules/libata.ko
> echo "Loading pata_sis.ko module"
> insmod /lib/modules/pata_sis.ko
> echo "Loading sata_sis.ko module"
> insmod /lib/modules/sata_sis.ko
> echo "Loading ata_piix.ko module"
> insmod /lib/modules/ata_piix.ko
> echo "Loading mii.ko module"
> insmod /lib/modules/mii.ko
> echo "Loading e1000.ko module"
> insmod /lib/modules/e1000.ko
> echo "Loading sis900.ko module"
> insmod /lib/modules/sis900.ko
> mount /dev/hda /newroot
> exec switch_root /newroot /sbin/init 3
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox

exec switch_root -c /dev/console /newroot /sbin/init

and drop the args initially.


More information about the busybox mailing list