Solaris: reboot vs init to get to single-user mode

initsolaris

I have inherited instructions that say to get to single-user mode on Solaris like:

  1. Execute reboot -- -s
  2. Mount all file systems

My question is, why not just do:

  1. init 1

What's the difference?

Best Answer

David, run-levels 1 and s are equivalent. The main difference between these two commands is that reboot will reset the system, bringing it up in as clean a state as possible, while "init s" will just go down to single user without resetting the system - this is possibly quicker, but potentially may leave "cruft" around (any processes lacking an utmpx entry may not get shut down, etc.).

There are some minor differences in that "init s" will not have had any boot or bootwait entries in /etc/inittab run, but that's somewhat unlikely.

Michael, you're incorrect that init doesn't understand SMF (the svcadm stuff); it does.

xenny, the key to the -s flag is the "--" immediately following the reboot command. This indicates that anything following "--" should get passed directly to the boot loader and kernel - see the boot_arguments section in the reboot manpage.