shutdown busybox and start another PID1 process

Harald Becker ralda at gmx.de
Mon Aug 11 17:35:42 UTC 2014


Hi James,

I looked a bit in what you are doing (if I understand it right) and 
suggest the following (doing something similar on some of my systems):


Startup your system from initramfs and setup required root file system

do switch_root starting /bin/busybox init on your root file system

with inittab containing (among others):

::shutdown:SHUTDOWN_ACTION
::restart:/bin/busybox sh YOUR_SHUTDOWN_SCRIPT

when done with your system, send PID #1 the SIGQUIT signal

this shall do all shutdown actions from your inittab and then exec in 
shell with your given shutdown script (shell running as pid #1).

reload a busybox system into your original root file system (has bean 
cleared by switch_root to save space) e.g. from a cpio archiv (better 
than tar).

pivot_root to your original root system

unmount your stacked file systems

do whatever backup you need (e.g. copy from tmpfs to persistent storage)

poweroff/reboot your system



Did I get it right?

--
Harald



More information about the busybox mailing list