[Soekris] rc.shutdown hangs when /dev is mfs

David Kelly dkelly at WarningSystems.com
Mon Apr 21 15:26:54 UTC 2003


On a net4501 running a cut down version of FreeBSD 4.8 I have found 
when I use memory backed filesystems for /dev, /tmp, and /var, on 
shutdown init times out executing
/etc/rc.shutdown.

During shutdown I don't believe the output on the serial console is in 
sync with actual events.

Experimenting, learned I need a rudimentary /dev/ for the kernel to 
boot far enough to execute rc.diskless[12] to create the mfs 
filesystems /dev, /var, and /tmp.

Am suspecting on boot init opens a device in the read-only CF /dev, 
upon which an mfs /dev is later mounted on top of. And that somehow the 
two are getting confused?

/etc/rc.shutdown is optional, according to the source of init. Renaming 
the file demonstrates the truth, and eliminates the timeout from init 
on shutdown. I have been moving an "exit 0" down this file from the top 
and have not been able to make any sense of where the hang occurs as 
there is no hang if exit is one of the first statements executed. Seems 
to depend on how much data is written to the console.

I don't understand the nuances of the environment rc.shutdown runs in. 
The first executable line is "stty status ^T" which seems like a no-op. 
But if I remove it I get no running dialog output from the script.

On shutdown, console output from rc.shutdown appears to be much 
delayed. The bulk of the data isn't written until after the 2 minute 
timeout by init.

The system has apache2 and the aureal-kmod port installed. These are 
the only ports whose startup scripts are run at shutdown.

By sprinkling "fsync /dev/console" lines in the /etc/rc.shutdown 
script, my problem seems to be resolved. Something is blocking until 
the output buffers are flushed, but nothing is forcing the flush? Seems 
like the final echo should flush the line buffered output.

Am still playing with it, suspect one fsync just prior to exit may do 
the job.

Any one else see this before?





More information about the Soekris-tech mailing list