* You are viewing the archive for the ‘smf’ Category

Failed Repository Integrity Check

Last week I was presented with the following error on one of the Solaris 10 boxes:

svc.configd: smf(5) database integrity check of:

/etc/svc/repository.db

failed. The database might be damaged or a media error might have
prevented it from being verified. Additional information useful to
your service provider is in:

/etc/svc/volatile/db_errors

The system will not be able to boot until you have restored a working
database. svc.startd(1M) will provide a sulogin(1M) prompt for recovery
purposes. The command:

/lib/svc/bin/restore_repository

can be run to restore a backup version of your repository. See
http://sun.com/msg/SMF-8000-MY for more information.

Having never seen this error, I was thinking: “this is gonna be interesting…”. Thankfully the error was pretty verbose so I started to disect it section by section. Yeah, service repository got hosed, somehow, and I can potentially find some usefull info in /etc/svc/volatile/db_errors. Unfortunatelly, there was nothing of use in there.

The restore_repository script mentioned gave me little more hope. I also went and checked out the page URL. After reading the page I decided to go ahead and try to restore the service repository.

I logged in to the box in single user mode and took a look at the restore script to get an idea of what it might do. Then, I ran it. Fortunatelly, the script was pretty good at doing checks and told me that I can not proceed any further because / filesystem is mounted RO. To fix this I was asked to run:

bash-3.00# /lib/svc/method/fs-root
bash-3.00# /lib/svc/method/fs-usr

Once the filesystems were fixed up I ran the restore_repository script. I was asked which backup copy I wanted to restore and that was it. The system rebooted and came back up fine. This turned out to be a pretty good learning experience and http://www.sun.com/msg/SMF-8000-MY is very well worth reading. Continue Reading

Using CVS with SMF

Most services in Solaris 10 are controlled by SMF. SMF uses xml files to define services it manages. I had a need to quickly create a service manifest for CVS. The inetconv command takes an input file with inetd.conf format and converts it into basic SMF manifest and imports it into the SMF repository. In the case of CVS I created cvs_inetd file with following content:

cvspserver stream tcp nowait root /export/apps/cvs -f --allow-root=/export/cvs_repos/primary --allow-root=/export/cvs_repos/secondary pserver

Then I converted and imported the file using the following:

root@ultra# inetconv -f -i ./cvs_inetd
cvspserver -> /var/svc/manifest/network/cvspserver-tcp.xml
Importing cvspserver-tcp.xml ...Done
root@ultra#

The resulting CVS manifest was saved in /var/svc/manifest/network. Later, if needed, you can view, modify, etc. the service manifest properties using svccfg and svcprop commands. The -f switch above causes CVS manifest in /var/svc/manifest/network be overwritten, if it exists.

Also, make sure cvspserver is defined in /etc/services. Continue Reading