Solaris 10 SMF and NFS mounts

mount

How to add nfs mounts as a dependency to an smf manifest file.

On a webserver, I modified smf manifests for apache2 and mysql5. I tested the services by enabling and disabling each one; everything was fine.

However, upon reboot, both services were listed as being under maintenance.

I checked the smf log for mysql:

tail /var/svc/log/network-http:apache2.log

[ Feb  9 13:10:25 Method "start" exited with status 1 ]
[ Feb  9 13:10:25 Executing start method ("/usr/local/apache2/bin/apachectl graceful") ]
Syntax error on line 428 of /etc/apache2/httpd.conf:
DocumentRoot must be a directory
httpd not running, trying to start
[ Feb  9 13:10:25 Method "start" exited with status 1 ]
[ Feb  9 13:11:38 Rereading configuration. ]
[ Feb  9 13:12:07 Leaving maintenance because disable requested. ]
[ Feb  9 13:12:07 Disabled. ]

Apache was complaining that the webroot configuration was bad. I checked the conf file, and it was fine. I then remembered that the webroot was being nfs mounted.

Apache must’ve been trying to start before the webroot was mounted. After some experimentation, this appears to be how to add nfs mounts as an smf manifest dependency:

                <dependency name='virtual'
                    grouping='require_all'
                    restart_on='error'
                    type='service'>
                        <service_fmri value='svc:/network/nfs/client:default'/>
                </dependency>

After adding the dependency, I re-imported the manifest:

svccfg import apache2.xml