tech-embed archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

init problem [was: Re: Tests of mdsetimage -s]



On Sat, 2 Apr 2005, Marcin Jessa wrote:
I copied over /sbin/init to my image's /sbin/oinit and it still does not 
execute ...
...
warning: no /dev/console
exec /sbin/init: error 8
init: trying /sbin/oinit

Then it just hangs ...

There are two problems here:
#1: no /dev/console
#2: /sbin/init giving error 8

For #1: Either you populate /dev on your disk properly, or you don't. In the latter case, init(8) (which gets ran by the kernel, at least normally :) does some mfs magic and runs some MAKEDEV script on it's own. If you make your own helloworld-style init program, chances are good that all that just won't happen, and thus things fail mysteriously.

For #2: This is the problem that your init(8) doesn't get loaded in the first place. Error 8 means (according to /usr/include/sys/errno.h):

        #define ENOEXEC         8               /* Exec format error */

i.e. the kernel cannot load either your /sbin/init, or (my wild guess) there's some trouble with shared libraries. Is /libexec/ld.elf_so there? Execute permissions ok? Are all the libraries there? Permissions ok? ...

Having a look at the exec(3) manpage and what it has to say about ENOEXEC may be of interest too:

     If the header of a file isn't recognized (the attempted execve(2)
     returned ENOEXEC), these functions will execute the shell with the path
     of the file as its first argument.  (If this attempt fails, no further
     searching is done.)

Just for kicks, is your /bin/sh ok? (Not that that code path should be entered here in the first place...).

Other questions that come to mind (and which may help you debugging:
What does "file init" say?
What does "ldd init" say?
(Running both on the build system should be OK)


 - Hubert

--
NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)



Home | Main Index | Thread Index | Old Index