[BusyBox] init(tab) trouble

Matt Kraai kraai at alumni.cmu.edu
Fri Jan 11 14:09:03 UTC 2002


On Fri, Jan 11, 2002 at 09:40:37AM -0800, Geoffrey Espin wrote:
> I'm using Busybox 60.2 with ash and inittab
> 
>     ::sysinit:/etc/init.d/rcS
>     ::respawn:-/bin/sh
>     tty2::askfirst:-/bin/sh
>     # Stuff to do before rebooting
>     ::ctrlaltdel:/sbin/reboot
>     ::shutdown:/sbin/ifconfig eth0 down
>     ::shutdown:/bin/umounot -a -r
>     #::shutdown:/sbin/swapoff -a
> 
> My /etc/rcS runs thru /etc/init.d/*, where "/etc/init.d/S05web.sh" contains:
> 
>     #!/bin/sh
>     THTTPD=/usr/local/sbin/thttpd_wrapper
>     if [ -x ${THTTPD} ] ; then
> 	${THTTPD} &
> 	echo -n " thttpd"
>     fi
> 
> And thttpd_wrapper contains:
> 
>     #!/bin/sh
>     while true ; do
> 	/usr/local/sbin/thttpd -D -C /etc/thttpd.conf
> 	echo "$0: thttpd exited... restarting..."
> 	sleep 5
>     done
> 
> 
> The very last thing my rcS does is a "ps aux" and the web server and
> wrapper is running.  However, when my ash shell prompt appears,
> I do a "ps" and those two jobs are long gone!
> 
> Before:
> 
>     ...
>     Finished /etc/init.d/S05web.sh .
>     ...
>     Finished /etc/init.d/S06misc.sh .
>       PID  Uid     Stat Command
> 	1 root     S    init  
> 	2 root     S    [keventd]
> 	3 root     S    [ksoftirqd_CPU0]
> 	4 root     S    [kswapd]       
> 	5 root     S    [bdflush]     
> 	6 root     S    [kupdated]   
> 	7 root     S    [mtdblockd] 
> 	8 root     S    [khubd]    
>       205 root     S    /bin/sh /etc/init.d/rcS
>       399 root     S    [jffs2_gcd_mtd2]      
>       425 root     S    [rpciod]             
>       427 root     S    syslogd             
>       441 root     S    /bin/sh /usr/local/sbin/thttpd_wrapper
>       450 root     D    /usr/local/sbin/thttpd -D -C /etc/thttpd.conf
>       459 root     R    ps aux
>     Finished /etc/init.d/rcS .   
> 
>     BusyBox v0.60.2 (2001.12.31-17:15+0000) Built-in shell (ash)
>     Enter 'help' for a list of built-in commands.
> 
>     Fri Jan 11 08:45:54 PST 2002
> 
>     # ps aux
>       PID  Uid     Stat Command
> 	1 root     S    init  
> 	2 root     S    [keventd]
> 	3 root     R    [ksoftirqd_CPU0]
> 	4 root     S    [kswapd]       
> 	5 root     S    [bdflush]     
> 	6 root     S    [kupdated]   
> 	7 root     S    [mtdblockd] 
> 	8 root     S    [khubd]    
>       399 root     S    [jffs2_gcd_mtd2]
>       425 root     S    [rpciod]       
>       427 root     S    syslogd       
>       462 root     S    -sh          
>       467 root     R    ps aux     
>     #
> 
> Some elementary Unix thing I'm sure I've missed in my 20 years...  :-(

BusyBox init does not detach from the console before running rcS.
As a result, when rcS terminates, any processes which are still
running and have not detached themselves will receive a SIGHUP.
This will likely cause them to terminate.

BusyBox init should emulate sysvinit, which detaches before
running rcS.  I haven't seen a patch to this effect, however.

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20020111/627e7bcb/attachment.pgp 


More information about the busybox mailing list