3

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?

4 Answers 4

7

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.

1
  • 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). Feb 20, 2010 at 21:54
1

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).

2
  • Hmmm...so runlevel 1 is not single-user mode? I was going by en.wikipedia.org/wiki/Runlevel#Solaris Oct 21, 2009 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. Oct 22, 2009 at 0:17
1

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?

-1

from console type

#init 0

than it will go to OK prompt. From there type

OK> boot -s

it will boot up and it will ask for root password to go to maintenance mode.Put the root password. it will go to single user mode.Type who -r to verify.

1
  • 1
    Welcome to Server Fault! It looks like you may have the knowledge to provide a good Answer here, but this is not quite the answer to the original question.
    – HBruijn
    Jul 2, 2015 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .