1 |
On Tue, 2 Jul 2013 11:29:47 +0000 (UTC) |
2 |
Duncan <1i5t5.duncan@×××.net> wrote: |
3 |
|
4 |
> > |
5 |
> > First, there is a new kernel option called "Kernel support for scripts |
6 |
> > starting with #!." |
7 |
> > |
8 |
|
9 |
> And no, as you found out it's *NOT* initramfs-only. It's basic kernel |
10 |
> functionality that been assumed for (I guess) decades now. |
11 |
|
12 |
> |
13 |
> But as you may have noticed, openrc, gentoo's default init system, uses |
14 |
> #!/sbin/runscript to point to runscript (part of openrc), as its script |
15 |
> interpreter, and it may well be that turning off kernel shebang support |
16 |
> screwed you up that way. |
17 |
> |
18 |
|
19 |
I am entirely sure what is happening with this kernel "#!" option. |
20 |
|
21 |
My boot scripts are very simple and customized for my specific machine |
22 |
(as opposed to having a complex set of highly generalized scripts that |
23 |
attempt to account for every possible situation). |
24 |
|
25 |
Basically, once the kernel loads itself, it invokes the init binary |
26 |
which then uses parameters in /etc/inittab to invoke appropriate |
27 |
scripts (or other binaries). From my inittab, only a single |
28 |
bash script is called for system initialization and this bash script |
29 |
runs just fine _without_ the kernel "#!" option. |
30 |
|
31 |
However, after this bash initialization script executes, the console |
32 |
login process then begins. My inittab contains this line for login: |
33 |
|
34 |
agetty -n -l /sbin/autologin 38400 tty1 |
35 |
|
36 |
Now /sbin/autologin is another bash script and it is *only at this point* |
37 |
that the boot fails to complete without the kernel "#!" option. |
38 |
IOW, my bash boot scripts succeed but the bash autologin script |
39 |
fails w/o the kernel "#!" option. |
40 |
|
41 |
I suspect, although I have not tested it, that if I substitute a normal |
42 |
binary login (i.e. /bin/login) for the bash /sbin/autologin then |
43 |
the boot will be completely successful w/o the kernel "#!" option. |
44 |
|
45 |
So what does the "#!" option accomplish? Does it allow the kernel to |
46 |
effect redirection based on "#!?" This should only be necessary if |
47 |
bash itself is not invoked, but in boot-up based on init and inittab, |
48 |
bash, I believe, is automatically invoked for all scripts. But yet |
49 |
the agetty program, after boot-up is essentially complete, fails |
50 |
to execute the bash script in its parameter list. At this point is |
51 |
it agetty, or the kernel, that is responsible for executing the |
52 |
autologin script? |
53 |
|
54 |
I need to study this more. |
55 |
|
56 |
Frank Peters |