[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: More custom initramfs switch_root woes (bad '/sbin/init')
From:       "Matthew Franz" <mdfranz () gmail ! com>
Date:       2007-04-19 13:37:56
Message-ID: 33acb3db0704190637o1baf24c7v40b599910fab423c () mail ! gmail ! com
[Download RAW message or body]

Guys,

Thanks for the help!

 Indeed, I most certainly did not want to switch_root or mount another
filesystem for root.

For some reason I had it in my head that I had to leave rootfs
(probably because past attempts to run /sbin/init (without exec)

An /init as simple as this works just fine (assuming I don't forget to
define a default shell when make menuconfig-ing)

#!/bin/sh
/bin/busybox  mount -t proc none /proc
/bin/busybox --install
exec /sbin/init



On 4/18/07, Denis Vlasenko <vda.linux@googlemail.com> wrote:
> On Wednesday 18 April 2007 06:09, Matthew Franz wrote:
> > I've seen earlier thread this month (and a lot of the comments/wiki
> > pages) over on the Gento site and read most everything (well, except
> > Kernel/Busybox source)
> >
> > switch_root: bad init '/sbin/init'
> > [   18.571462] Kernel panic - not syncing: Attempted to kill init!
> > [   18.584241]
> >
> > Busybox 1.4.2 (glibc -- built on Ubuntu Dapper)
> > Kernel 2.6.20.2
> >
> > * I assume it is possible for the real root to be a ramfs  (if there
> > are other ways to get job control and multiple terminals I'm fine with
> > that too) I would love for the /init to behave like linuxrc and just
> > behave like linitrd. There is no *real* root (meaning some physical
> > device or cloop or whatever)
>
> denis: parse error in previous paragraph.
>
> > * The fact that my initramfs /init is being executed by bash (I have
> > my reason) shouldn't be an issue?!
>
> It's fine. My init on all my boxes is a sh script. It works 100.00%.
>
> > * The initramfs should be fine (created with code ripped from
> > mkinitramfs from Ubuntu) but I can post that somewhere
> >
> > I'm left scratching my head here and am hoping another few sets of
> > eye's might spot a goof-up...
> ...
> > cp -a /dev/tty[0-9] /newroot/dev/
> > cp -a /dev/ttyS[0-9] /newroot/dev/
> > cp -a /dev/hd* /newroot/dev/
> > cp -a /dev/sd* /newroot/dev/
> > cp -a /dev/ram* /newroot/dev/
> >
> > echo "Entering final root"
> > exec switch_root -c /dev/console /newroot /sbin/init
>
> switch_root.c:
>
>         execv(argv[optind], argv+optind);
>         bb_error_msg_and_die("bad init '%s'", argv[optind]);
>
> Someone decided that printing errno here is making
> user's life too easy. Neat, eh? ;)
>
> Replace that with bb_perror_msg_and_die(), I will do it in svn too.
>
> The rest of switch_root is similarly prone to giving far too terse
> or outright wrong error messages, but fixing that will make it bigger.
> --
> vda
>


-- 
Matthew Franz
http://www.threatmind.net/
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic