Skip to contentSkip to conversation

Problem spawning init from script

DISCUSSION Joe Schulz 2 participants 3 messages Apr 30, 2004 – May 1, 2004

lore
Share & tools
lore

Joe Schulz

author
#0 lore raw

Hello world,

for internal reasons I designed a custom boot procedure with two root partitions. One is booted by default and a script is executed via the "init=/sbin/initscript" kernel option.

The script restrieves some information and depending on that information it decides whether the current boot should continue or some other partition is being mounted and boot continues on that.

As the script involves the usage of USB storage, gpg, openssl, device mapper and various other bits, it would make some pretty big and hard to handle initrd so I decided to try it directly as described.

Infortunately when the script tries to exec'ute either one init proces or the other at its end, the kernel always panics:

Kernel panic: Attempted to kill init!

Does that mean I MUST use initrd to be able to use such a script or is there a way to get around this?

Hints appreciated,
Joe

#1 lore raw
Quoted 11 lines · Joe Schulz

Hello world,

for internal reasons I designed a custom boot procedure with two root partitions. One is booted by default and a script is executed via the "init=/sbin/initscript" kernel option.

The script restrieves some information and depending on that information it decides whether the current boot should continue or some other partition is being mounted and boot continues on that.

Quoted 8 lines

As the script involves the usage of USB storage, gpg, openssl, device mapper and various other bits, it would make some pretty big and hard to handle initrd so I decided to try it directly as described.

Infortunately when the script tries to exec'ute either one init proces or the other at its end, the kernel always panics:

Kernel panic: Attempted to kill init!

This typically means that process #1 exited. Kernel does not like that. I always use 'exec /path/something' as the last command in my sh scripts which I start instead of 'standard' /sbin/init.

Post your script.
--
vda

author
#2 lore raw
Quoted 7 lines · Denis Vlasenko
Quoted 1 line
Kernel panic: Attempted to kill init!

This typically means that process #1 exited. Kernel does not like that. I always use 'exec /path/something' as the last command in my sh scripts which I start instead of 'standard' /sbin/init.

Post your script.

I have found the reason. Due to a linking problem, the exec'ed process always quietly died. Of course only in the boot process, not during dry-run testing. So I had falsely assumed that exec'ing from #1 might always lead to a panic if you don't use the initrd procedure.

Thanks four your kind advice.

br, Joe