On Tue, Jun 16, 2009 at 7:47 PM, Rob Landley<[email protected]> wrote: >> When I use switch_root I have an error "not rootfs", which comes from the >> condition !S_ISREG(st1.st_mode). When I remove this condition, all seems to >> work fine (or at least I think so). > > Sorry for the delay. I wrote busybox's switch_root (loosely based on the one > in klibc but mostly based on a knowledge of what the sucker needs to do). > >> What is this check for? > > Safety. It does an "rm -rf /" and it gets run as root. This is not something > you want a program doing without as many safeguards as humanly possible. > >> Can it be removed safely? > > If you don't mind accidentally doing an rm -rf / of your development system's > root filesystem the next time you accidentally run it to test something, sure. > >> What's wrong with my system to break here? > > If you're _not_ running out of init_ramfs (if for example you're using initrd > instead), you probably shouldn't use switch_root because it's the wrong tool. > > Basically what the sucker does is something like the following shell script: > > find / -xdev | xargs rm -rf > cd "$1" > shift > mount --move . / > exec chroot . "$@" > > There are a couple reasons that won't work as a shell script:
Woohoo. mini-doc is born! http://git.busybox.net/busybox/patch/?id=a5bdbe10877e2e53aaba051eddfd5d47520657f5 (If you object against your email being (ab)used like this, let me know). -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
