Notes on SMF, svcs, svcadm, svccfg

SMF can be a hairy topic. Especially if you hate XML, like I do. So Im starting this page to hold any tips and tricks I come across.

Delete a service

For some reason, sun decided to have 'configuration' completely separate from "administration". So to completely remove a service, "svcadm" cannot do the job. You need "svccfg delete xyz".

Along the same lines,

default, vs :default

Critial trap: you have to be aware of the difference between what you might normally think of as "the default" and the explicit ":default".

This can get confusing, if you are checking for smf "properties", and you query

svcprop get svc:/network/something
but dont see something you expect. In those cases, what you REALLY needed to examine, was
svcprop get svc:/network/something:default
The blank, no-"instance" usage case is often the same as the other. But not ALWAYS. So be careful, especially with blind greps such as
svcprop get svc:/network/something |grep expectedvalue
Always do a test svcprop call first. In really tricky cases, there may be a "something" prop in both the regular, and ":default" smf url, so you need to be aware of both.

Use in a jumpstart or similar environment

Unfortunately, "Sun" did not bother to make any kind of friendly method of administering smf in a jumpstart environment. Almost all tools expect and require that you have svc.configd running. You can only have one active at a time, and it expects to be running in "/", not "/a". So svcadm and svcs become useless for a jumpstart target environment.

That being said, there IS a trick, if you are willing to deal with svccfg.

# SVCCFG_REPOSITORY=/a/etc/svc/repository.db
# export SVCCFG_REPOSITORY
# svccfg [your command here]
This can be good for things such as setting properties, or completely deleting services.

BEWARE, however! The initial jumpstart environment is not always like you expect!

If you are going to be doing a from-scratch "package based" install, a finish script will see only a proto-smf set of properties. Full population will only be done at first boot time :(
The only way to get a relatively complete SMF environment at jumpstart, would seem to be to jumpstart from a flash archive. In that situation, your finish script will see a "full" SMF tree.

This material is copyrighted by Philip Brown


Written by: Philip Brown
Bolthole Top - Solaris Top - Search Bolthole.com