Solaris Admin Series, part 11. Previous: Solaris Process Management: ps -ef, pgrep, pkill, kill Signals and nohup. Related: part 9, Solaris Text Editors on a Bare System (for fixing files in single-user mode). Next up: setting the hostname, time zone, locale and keyboard.
Taking a Solaris box down, bringing it back, or dropping it to single-user for maintenance sounds trivial until someone types init 5 expecting a graphical login and powers off a production server, or runs shutdown without -i and wonders why the machine is sitting in single-user mode. Solaris kept the System V init states, layered SMF milestones on top of them, and offers four different ways to stop a system that are not equivalent. This post covers what each init state means, how it maps to SMF milestones, and when to use shutdown, init, reboot, halt and poweroff.
Applies to: both Solaris 10 and Solaris 11 (11.4), SPARC and x86. Both releases use SMF, so the run-level model and the commands are the same. Differences called out below: on Solaris 11 root is a role, so you run these commands after su - or with pfexec/sudo; Solaris 11 x86 uses Fast Reboot by default (skipping the BIOS/UEFI) while Solaris 10 and SPARC do a full firmware reset unless you ask otherwise; the single-user login prompt wording changed; and Solaris 11 adds zoneadm shutdown for zones.
Prerequisites
- Root, the root role, or a rights profile that lets you run
/usr/sbin/shutdown,/usr/sbin/initand/usr/sbin/reboot. - Console access (serial console, ILOM/ALOM/XSCF remote console, or a physical screen) for anything that goes to init 0, S or 1. SSH sessions die as soon as networking stops, so you will not see the
okprompt or the single-user login over SSH. - Knowledge of what runs on the box. Databases, clusters and applications should be stopped with their own tools first, or at least verified to stop cleanly under SMF.
The Solaris init states
Solaris defines eight init states. The important difference from Linux is in the last three rows:
| State | Name | What it means on Solaris |
|---|---|---|
0 | Power-down / firmware state | Stops all services and the OS. On SPARC you land at the OpenBoot ok prompt; on x86 you get “Press any key to reboot” and it is safe to switch off. |
S or s | Single-user state | Only root can log in, on the console. Minimal file systems mounted. Corresponds to SMF milestone/single-user. |
1 | Administrative state | Single-user administration with all local file systems available; no user logins. Rarely used directly. |
2 | Multiuser state | Normal operations, logins allowed, but NFS server resources not shared. Corresponds to milestone/multi-user. |
3 | Multiuser with NFS (default) | Everything running, including NFS sharing. The default. Corresponds to milestone/multi-user-server. |
4 | Alternative multiuser | Not configured by default; available for site use. |
5 | Power-down | Shuts down and turns the power off if the hardware supports it. Not a graphical run level. |
6 | Reboot | Shuts down to state 0 and boots back to the default milestone. |
Linux admins: Solaris has no “GUI run level”. The desktop login on Solaris is just another SMF service (svc:/application/graphical-login/gdm:default on Solaris 11, cde-login or gdm2-login on Solaris 10), enabled or disabled with svcadm. init 5 turns the machine off.
Step 1: Check the current run level and milestone
who -r still reports the classic run level. The last three fields are the current state, the number of times it has been entered since boot, and the previous state:
$ who -r
. run-level 3 Nov 3 10:12 3 0 S
On both releases, SMF milestones are what actually define the state. Check them with svcs:
$ svcs milestone/\*
STATE STIME FMRI
online Nov_03 svc:/milestone/unconfig:default
online Nov_03 svc:/milestone/config:default
online Nov_03 svc:/milestone/devices:default
online Nov_03 svc:/milestone/network:default
online Nov_03 svc:/milestone/single-user:default
online Nov_03 svc:/milestone/name-services:default
online Nov_03 svc:/milestone/self-assembly-complete:default
online Nov_03 svc:/milestone/multi-user:default
online Nov_03 svc:/milestone/multi-user-server:default
The exact list differs: unconfig, config and self-assembly-complete exist only on Solaris 11; Solaris 10 shows devices, network, single-user, name-services, sysconfig, multi-user and multi-user-server.
| Run level | SMF milestone |
|---|---|
S | svc:/milestone/single-user:default |
2 | svc:/milestone/multi-user:default |
3 | svc:/milestone/multi-user-server:default |
| (none) | none: only svc.startd, no services; used for deep recovery |
| (none) | all: every enabled service, the out-of-the-box default |
Step 2: Check and change the default boot milestone
On SMF systems you change the default “run level” with svcadm milestone -d, not by editing /etc/inittab. Solaris 10 still ships an is:3:initdefault: line in /etc/inittab, but Oracle documents svcadm milestone -d as the supported way to set the default, and on Solaris 11 the inittab file only starts svc.startd and handles power-fail events. Do not edit it.
# svcprop -p options/milestone svc:/system/svc/restarter:default
svc:/milestone/all
# svcadm milestone -d milestone/multi-user:default # boot to run level 2 by default
# svcprop -p options/milestone svc:/system/svc/restarter:default
svc:/milestone/multi-user:default
# svcadm milestone -d all # back to the normal default
If the property does not exist, svcprop prints an error and the default is all. Changing the default takes effect at the next boot. To move the running system to a milestone right now, drop the -d:
# svcadm milestone milestone/single-user:default # stop everything above single-user
# svcadm milestone all # bring everything back
This is what init S and init 3 do under the covers, so pick whichever you find clearer. Run it from the console, not over SSH.
Step 3: Choose the right shutdown command
| Command | Warns users | Grace period | Stops services cleanly | Default target |
|---|---|---|---|---|
shutdown -y -g N -i X | Yes, via wall messages at intervals | Yes (default 60 s) | Yes (SMF and rc kill scripts) | S if -i is omitted |
init X | No | No | Yes (SMF and rc kill scripts) | State given |
reboot, halt, poweroff | No | No | No: syncs disks and resets, no rc kill scripts | Reboot / state 0 / power off |
uadmin | No | No | No: direct kernel call | Used by scripts and support |
Rule of thumb: use shutdown on a multiuser server with logged-in users, init when you are alone on the box and want a clean stop with no wait, and keep reboot/halt for systems already quiesced or when a normal shutdown hangs.
shutdown: the polite way
Syntax is the same on both releases: /usr/sbin/shutdown [-y] [-g grace-period] [-i init-state] [message].
# cd /
# shutdown -y -g 300 -i 6 "Kernel patching: back in about 15 minutes"
Shutdown started. Mon Nov 9 14:20:00 CST 2026
Broadcast Message from root (pts/1) on sol11a Mon Nov 9 14:20:00...
The system sol11a will be shut down in 5 minutes
Kernel patching: back in about 15 minutes
...
Changing to init state 6 - please wait
-yanswers the “Do you want to continue? (y or n)” question so it can run unattended.-gis the grace period in seconds;-g 0starts immediately.-iis the target state:0to firmware,5power off,6reboot,Sor1for maintenance.- Run it from
/(or any local directory), not from an NFS-mounted or soon-to-be-unmounted directory. - Solaris
shutdownhas no Linux-style-r,-hornow.shutdown -r nowis rejected, or “now” is taken as the message; useshutdown -y -g0 -i6.
Common one-liners:
# shutdown -y -g0 -i6 # reboot now, cleanly
# shutdown -y -g0 -i5 # power off now
# shutdown -y -g0 -i0 # to the ok prompt (SPARC) / "press any key" (x86)
# shutdown -y -g0 -iS # single-user for maintenance (from the console)
init: clean, immediate, silent
# init 6 # reboot
# init 0 # firmware / ok prompt
# init 5 # power off
# init S # single-user
# init 3 # back to full multiuser
init goes through the same orderly shutdown as shutdown (SMF stops services in dependency order, legacy /etc/rc*.d/K* scripts run) but gives users no warning and no grace period.
reboot, halt and poweroff: fast, not orderly
# reboot # sync and reboot, no rc kill scripts
# reboot -- -s # pass boot arguments: here, boot single-user
# reboot -- -rv # SPARC: reconfiguration boot, verbose
# halt # sync and go to the ok prompt / stop
# poweroff # sync and power off
# reboot -d # force a crash dump, then reboot (hung-system diagnosis)
These commands flush file system buffers and restart the kernel, but they do not run the rc kill scripts and do not give applications the usual orderly stop. On a box running a database, prefer shutdown or init. The -- separates reboot options from the boot arguments that are passed on to the boot loader.
Fast Reboot (mostly Solaris 11 x86)
On Solaris 11 x86, reboot and init 6 use Fast Reboot by default: the kernel loads the new kernel directly and skips the BIOS/UEFI and GRUB menu, saving minutes on big servers. Solaris 10 x86 (later updates) supports it with reboot -f but does not make it the default. On SPARC, Fast Reboot is supported on many sun4v systems with Solaris 11 but is off by default.
# svccfg -s svc:/system/boot-config:default listprop config/fastreboot_default
config/fastreboot_default boolean true
# reboot -p # x86: force a full firmware reboot this once
# reboot -f # force a Fast Reboot this once
# svccfg -s boot-config:default setprop config/fastreboot_default=false
# svcadm refresh svc:/system/boot-config:default
Use reboot -p (or turn the default off) when you need the firmware to run, for example after a BIOS change, a firmware update, or to reach the GRUB menu.
Step 4: Single-user and maintenance mode
You can go to single-user from a running system with shutdown -y -g0 -iS or init S, or boot straight into it:
ok boot -s # SPARC, from OpenBoot
ok boot -m milestone=none # SPARC, nothing but svc.startd (deep recovery)
ok boot -m verbose # SPARC, print each service as it starts
# x86: at the GRUB menu press e, add -s to the end of the kernel line
# ($multiboot on Solaris 11, kernel$ on Solaris 10), then boot it
The console then asks for credentials. Solaris 10 prompts Root password for system maintenance (control-d to bypass):; Solaris 11 prompts Enter user name for system maintenance (control-d to bypass):, where you enter root (or a user with the right authorization) and then the password. Pressing Ctrl-D continues to the default milestone instead.
From milestone=none, bring services up step by step with svcadm milestone milestone/single-user:default, then svcadm milestone all when you are done. If the root file system is mounted read-only, remount it before editing files: mount -o remount,rw / on UFS, or zfs mount -a as needed on ZFS root. See part 9, Solaris Text Editors on a Bare System, for repairing /etc/vfstab and /etc/system with ed.
Step 5: Legacy rc scripts under SMF
Both releases still run old-style /etc/rc0.d, rc1.d, rc2.d, rc3.d and rcS.d scripts. SMF shows them as lrc: entries it cannot manage:
$ svcs | grep lrc
legacy_run Nov_03 lrc:/etc/rc2_d/S89PRESERVE
legacy_run Nov_03 lrc:/etc/rc3_d/S90myapp
S* scripts run with start when entering that run level, and K* scripts run with stop on the way down (rc0.d on shutdown). If a third-party application only ships an rc script, make sure it has a matching K link in /etc/rc0.d (and rc1.d, rcS.d) or it will be killed rather than stopped. Better still, convert it to an SMF manifest; that is covered later in the SMF section of this series.
Step 6: Zones and domains
- Inside a non-global zone,
shutdown,initandrebootaffect only that zone.init 0in a zone halts the zone, not the host. - From the global zone:
zoneadm -z appzone1 rebootandzoneadm -z appzone1 haltwork on both releases, buthaltkills processes without running shutdown scripts. For a clean stop usezlogin appzone1 shutdown -y -g0 -i0on Solaris 10, orzoneadm -z appzone1 shutdown(add-rto reboot) on Solaris 11. - Shutting down the global zone shuts down every running zone first through
svc:/system/zones:default. Its stop timeout can make shutdown look hung while zones stop. - LDoms (SPARC): rebooting the control domain does not stop guest domains, but guests that depend on its virtual disk and network services will stall until it returns. Shut guests down first with
ldm stopor from inside each guest when you take the whole server down. Details come in the LDoms section.
Verification
$ who -r # current run level
$ svcs -x # anything failed or not running that should be
$ svcs -o state,nstate,fmri milestone/\*
$ uptime # confirms the reboot happened
$ last reboot | head -3 # reboot history from /var/adm/wtmpx
$ grep -i "rebooting\|halted" /var/adm/messages | tail
After a reboot, svcs -x printing nothing means every enabled service is online. During boot, svcs -o state,nstate shows services in transition (nstate is the state being moved to).
Troubleshooting and gotchas
init 5is not a GUI. It powers the machine off. On a remote server without ILOM access that means a trip to the data center.shutdownwithout-igoes to single-user. The default state isS, so a plainshutdown -y -g0leaves the box at a single-user console prompt and every SSH session gone.- Run levels S and 1 over SSH. Networking stops and you lose the session; the maintenance prompt appears only on the console. Always have console access first.
- Shutdown “hangs”. Usually a service with a long stop timeout (a database, zones, or an NFS client unmount to a dead server). From another console session,
svcs -o state,nstate,fmri | grep -v onlineshows which service is stopping. As a last resort usereboot -d(x86 or SPARC) to force a crash dump and reboot, or on SPARC send a break (Stop-A or the console break sequence) and typesyncat theokprompt to force a dump. - Daemon came back after you killed it. That is SMF restarting it; see part 10, Solaris Process Management. Use
svcadm disablebefore maintenance, andsvcadm disable -tif it should come back at the next boot. - System stuck at the
okprompt afterinit 6. Check the OpenBoot variableauto-boot?witheeprom auto-boot?(from Solaris) orprintenv auto-boot?(atok). If it isfalse, the system waits for you to typeboot. - x86 never shows the GRUB menu. That is Fast Reboot skipping firmware; use
reboot -p. - “Not privileged” or “must be root”. On Solaris 11 assume the root role (
su -) or usepfexec/sudo; a normal user cannot change init states. - Linux habits.
systemctl,telinitandshutdown -h nowdo not exist or do not behave the same;runleveliswho -r. - Editing
/etc/inittabto change the default. Usesvcadm milestone -d. Changes toinittabcan be overwritten by package updates and, on Solaris 11, are not how the default milestone is chosen.
What’s next in the Solaris Admin Series
Next up is setting the hostname, time zone, locale and keyboard on Solaris 10 and 11 (sysidcfg, sysconfig and svccfg). Catch up with part 10, Solaris Process Management, part 9, Solaris Text Editors on a Bare System, part 3, Solaris Filesystem Layout Tour, and part 2, SPARC vs x86. Booting, OpenBoot and GRUB get their own detailed posts in the boot section of the series.
Official references: init(8), shutdown(8), reboot(8), halt(8), svcadm(8), svcs(1), svc.startd(8), boot(8), inittab(5), who(1) and zoneadm(8) in the Oracle Solaris 11.4 Reference Library, Booting and Shutting Down Oracle Solaris 11.4 Systems in the Oracle Solaris 11.4 documentation, and the same commands (section 1M) plus the System Administration Guide: Basic Administration in the Oracle Solaris 10 1/13 Information Library.
