problem with running "kill -QUIT 1" from init

Aras Vaichas arasv at magtech.com.au
Fri Jan 30 00:05:28 UTC 2009


Denys Vlasenko wrote:
> Can you show me you /etc/inittab
> and describe what you are doing, what do you expect to see
> and what do you see instead?
>
> I have qemy image and can try to reproduce it, as soon
> as I will know what to do.
>
> Please also specify your busybox version and attach
> busybox .config you used to build the binary.
>   
I'm doing a major version upgrade and I have chosen to reflash the whole 
filing system with a JFFS2 image. For this to happen reliably, I need to 
unmount the root filing system.

The old systems are running busybox version 1.1.0-pre1.

The tutorial at denx.de recommends that I send a "kill -QUIT 1" to tell 
init to call "console::restart:/sbin/init" which will handle the rootfs 
unmount.

Unfortunately, the systems that I need to upgrade do not have a restart 
option in the inittab file.

Old inittab
# /etc/inittab: init(8) configuration.
::sysinit:/etc/init/rcS
::respawn:/bin/busybox getty 115200 ttyS0 ansi
::shutdown:/bin/sync
::shutdown:/bin/umount -a -r

I made a new inittab called inittab.new which has a restart option.

# /etc/inittab: init(8) configuration.
::sysinit:/etc/init/rcS
::respawn:/bin/busybox getty 115200 ttyS0 ansi
::shutdown:/bin/sync
console::restart:/sbin/init


My upgrade script is in two parts. The first part is called by 
/etc/init/rcS. The second part resides in a temporary rootfs, and it is 
called by the restart option.

----- First script -----

#!/bin/sh

# install new inittab
cp inittab.new /etc/inittab

# instruct init to reload the new inittab
kill -1 1

# rootfs stuff happens here, copy over static busybox, create links to 
it, cd to temporary directory
... SNIP ...

# create a link from /sbin/init to our part2 installer
ln -s ../install_part2 init

# move the old root out of the way
./bin/pivot_root . oldroot

# this will signal init to call our second script
./bin/chroot . kill -QUIT 1

# wait until the flash is done, second script will reboot for us
sleep 3600

------ second script -----
#!/bin/sh
echo ----- restart watchdog
watchdog -t 2 /dev/watchdog

echo ----- unmount everything
umount /oldroot/proc/bus/usb
umount /oldroot/proc
umount /oldroot/sys
umount /oldroot/dev/pts
umount /oldroot/var
umount /oldroot/dev
umount /oldroot

echo ----- update the nand flash
./flash_eraseall.static -j /dev/mtd5
./nandwrite.static -p /dev/mtd5 magtech.jffs2.img

echo ---- finished
reboot -f -n

------ end --------

What I expected to happen was that the "./bin/chroot . kill -QUIT 1" 
would cause the restart in the *new* inittab to be called.

I eventually realised that the new inittab was not being reloaded when I 
called "kill -1 1" from within /etc/init/rcS.

I repeated this test with my current Busybox v1.12.3, and it won't 
dynamically reload a new inittab either (kill -1 1 from within 
/etc/init/rcS).

My current solution is to install the new inittab, reboot, and then 
continue with the install . Can I do better?

Aras



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: .config
Url: http://lists.busybox.net/pipermail/busybox/attachments/20090130/ed176bd7/attachment-0001.diff 


More information about the busybox mailing list