Launching Linux from Busybox (pivot_root or switch_root, or ? )

Laurent Bercot ska-dietlibc at skarnet.org
Tue Jun 10 10:58:27 UTC 2014


>  From the (perfectly working) busybox system:
>
> /export PATH=/bin:/sbin:/usr/bin:/usr/sbin
> mount -t sysfs sysfs /sys
> mkdir -p /dev/pts
> mount -t devpts devpts /dev/pts
> mount /dev/mmcblk0p5 /mnt/root/
>
> Then I tried 2 ways:
>
> *1) pivot_root*
>
> /cd /mnt/root
> pivot_root . ./initrd
> ./bin/mount -n --move ./initrd/sys ./sys
> ./bin/mount -n --move ./initrd/proc ./proc
> ./bin/mount -t devtmpfs none ./dev
> ./bin/mount -n --move ./initrd/dev/pts ./dev/pts
> exec ./usr/sbin/chroot . ./sbin/init < ./dev/ttyO0 > ./dev/ttyO0 2>&1/
>
> This gives the following error :
>
> /Couldn't find an alternative telinit implementation to spawn./

  This is the clean way of doing what you want, and your script is
correct. What is happening is that your Angström's systemd doesn't 
understand that it's the init in charge.

  This is a systemd issue you are having, not a Busybox issue. I have no
idea how to debug this, but since systemd expects to be started by the
kernel with only a devtmpfs and no other mount, maybe try unmounting
your /sys, /proc and /dev/pts instead of moving them after your
pivot_root ?

  (Or better yet, don't use systemd. :P)

-- 
  Laurent


More information about the busybox mailing list