can't switch_root inside initramfs

LEVAI Daniel leva at ecentrum.hu
Mon Aug 31 09:03:02 UTC 2009


On Saturday 29 August 2009 16.30.24 you wrote:
> On Sat, Aug 29, 2009 at 3:23 AM, LEVAI Daniel <leva at ecentrum.hu> wrote:
> > cd /mnt/target/
> > bunzip2 -c /"${FILENAME}" |cpio -dimuHcrc
> >
> > exec switch_root -c /dev/console /mnt/target/ /sbin/init
> > ----------------### /init ###----------------
> >
> >
> > After the switch_root I get this error:
> > switch_root: bad newroot /mnt/target
> > Kernel panic - not syncing: Attempted to kill init!
> >
> >
> > The newroot (/mnt/target) resides in the ramfs itself, which is 1GiB.
> > Inside the newroot (/mnt/target) there is a full blown debian distro,
> > which I
> > intend to start. I can safely assume that the extracted files in
> > /mnt/target
> > are not corrupted, because I check the archive's shasum and the archive
> > type
> > is cpio with crc, so during extraction I would've got errors if there
> > were any. If I run a shell instead of switch_root to poke around, the new
> > root directory seems fine, and I can not think of anything else right
> > know as the
> > cause of this problem... :/
>
> Before the bunzip2, try this:
> mount -t tmpfs -o none /mnt/target
This is the right way, thanks, however exactly this command line doesn't work 
for me. I have to specify "tmpfs" a the source device and the -o none is a no 
go too, I don't have that option listed in mount --help. Btw, I'm using the 
1_14 branch, maybe this is only working with the new 1_15 branch?

# mount -t tmpfs -o none /mnt/target
mount: can't find /mnt/target/ in /etc/fstab

# mount -t tmpfs -o none tmpfs /mnt/target
mount: mounting tmpfs on /mnt/target/ failed: Invalid argument

# mount -t tmpfs tmpfs /mnt/target
# echo $?
0


> Otherwise, when you do the switch_root, your rootfs is still in the
> initramfs which is getting cleaned up by the switch_root applet.


Thanks a lot!


Daniel

-- 
LÉVAI Dániel
PGP key ID = 0x4AC0A4B1
Key fingerprint = D037 03B9 C12D D338 4412  2D83 1373 917A 4AC0 A4B1


More information about the busybox mailing list