Jade's Tech Notes

More bits more places

Home Directories and SMF Error 96

tl;dr: make sure the user’s home directory exists.

The other day I was setting up a Tomcat instance (for Atlassian Stash) to run under SMF on SmartOS with a alternate user and low ports (on 443 without root) and the service kept going into maintenance state with a reason of Start method exited with $SMF_EXIT_ERR_CONFIG and a service log message of

[ Jul 12 20:45:38 Enabled. ]
[ Jul 12 20:45:39 Executing start method ("/opt/stash/bin/start-stash.sh"). ]
[ Jul 12 20:45:39 Method "start" exited with status 96. ]

Everything I found when searching the web referred to config files missing and other sorts of things that are fairly obvious from log messages, except there wasn’t anything relevant in the logs. I replaced the start method with a shell script that printed a message to a file in /tmp and the file wasn’t updated. That got my focus back on SMF. Why would SMF not run a start method and say it was a configuration error?

After a few rounds of checking the SMF manifest and head banging I remembered that I didn’t specify -m (create home directory) when I created the user that the service was going to run under. I changed the user’s home directory from null to the app’s working dir in /var. The service started up after that.

I’m not sure why neither SMF’s verbose documentation nor the extended documentation online that is referenced in the error mentioned that when you start a service as a user other than root that user has to have a home directory. Instead everything points toward an application configuration error.

For reference, the SMF manifest I’m using to start Tomcat (as bundled with Atlassian Stash) is available as a Github Gist: stash.xml.