Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
    
Really nice answer @ceri -- if you could add hyperlinks to the relevant documentation on docs.sun.com, that would be extra-special helpful. The correct documentation is always so hard to find (though hopefully Oracle's redesign of the site will help). –  David Citron Feb 20 '10 at 21:54

I believe 'init 1' would not set a system into single user mode.....you'd have to use

init s

instead.

If that edit is made to your statement, then there is a lot of difference. The reboot command, will basically take the system all the way down and then start it from ground zero into single user mode.

A simple init X will only run the scripts to transition a system into the requested state X. The selection of startup/shutdown scripting differs between UNIX type systems and Linux type systems. A reboot does not happen (exceptions for transitions to states 0 and 6, of course).

share|improve this answer
    
Hmmm...so runlevel 1 is not single-user mode? I was going by en.wikipedia.org/wiki/Runlevel#Solaris –  David Citron Oct 21 '09 at 22:43
    
If we are talking about Solaris 10 or OpenSolaris, then there is a whole system managed by the svcadm command that makes sure services/daemons are running, and handles startup, and shutdown. If you use the reboot command, it knows about the whole svcadm structure which init does not know about. Also, Solaris 10 and OpenSolaris can be rebooted without actually rebooting the system by making use of zones. You shouldn't need single user mode except for disaster recovery, munged hard drives etc. –  Michael Dillon Oct 22 '09 at 0:17

reboot will restart the kernel. init should take the machine to single user mode, killing processes as it goes to arrive at single user mode without restarting the kernel.

On my handy solaris box, the man page for /usr/sbin/reboot gives possible parameters of d l n or q , which reboot that takes 's' is in your path first?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.