You are on page 1of 18

Solaris 10 Service

.(Management Facility (SMF

Oz Melamed
E&M Computing
Nov 2007
Introduction to SMF

SMF provides an infrastructure that


augments the traditional UNIX start-up
scripts, init run levels, and configuration files.
SMF provides the following functions:
Automatically restarts failed services in
dependency order, whether they failed as the
result of administrator error, software bug, or were
affected by an uncorrectable hardware error.
The dependency order is defined by dependency
statements.
Makes services objects that can be viewed, with
the new svcs command, and managed, with
svcadm and svccfg commands.

2
SMF functions
Makes it easy to backup, restore, and undo
changes to services by taking automatic snapshots
of service configurations.
Makes it easy to debug and ask questions about
services by providing an explanation of why a
service isn't running by using svcs -x.
Boots faster on large systems by starting services
in parallel according to the dependencies of the
services.
Allows you to customize the boot console output to
either be as quiet as possible, which is the default,
or to be verbose by using boot -m verbose.
Preserves compatibility with existing administrative
practices wherever possible.

3
SMF Actions

SMF defines a set of actions that can be


invoked on a service by an administrator.
These actions include enable, disable,
refresh, restart, and maintain.
Each service is managed by a service
restarter which carries out the administrative
actions.

4
Changes in Behavior When Using SMF

The boot process creates many fewer


messages now.
Services do not display a message by default
when they are started.
All of the information that was provided by the
boot messages can now be found in a log file
for each service that is in /var/svc/log.
In addition, you can use the -v option to the
boot command, which generates a message
when each service is started during the boot
process.

5
Changes in Behavior When Using SMF

Many of the scripts in /etc/init.d and /etc/rc*.d


have been removed.
The scripts are no longer needed to enable or
disable a service.
Entries from /etc/inittab have also been
removed, so that the services can be
administered using SMF.

6
SMF Concepts
The fundamental unit of administration in the
SMF framework is the service instance.
An instance is a specific configuration of a
service.
A web server is a service.
A specific web server daemon that is
configured to listen on port 80 is an instance.
A milestone is a special type of service
Milestone services represent high-level
attributes of the system.
For example, the services which constitute
run levels S, 2, and 3 are each represented
by milestone services.

7
Service Identifiers

Each service instance is named with a Fault


Management Resource Identifier or FMRI.
The FMRI includes the service name and the
instance name.
For example, the FMRI for the rlogin service
is svc:/network/login:rlogin, where
network/login identifies the service and rlogin
identifies the service instance.
Equivalent formats for an FMRI are as
follows:
svc://localhost/system/system-log:default

8
Service States
The svcs command displays the state, start time,
and FMRI of service instances. The state of each
service is one of the following:
degraded – The service instance is enabled, but is
running at a limited capacity.
disabled – The service instance is not enabled and is
not running.
legacy_run – The legacy service is not managed by
SMF, but the service can be observed.
maintenance – The service instance has encountered
an error that must be resolved by the administrator.
offline – The service instance is enabled, but the service
is not yet running or available to run.
online – The service instance is enabled and has
successfully started.
uninitialized – This state is the initial state for all services
9
before their configuration has been read.
Run Level & SMF Milestone

Run Level & SMF Milestone


Run Level S milestone/single-user:default
Run Level 2 milestone/multi-user:default
Run Level 3 milestone/multi-user-server:default

10
Monitoring SMF Services
List the Status of a Service :
% svcs -l FMRI
% svcs -l network/login:rlogin
fmri svc:/network/login:rlogin
enabled true
state online
next_state none
restarter svc:/network/inetd:/default
Showing the Status of all Services :
% svcs –a
Display the service dependencies :
% svcs -d FMRI

11
Managing SMF Services

Disable the service :


svcadm disable FMRI
svcadm disable network/login:rlogin
Enable a service :
svcadm enable FMRI
svcadm enable network/login:rlogin
Restart a service :
svcadm restart FMRI

12
Troubleshooting the Service
Management Facility
Request information about the hung service.
svcs –x

Enable the service.


–# svcadm enable application/print/server

13
Boot Without Starting Any Services

If problems with starting services occur,


sometimes a system will hang during the
boot.
This command instructs the svc.startd
daemon to temporarily disable all services
and start sulogin on the console.
ok boot -m milestone=none
Login as root
# svcadm milestone all
# svcs -x

14
Example
tricks console login: root
:Password
Last login: Thu Nov 15 16:53:20 on console
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
tricks:/ ROOT > who -r
run-level 3 Nov 15 16:55 3 0 S .
tricks:/ ROOT > svcs |grep mile
online 16:55:33 svc:/milestone/name-services:default
online 16:55:42 svc:/milestone/network:default
online 16:55:52 svc:/milestone/devices:default
online 16:55:55 svc:/milestone/single-user:default
online 16:55:58 svc:/milestone/sysconfig:default
offline 16:55:31 svc:/milestone/multi-user:default
offline 16:55:33 svc:/milestone/multi-user-server:default

15
Troubleshooting
tricks:/ ROOT > svcs | grep maint
maintenance 16:55:58 svc:/system/filesystem/local:default
tricks:/ ROOT > svcs -xv /system/filesystem/local | more
(svc:/system/filesystem/local:default (local file system mounts
State: maintenance since Thu Nov 15 16:55:58 2007
.Reason: Start method exited with $SMF_EXIT_ERR_FATAL
See: http://sun.com/msg/SMF-8000-KS
See: /var/svc/log/system-filesystem-local:default.log
Impact: 31 dependent services are not running
tricks:/ ROOT > tail /var/svc/log/system-filesystem-local:default.lo
[ .Nov 15 16:51:13 Stopping because service disabled ]
[ (Nov 15 16:51:13 Executing stop method (null ]
[ ("Nov 15 16:55:55 Executing start method ("/lib/svc/method/fs-local ]
dev/rdsk/c0t0d0s5: I/O error/
mount: I/O error
mount: Cannot mount /dev/dsk/c0t0d0s5
WARNING: /sbin/mountall -l failed: exit status 1
16
Clear Fault
tricks:/ ROOT > svcadm clear /system/filesystem/local
tricks:/ ROOT > svcs | grep mile
online 16:55:33 svc:/milestone/name-services:default
online 16:55:42 svc:/milestone/network:default
online 16:55:52 svc:/milestone/devices:default
online 16:55:55 svc:/milestone/single-user:default
online 16:55:58 svc:/milestone/sysconfig:default
online 17:03:32 svc:/milestone/multi-user:default
online 17:03:34 svc:/milestone/multi-user-server:default

17
Q&A

18

You might also like