Wednesday, January 14, 2015

Joys of SMF on Solaris 11

Spent about 3 hours this morning debugging a rebuilt Solaris 11 machine (running on a Sun T5240).  The problem was that the SMF service ntp would not start.  This is a new build and, as delivered, the ntp service is not enabled.  So, step one was "svcadm enable ntp".  Then step two, since I am a dutiful sysadmin was "svcs ntp" to verify that step one succeeded and I could move on to step three, drink coffee.  Alas, no.  ntp was in "maintenance" mode which generally means you screwed up the configuration file /etc/inet/ntp.conf.  OK, that's probably it, right -- after all, the ntp.conf I'm using came from a Solaris 10 system.  So parse through ntp.conf with a fine tooth comb.  Looks OK, but just to be safe we'll try one of the distributed default configuration files, /etc/inet/ntp.client.  "svcadm restart ntp" -- still no joy.  So, svcs -xv tells us where the log file resides -- /var/svc/log/network-ntp:default.log.  Looking there, we find only "[ Jan 14 10:20:51 svc.startd could not set context for method: ]".
Harumph.
So, using the output from "svcs -xv" again, we find the startup script is /lib/svc/method/ntp.  Lots of "svcprop" calls in here, so go poking about in man pages and piddle with svcprop to find out what is in the SMF database, all to no avail.  OK, so we'll just Google this and see what someone else has written up.  No particularly illuminating results, then I notice that the log file also contains "chdir: Permission denied" without any typical log file decorations around it.  Hmmm, no "cd" or "chroot" in the startup script.  What is going on?
The best post I found while Googling suggested that this message from SMF was caused by the root user's home directory being nonexistent and fixing that particular problem fixed the SMF problem.  Well that can't be it, right?  "ls -al /root" shows… What the heck? . is owned by one of the junior admins (later discovery found that he was "looking for the mysql data files...").  "chown root /root; svcadm clear ntp" and voila, we now have a functioning ntp service.
Unbelievable!

No comments:

Post a Comment