switch_root: not rootfs
Rob Landley
rob at landley.net
Wed Aug 30 18:28:56 UTC 2006
On Wednesday 30 August 2006 11:15 am, Jon Saints wrote:
> I am new to busybox and things are working fairly well
> until i try:
>
> switch_root /tmp/nfsroot /sbin/init
>
> Then I see:
>
> switch_root: not rootfs
>
> I don't seem to find any google results on this error
> when searching. Any ideas where I might start to
> debug?
From switch_root.c:
// Additional sanity checks: we're about to rm -rf /, so be REALLY SURE
// we mean it. (I could make this a CONFIG option, but I would get email
// from all the people who WILL eat their filesystemss.)
if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) ||
(stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) ||
getpid() != 1)
{
bb_error_msg_and_die("not rootfs");
}
It's checking that you have an /init, and that it's a regular file. It checks
that / is ramfs or tmpfs. And it checks that you are PID 1.
If any of those is _not_ true, then doing the equivalent of "find / -xdev |
rm -f" (which is how switch_root frees up the memory used by rootfs before
mounting the new root filesystem on top of it) probably isn't a good idea.
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list