Bug #4581
openSMF reports non-obvious error when switching to user with nonexistent home directory
0%
Description
If a service is configured to run as a specific user and that user's home
directory does not exist, the start method fails without ever being executed,
but SMF says that the start method exited with status 96. I changed the start
method for the service in question to "/bin/true" while debugging:
svc:/print/cups:default (CUPS print server)
State: maintenance since Thu Feb 6 12:23:29 2014
Reason: Start method exited with $SMF_EXIT_ERR_CONFIG.
See: http://illumos.org/msg/SMF-8000-KS
See: /var/svc/log/print-cups:default.log
Impact: This service is not running.
[ Feb 6 12:23:29 Enabled. ]
[ Feb 6 12:23:29 Executing start method ("/bin/true"). ]
[ Feb 6 12:23:29 Method "start" exited with status 96. ]
and even with debugging turned on, svc.startd only says:
Feb 5 19:19:38/9: Starting svc:/print/cups:default.
Feb 5 19:19:38/135: print/cups:default starting
Feb 5 19:19:38/135: svc:/print/cups:default: forking to run method /bin/true
Feb 5 19:19:38/135: Storing primary contract 97571 for svc:/print/cups:default.
Feb 5 19:19:38/135: start method for svc:/print/cups:default exited with status 96.
Feb 5 19:19:38/5: Received event 1 for ctid 97571 cookie 32
Feb 5 19:19:38/135 ERROR: svc:/print/cups:default: Method "/bin/true" failed with exit status 96.
Feb 5 19:19:38/135: Removing primary contract 97571 for svc:/print/cups:default.
Feb 5 19:19:38/135: print/cups:default misconfigured: transitioned to maintenance (see 'svcs -xv' for details)
Files
Updated by Gary Mills over 9 years ago
Is there not an error logged in /var/adm/messages when this happens?
Updated by Anonymous over 9 years ago
Gary Mills wrote:
Is there not an error logged in /var/adm/messages when this happens?
Sure, it's just equally useless ("/bin/true returned 96")
Feb 6 12:23:29 print svc.startd[3078]: [ID 652011 daemon.warning] svc:/print/cups:default: Method "/bin/true" failed with exit status 96.
Feb 6 12:23:29 print svc.startd[3078]: [ID 748625 daemon.error] print/cups:default misconfigured: transitioned to maintenance (see 'svcs -xv' for details)
Feb 6 12:23:29 print fmd: [ID 377184 daemon.error] SUNW-MSG-ID: SMF-8000-YX, TYPE: defect, VER: 1, SEVERITY: major
Feb 6 12:23:29 print EVENT-TIME: Thu Feb 6 12:23:29 EET 2014
Feb 6 12:23:29 print PLATFORM: i86pc, CSN: -, HOSTNAME: print
Feb 6 12:23:29 print SOURCE: software-diagnosis, REV: 0.1
Feb 6 12:23:29 print EVENT-ID: dd6bdff3-3273-4310-f152-e868f890a8f0
Feb 6 12:23:29 print DESC: A service failed - a start, stop or refresh method failed.
Feb 6 12:23:29 print Refer to http://illumos.org/msg/SMF-8000-YX for more information.
Feb 6 12:23:29 print AUTO-RESPONSE: The service has been placed into the maintenance state.
Feb 6 12:23:29 print IMPACT: svc:/print/cups:default is unavailable.
Feb 6 12:23:29 print REC-ACTION: Run 'svcs -xv svc:/print/cups:default' to determine the generic reason why the service failed, the location of any logfiles, and a list of other services impacted.
Updated by Gary Mills over 9 years ago
There was an earlier bug report, #3989, that showed an error message that appeared when the home directory was missing:
[ Jun 13 22:11:58 Executing start method ("/opt/local/sbin/rabbitmq-server"). ]
[ Jun 13 22:11:58 svc.startd could not set context for method: ]
chdir: No such file or directory
This bug is marked resolved. I presume it displays the missing directory name now. You must have found another bug.
Updated by Lauri Tirkkonen over 9 years ago
Oh, sorry, in my test machine I did not actually have that commit yet... I will test whether this happens on newer bits.
As a side note it looks like that commit deals with 'wait' services; this was a 'contract' service.
Updated by Lauri Tirkkonen over 9 years ago
Okay, I was able to reproduce this on 6ab697caaefb599dda8c2839feec7322d7cf45bb. Attaching a test case manifest which works without modifying existing users on OI ('uucp' user has no home directory by default it seems)
While preparing a minimal test manifest, I found that if I set the method credentials for user and group, the correct error message is generated:
[ Feb 20 14:45:14 Executing start method ("/bin/true"). ]
[ Feb 20 14:45:14 svc.startd could not set context for method: ]
[ Feb 20 14:45:14 chdir: No such file or directory ("/usr/lib/uucp") ]
[ Feb 20 14:45:14 Method "start" exited with status 96. ]
However, if I also specify privileges='basic,net_privaddr' for
method_credentials:
[ Feb 20 14:47:56 Executing start method ("/bin/true"). ]
[ Feb 20 14:47:56 Method "start" exited with status 96. ]