On Sat, Aug 09, 2014 at 01:02 PM, Rieker Flaik said: > There I can exec busybox its normal init "/sbin/init". This is > what I want to use in this pre-OS, having a nice init system to > spawn all kinds of programs like udhcp and dropbear to do the > backup stuff.
It is actually very easy to get control back from /sbin/init. Replace /sbin/init with the script you want to run. Then run the command: telinit u This tells the init process to shutdown and restart. When it restarts, your script at /sbin/init is what will run. Before you start playing with this, do: sudo ls -l /proc/1/fd and notice that most standard IO is turned off (at least on my systems). If you want PID-1 to be a shell again then you will need to reconnect some IO. Some LiveCD/USB systems use this trick to get PID-1 to run from a small (RAM based) busybox system during shutdown. The great thing about this is it gives you the ability to have shell access throughout the shutdown process even after all non-RAM file systems have been unmounted. IMO this is actually more stable and more robust than the conventional way Linux systems shut down. The major cost is the 1-Meg or so of RAM needed the tmpfs for busybox. I think the Linux distros should migrate to using busybox for the shutdown process even when not running live. Peace, James _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox