17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5986fd29aSsetje# Common Development and Distribution License (the "License").
6986fd29aSsetje# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate
22986fd29aSsetjeCopyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gateUse is subject to license terms.
247c478bd9Sstevel@tonic-gate
257c478bd9Sstevel@tonic-gate/lib/svc/share/README
267c478bd9Sstevel@tonic-gate
27*bbf21555SRichard Lowesmf(7):  Notes on maintenance mode and recovery
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateFailures that bring the system to maintenance mode may include hardware
307c478bd9Sstevel@tonic-gateor critical software failures.  The procedures below are given so that
317c478bd9Sstevel@tonic-gatesome software repairs can be made; the recommended exit approach once a
327c478bd9Sstevel@tonic-gaterepair has been made is to reboot the system.  The system can be brought
33*bbf21555SRichard Loweto maintenance mode deliberately via the '-s' option to boot(8), or via
34*bbf21555SRichard Lowethe 's' option to init(8).
357c478bd9Sstevel@tonic-gate
36*bbf21555SRichard LoweIn failure scenarios, smf(7) may or may not be running, depending on
37*bbf21555SRichard Lowewhich component has failed.  If smf(7) is running, and the /usr
38*bbf21555SRichard Lowefilesystem is reachable, then the usual svcadm(8) invocations to clear
397c478bd9Sstevel@tonic-gatemaintenance state and restart services instances can be used.
407c478bd9Sstevel@tonic-gateOtherwise, the following instructions describe the direct execution of
41*bbf21555SRichard Loweservice methods, so that capabilities that svc.startd(8) would normally
427c478bd9Sstevel@tonic-gatestart automatically can be started manually.  In the case that the
437c478bd9Sstevel@tonic-gatedocument recommends an invocation like
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate# /lib/svc/method/example-method start
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gateyou may also consider running these scripts with the shell displaying
487c478bd9Sstevel@tonic-gatethe commands from the service method as they are executed.  For sh(1)
497c478bd9Sstevel@tonic-gatebased scripts, this would mean running the method as
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate# /sbin/sh -x /lib/svc/method/example-method start
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateSome methods may be written to instead use ksh(1), with invocation
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gate# /usr/bin/ksh -x /lib/svc/method/example-method start
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gateThe first line of the service method script will generally specify its
587c478bd9Sstevel@tonic-gaterequired interpreter using the standard #! notation.  Method scripts may
597c478bd9Sstevel@tonic-gatepotentially require interpreters other than sh(1) or ksh(1).
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate1.  Boot archive failure
627c478bd9Sstevel@tonic-gate
63986fd29aSsetjeThe boot archive may become out of sync with the root filesystem in a
64986fd29aSsetjereboot following an abnormal system shutdown. The recommended action is
65986fd29aSsetjeto reboot immediately to rebuild the archive and correct the inconsistency.
66986fd29aSsetjeTo accomplish this, on a GRUB-based platform, choose "Solaris failsafe"
67986fd29aSsetjewhen the boot menu is displayed.  Type 'i' to get an interactive recovery
68986fd29aSsetjeshell and follow instructions to update the boot archive.  On an OBP-
69986fd29aSsetjebased platform, type 'boot -F failsafe' and follow the instructions.
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gateIf the list of stale files are not yet loaded by the kernel
727c478bd9Sstevel@tonic-gateor are compatible, you may continue booting by clearing the
737c478bd9Sstevel@tonic-gateboot-archive service state
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate# svcadm clear system/boot-archive
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gate2.  Failure to mount filesystems.
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateIn cases where the system was unable to bring a combination of the
807c478bd9Sstevel@tonic-gatesystem/filesystem/{root,usr,minimal} services online, it may be possible
817c478bd9Sstevel@tonic-gateto directly execute the corresponding service methods
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate# /lib/svc/method/fs-root
847c478bd9Sstevel@tonic-gate# /lib/svc/method/fs-usr
857c478bd9Sstevel@tonic-gate# /lib/svc/method/fs-minimal
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gateto mount the various filesystems.  In the case that these methods fail,
88*bbf21555SRichard Lowea direct invocation of mount(8), and potentially fsck(8), should be
897c478bd9Sstevel@tonic-gateattempted for file systems required for recovery purposes.
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate/lib/svc/method/fs-usr attempts to remount the root file system
927c478bd9Sstevel@tonic-gateread-write, such that persistent changes can be made to the system's
937c478bd9Sstevel@tonic-gateconfiguration.  If this method is failing, one can directly remount
94*bbf21555SRichard Loweusing the mount(8) command via
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gate# /sbin/mount -o rw,remount /
977c478bd9Sstevel@tonic-gate
987c478bd9Sstevel@tonic-gate/etc/svc/volatile is a temporary filesystem generally reserved for Sun
997c478bd9Sstevel@tonic-gateprivate use.  It may prove a useful location to create mount points if
1007c478bd9Sstevel@tonic-gatethe root file system cannot be remounted read-write.
1017c478bd9Sstevel@tonic-gate
102*bbf21555SRichard Lowe3.  Failure to run svc.configd(8).
1037c478bd9Sstevel@tonic-gate
104*bbf21555SRichard Lowesvc.configd(8) will give detailed instructions for recovery if the
105*bbf21555SRichard Lowecorruption is detected in the repository.  If svc.configd(8) cannot be
1067c478bd9Sstevel@tonic-gaterun because of missing or corrupt library components, then the affected
1077c478bd9Sstevel@tonic-gatecomponents will need to be replaced.  Components could be copied from a
1087c478bd9Sstevel@tonic-gateCD-ROM or DVD-ROM, or from another system.
1097c478bd9Sstevel@tonic-gate
110*bbf21555SRichard Lowe4.  Failure to run svc.startd(8).
1117c478bd9Sstevel@tonic-gate
112*bbf21555SRichard LoweIf the inittab(5) line to invoke svc.startd(8) is missing or incorrect,
1137c478bd9Sstevel@tonic-gateit will need to be restored.  A valid entry is
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gatesmf::sysinit:/lib/svc/bin/svc.startd    >/dev/msglog 2<>/dev/msglog </dev/console
1167c478bd9Sstevel@tonic-gate
117*bbf21555SRichard LoweIf svc.startd(8) cannot be run because of missing or corrupt library
1187c478bd9Sstevel@tonic-gatecomponents, then the affected components will need to be replaced, as
119*bbf21555SRichard Lowefor svc.configd(8) above.
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate5.  Activating basic networking configuration.
1227c478bd9Sstevel@tonic-gate
123*bbf21555SRichard LoweIf svc.startd(8) did not execute successfully, it may also be necessary
1247c478bd9Sstevel@tonic-gateto activate network interfaces manually, such that other hosts can be
1257c478bd9Sstevel@tonic-gatecontacted.  The service methods can be invoked directly as
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate# /lib/svc/method/net-loopback
1287c478bd9Sstevel@tonic-gate# /lib/svc/method/net-physical
1297c478bd9Sstevel@tonic-gate
130*bbf21555SRichard LoweIf these methods fail, a direct invocation of ifconfig(8) can be
1317c478bd9Sstevel@tonic-gateattempted.
1327c478bd9Sstevel@tonic-gate
133*bbf21555SRichard LoweIn some scenarios, one may be able to use routeadm(8) to activate more
1347c478bd9Sstevel@tonic-gatedynamic route management functionality; restoring the default dynamic
1357c478bd9Sstevel@tonic-gaterouting behaviour can be done using the '-u' option.  (Invoking routeadm
1367c478bd9Sstevel@tonic-gatewith no arguments will display which commands must be accessible for the
1377c478bd9Sstevel@tonic-gatecurrent routing configuration to be invoked.)  Otherwise, once
1387c478bd9Sstevel@tonic-gateinterfaces are up, a default route can be manually added using the
139*bbf21555SRichard Loweroute(8) command.  On typical IPv4 networks, this invocation would be
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate# /sbin/route add net default _gateway_IP_
1427c478bd9Sstevel@tonic-gate
1437c478bd9Sstevel@tonic-gate--
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate(An extended version of this document is available at
146654b400cSJoshua M. Clulowhttp://illumos.org/msg/SMF-8000-QD.  That version includes additional
1477c478bd9Sstevel@tonic-gatedocument references.)
148