Re: Updating the root partition

Russ Dill
2002-06-20T01:48:14Z

On Wed, 2002-06-19 at 16:56, Christopher Fowler wrote:
> In a way. On my system you have to restart to run on the new software.
> I have implemented a pseudo single user mode in init that will umount
> the rootfs and then dump the new software into memory. Ths keeps you
> from having to do a restart. However, this is not possible from remote
> locations. You must be on serial console to do this. That is why
> single user mode is not acceptable.

I think you are a little confused on what is going on here, so I'll
explain in detail.

on my system, when it is normally up and running, an ftpd daemon is
running

when the ftpd daemon receives an upload, it verifies the integrity, and
saves it in /var

The ftpd daemon then sends a HUP signal to init

because inittab contains the line: ::restart:/linuxex, init kills all
running processes and exec's /linuxex

linuxex now runs, and is the only running process on the system, linuxex
is a shell script:

/bin/umount /tmp
/bin/umount /etc
/bin/umount /proc
/bin/cp /usr/sbin/flash /var
/bin/cp -a /dev/nftla /var/out
/bin/cp -a /dev/ttyS0 /var
cd /var
/bin/ln -s flash chroot
/bin/mkdir old
echo pivot root to var...
pivot_root . old
exec ./chroot . ./flash

so now flash is the only program running, and its statiacally linked, so
there are no more references to the cramfs root, and it can be umounted
by flash. flash ten proceeds to flash the image, and reset the machine.

------

so as you can see, there is no pseudo single user mode required, and the
flash image is received while the system is up and fully operational. As
soon as the image is received and verified, the system basically goes
down for a reboot, during which the new image is flashed.