On Tue, 2 Jul 2013 11:29:47 +0000 (UTC)
Duncan <1i5t5.dun...@cox.net> wrote:

> > 
> > First, there is a new kernel option called "Kernel support for scripts
> > starting with #!." 
> >

> And no, as you found out it's *NOT* initramfs-only.  It's basic kernel 
> functionality that been assumed for (I guess) decades now.

> 
> But as you may have noticed, openrc, gentoo's default init system, uses 
> #!/sbin/runscript to point to runscript (part of openrc), as its script 
> interpreter, and it may well be that turning off kernel shebang support 
> screwed you up that way.
> 

I am entirely sure what is happening with this kernel "#!" option.

My boot scripts are very simple and customized for my specific machine
(as opposed to having a complex set of highly generalized scripts that
attempt to account for every possible situation).

Basically, once the kernel loads itself, it invokes the init binary
which then uses parameters in /etc/inittab to invoke appropriate
scripts (or other binaries).  From my inittab, only a single
bash script is called for system initialization and this bash script
runs just fine _without_ the kernel "#!" option.

However, after this bash initialization script executes, the console
login process then begins.  My inittab contains this line for login:

agetty -n -l /sbin/autologin 38400 tty1

Now /sbin/autologin is another bash script and it is *only at this point*
that the boot fails to complete without the kernel "#!" option.
IOW, my bash boot scripts succeed but the bash autologin script
fails w/o the kernel "#!" option.

I suspect, although I have not tested it, that if I substitute a normal
binary login (i.e. /bin/login) for the bash /sbin/autologin then
the boot will be completely successful w/o the kernel "#!" option.

So what does the "#!" option accomplish?  Does it allow the kernel to
effect redirection based on "#!?"  This should only be necessary if
bash itself is not invoked, but in boot-up based on init and inittab,
bash, I believe, is automatically invoked for all scripts.  But yet
the agetty program, after boot-up is essentially complete, fails
to execute the bash script in its parameter list.  At this point is
it agetty, or the kernel, that is responsible for executing the
autologin script?

I need to study this more.

Frank Peters


Reply via email to