How to reboot from start scripts?

Josef Wolf jw at raven.inka.de
Tue Oct 9 11:32:09 UTC 2007


On Mon, Oct 08, 2007 at 11:54:13PM +0100, Steve Flynn wrote:
> On 08/10/2007, Josef Wolf <jw at raven.inka.de> wrote:
> > So there is really no way to properly shutdown/reboot from single-user
> > mode?
> Does "reboot -n" not do what you'd expect it to do?

No, it don't.  I listed all the ways I tried at the beginning of the thread:

  - shutdown -r now
  - init 6
  - reboot
  - halt
  - ctrl-alt-del
  - CTRL-D

_none_ of them reboots the system.  They all just continue the boot
process on a half-mounted system.  All of them (except CTRL-D) just leave
the single-user-shell running.  The result is that the single-user-shell
races with getty/login for input from /dev/tty1.

> If I recall correctly from many moons ago, you don't want to perform a sync
> when you've just fsck'd the root filesystem as it would rewrite the bad
> superblocks stored in the kernel buffers undoing any work fsck may have just
> performed. In these circumstances you'd use "reboot" (or pass a flag to
> shutdown) to bypass the sync.

I don't see how (not) syncing would affect the behavior I mentioned above.
It is clear that one should _never_ continue the boot process with a broken
filesystem.  But the question is: _How_ do I reboot without continuing the
boot process?

> This was on SunOS and BSD based systems and
> was in a different century however so my memory is a little flaky.

Yes,  And I remember that it worked properly for SCO Unix, HP-UX and SunOS
in the mid-90s.  My point is that it _don't_ work on ubuntu for whatever
reason.

To simulate the problem, just put "rootfatal=yes" at the beginning of
/etc/init.d/checkroot.sh.  But make sure you keep a copy of the original
file so you can fix it after the test.  You will be thrown into the
single-user-shell.  And from that, there's no way to properly reboot the
system.




More information about the ubuntu-users mailing list