[buug] different runlevel with a headless box

Michael Paoli Michael.Paoli at cal.berkeley.edu
Sun Oct 21 10:59:00 PDT 2007

Quoting Ian Zimmerman <itz at madbat.mine.nu>:

> Can anyone think of a way to do this?  I don't mean "how to create a
> runlevel to make a box headless", rather how to have two different
> runlevels on a box that is already headless and choose between them when
> booting.  I am thinking along the lines of attaching some sort of dongle
> (USB pen drive maybe), but how to make grub (or later init) react to
> that?

There may be better ways, but perhaps:

* default to "headless" runlevel
* as part of "headless" runlevel initialization, check for a console
  keyboard (e.g. USB keyboard or PS/2 or AT type keyboard) - if one is
  found, change to the non-headless runlevel (this can presumably be
  checked via an rc script)
* it may even be useful for USB hotplug detection of keyboard (keyboard
  present vs. not present) to automagically switch the run levels, if
  that's desired.

Another possible approach:
* use initrd, do enough initialization to determine if console keyboard is
  present or not, go to the appropriate runlevel based upon that.  Such an
  approach may have advantages of making the run level determination earlier
  in the boot sequence (e.g. before running all the rc proper stuff).

Approaches may also depend on what one wants to use for determining
"headless" or not.  If it's got a monitor (e.g. VGA display device)
but no keyboard, or keyboard, but no display device, does one want to
consider those cases "headless", or not?  I'd think keyboard detection
would typically be easier (there may even be a way to hook into that
from BIOS determination), but with not-so-ancient PnP monitors and
graphic cards, determining if a monitor is present or not might also
be rather feasible.

More information about the buug mailing list