diskless initialization before mountall

Alex Aminoff aminoff at nber.org
Wed Apr 13 14:26:06 UTC 2011


Thank you very much for writing the Upstart cookbook. It would have taken 
me 10x as long to figure out all that information from scattered man pages 
and other references.

We have a diskless setup that we have used for several years for FreeBSD 
and Fedora. I need to port this system to Ubuntu. I have ubuntu booting 
diskless off the NFS server.

The hard part now is to have it run our cross-platform diskless 
initialization script, which is derived from FreeBSD's rc.initdiskless. 
This script sets up in-memory file systems for /etc, /var, and others, 
then copies in appropriate contents. There is a lot of logic for 
configuring individual diskless-booted machines to do particular things, 
so this system also provides configuration management sort of like 
cfengine or similar, especially by building the contents of /etc.

Things just aren't working right. I'm concerned that upstart is reading 
/etc/init/*.conf in parallel with my script replacing /etc with an empty 
in-memory fs and then copying in the contents. In FreeBSD and Fedora it 
was pretty easy to ensure that our script got run before everything else: 
the boot process was basically sequential. However, upstart wants to do 
things in parallel.

I have it working now with a diskless.conf like this:

  start on starting mountall

  console output
  env INIT_VERBOSE

  task

  script
   . /etc/rc.initdiskless
  end script

My questions are:

- How can I get my script to run before anything else that wants to look 
up config in /etc? In particular, what if some script running in parallel 
wants to look up a uid with getent, but there is no /etc/nsswitch.conf? 
What if I want my script to copy per-machine configuration into /etc/init? 
Does upstart read all its config from /etc/init right at the beginning 
such that copied-in changes will not matter?

  - For debugging purposes, I would like to delay the start of plymouth 
until after my stuff is done, so I can see console output. At this point I 
have disabled plymouth with plymouth.override, but I don't think that is 
right. Do I change plymouth to "start on (starting mountall and started 
diskless)" ?

  - The --verbose flag to init is great and produces wonderful debugging 
output. Unfortunately, it scrolls off the top of the screen before I can 
see much of what I want. Is there a way to have that sent to a log file? 
At one point I thought I saw a boot.log with upstart info in it, but not 
anymore. Note that I mount an in-memory fs on /var during rc.initdiskless, 
so upstart would have to re-open its log file if it opened it earlier.

Thank you kindly for any help and advice. If there is a different place I 
should ask please let me know. I posted some of this in the ubuntu forums:

  http://ubuntuforums.org/showthread.php?p=10672011

   - Alex Aminoff
     BaseSpace.net
     National Bureau of Economic Research (nber.org)

P.S. I just had a brainstorm. Would it be totally crazy to mv sbin/init to 
sbin/init.real and then have a small shell script that calls 
rc.initdiskless then runs init?







More information about the upstart-devel mailing list