halt: init exits/panic
Hello!
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
I currently do:
- call reboot(RB_POWER_OFF/RB_AUTOBOOT/RB_HALT_SYSTEM)
- _exit(0)
Is this exit() call wrong? If I do RB_HALT_SYSTEM and _exit(0) after, the kernel panics.
Should init simply sleep, return to normal processing or exit?
Sincerly,
Nico
Signature · 3 lines
Keep it simple & stupid, use what's available. Please use pgp encryption: 8D0E 27A4 is my id. http://nico.schotteli.us | http://linux.schottelius.org
Hi Nico :)
* Nico Schottelius <[email protected]> dixit:
Quoted 2 lines
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
What I do in my vcinit, the last steps I mean, is:
reboot(RB_POWER_OFF); /* If halting*/
or
reboot(RB_AUTOBOOT); /* If rebooting */
exit(EXIT_SUCCESS);
And my vcinit doesn't panic ;)
Raúl Núñez de Arenas Coronado
Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net http://www.pleyades.net & http://www.gotesdelluna.net It's my PC and I'll cry if I want to...
Quoted 5 lines · Nico Schottelius
Hello!
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
Quoted 7 lines
I currently do:
- call
reboot(RB_POWER_OFF/RB_AUTOBOOT/RB_HALT_SYSTEM)
-_exit(0)Is this
exit()call wrong? If I doRB_HALT_SYSTEMand_exit(0)after, the kernel panics.
What the panic shows?
Signature · 2 lines
Coywolf Qi Hunt http://ahbl.org/~coywolf/
Sorry for the delay.
Coywolf Qi Hunt [Sun, Jul 10, 2005 at 01:09:22AM +0800]:
Quoted 8 lines · Nico Schottelius
Quoted 7 lines
Hello!
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
I currently do:
Quoted 7 lines
Quoted 5 lines
- call
reboot(RB_POWER_OFF/RB_AUTOBOOT/RB_HALT_SYSTEM)
-_exit(0)Is this
exit()call wrong? If I doRB_HALT_SYSTEMand_exit(0)after, the kernel panics.What the panic shows?
"Attempted to kill init!"
--> Panic.
Nico
Signature · 2 lines
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/) Open Source nutures open minds and free, creative developers.
Coywolf Qi Hunt [Sun, Jul 10, 2005 at 01:09:22AM +0800]:
Quoted 8 lines · Nico Schottelius
Quoted 7 lines
Hello!
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
I currently do:
Quoted 7 lines
Quoted 5 lines
- call
reboot(RB_POWER_OFF/RB_AUTOBOOT/RB_HALT_SYSTEM)
-_exit(0)Is this
exit()call wrong? If I doRB_HALT_SYSTEMand_exit(0)after, the kernel panics.What the panic shows?
To be fully correct:
"Kernel panic - not syncing: Attempted to kill init" (from the last time I tried, 2.6.13.2)
Perhaps _exit(0) is not correct for an init system? This at least explains why it always looks like nothing is synced.
Nico
Signature · 2 lines
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/) Open Source nutures open minds and free, creative developers.
Quoted 17 lines · Nico Schottelius
Coywolf Qi Hunt [Sun, Jul 10, 2005 at 01:09:22AM +0800]:
Quoted 8 lines · Nico Schottelius
Quoted 7 lines
Hello!
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
I currently do:
Quoted 7 lines
Quoted 5 lines
- call
reboot(RB_POWER_OFF/RB_AUTOBOOT/RB_HALT_SYSTEM)
-_exit(0)Is this
exit()call wrong? If I doRB_HALT_SYSTEMand_exit(0)after, the kernel panics.What the panic shows?
Quoted 7 lines
To be fully correct:
"Kernel panic - not syncing: Attempted to kill init" (from the last time I tried, 2.6.13.2)
Perhaps
_exit(0)is not correct for an init system? This at least explains why it always looks like nothing is synced.
Right. init(8) should not call _exit() or exit(). Otherwise you'll get that panic. It's OK for *another* process, reboot(8) to call reboot(2) and then exit(). You should follow this way.
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/
Coywolf Qi Hunt [Tue, Oct 04, 2005 at 04:12:40PM +0800]:
Quoted 23 lines · Nico Schottelius
Quoted 22 lines
Coywolf Qi Hunt [Sun, Jul 10, 2005 at 01:09:22AM +0800]:
Quoted 8 lines · Nico Schottelius
Quoted 7 lines
Hello!
What's the 'correct behaviour' of an init system, if someone wants to shutdown the system?
I currently do:
Quoted 7 lines
Quoted 5 lines
- call
reboot(RB_POWER_OFF/RB_AUTOBOOT/RB_HALT_SYSTEM)
-_exit(0)Is this
exit()call wrong? If I doRB_HALT_SYSTEMand_exit(0)after, the kernel panics.What the panic shows?
To be fully correct:
"Kernel panic - not syncing: Attempted to kill init" (from the last time I tried, 2.6.13.2)
Quoted 6 lines
Quoted 2 lines
Perhaps
_exit(0)is not correct for an init system? This at least explains why it always looks like nothing is synced.Right. init(8) should not call
_exit()orexit(). Otherwise you'll get that panic. It's OK for *another* process, reboot(8) to call reboot(2) and thenexit(). You should follow this way.
Ok, as far as I understood my init simply returns to its normal state and hopes that the kernel halts|reboots|powers off.
Will do that' thanks for the info.
Nico
Signature · 2 lines
Latest project: cconfig (http://nico.schotteli.us/papers/linux/cconfig/) Open Source nutures open minds and free, creative developers.