1<HTML> 2<HEAD> 3<TITLE>Solaris hints and kinks</TITLE> 4</HEAD> 5<BODY> 6Information on compiling and executing ntpd under Solaris. 7<BR> 8Last Updated: Sun Jun 21 01:32:18 EDT 1998, 9John Hawkinson, 10<! -- This is deliberately not a mailto -- > <jhawk@MIT.EDU> 11<P> 12If you're not running Solaris 2.5.1 or later, it is likely 13that you will have problems; upgrading would be a really good plan. 14<P> 15<H3>All Solaris versions</H3> 16<P> 17Proper operation of ntp under Solaris requires setting the kernel 18variable <I>dosynctodr</I> to zero (meaning "do not synchronize the clock 19to the hardware time-of-day clock"). This can be done with the 20tickadj utility: 21<BLOCKQUOTE><TT> 22tickadj -s 23</TT></BLOCKQUOTE> 24If you prefer, it can also be done with the native Solaris kernel debugger: 25<BLOCKQUOTE><TT> 26echo dosynctodr/W0 | adb -k -w /dev/ksyms /dev/mem 27</BLOCKQUOTE></TT> 28<P> 29Or, it can also be set by adding a line to /etc/system: 30<BLOCKQUOTE><TT> 31set dosynctodr = 0 32</BLOCKQUOTE></TT> 33<P> 34Instead of the <I>tick</I> kernel variable, which many operating 35systems use to control microseconds added to the system time every 36clock tick (c.f. <A HREF="../notes.htm#frequency_tolerance">Dealing 37with Frequency Tolerance Violations</A>), Solaris has the variables 38<I>nsec_per_tick</I> and <I>usec_per_tick</I>. 39<P> 40<I>nsec_per_tick</I> and <I>usec_per_tick</I> control the number of 41nanoseconds and microseconds, respectively, added to the system clock 42each clock interrupt. Enterprising souls may set these based on 43information collected by ntpd in the <CODE>/etc/ntp.drift</CODE> file 44to correct for individual hardware variations. 45<P> 46On UltraSPARC systems, <I>nsec_per_tick</I> and <I>usec_per_tick</I> 47are ignored in favor of the <I>cpu_tick_freq</I> variable, which 48should be automatically be determined by the PROM in an accurate 49fashion. 50<P> 51In general, the same ntp binaries should not be used across multiple 52operating system releases. There is enough variation in the core operating 53system support for timekeeping that a rebuild of ntpd for the idiosyncracies 54of your specific operating system version is advisable. 55<P> 56It is recommended that ntp be started via a script like <A 57HREF="solaris.xtra.S99ntpd">this one</A>, installed in 58<CODE>/etc/init.d/ntpd</CODE> with a symbol link from 59<CODE>/etc/rc2.d/S99ntpd</CODE>. 60 61<H3>Solaris 2.6</H3> 62<P> 63Solaris 2.6 adds support for kernel PLL timekeeping, but breaks this 64support in such a fashion that using it worse than not. This is <A 65HREF="solaris.xtra.4095849"> SUN Bug ID 4095849</A>, and it is not yet 66fixed as of June 1998. 67<P> 68<H3>Solaris 2.5 and 2.5.1</H3> 69<P> 70On UltraSPARC systems, calculation of <I>cpu_tick_freq</I> is broken 71such that values that are off by significant amounts may be used 72instead. This unfortunately means that ntpd may have severe problems 73keeping synchronization. This is <A HREF="solaris.xtra.4023118"> SUN Bug ID 744023118</A>. Bryan Cantrill <! -- <bmc@eng.sun.com> --> of Sun 75posted <A HREF="solaris.xtra.patchfreq">patchfreq</A>, a workaround script, 76to comp.protocols.time.ntp in March of 1997. 77<P> 78<HR> 79<H2>OLD DATA</H2> 80<STRONG>I can't vouch for the accuracy the information below this 81rule. It may be significantly dated or incorrect.</STRONG> 82<P> 83<P> 84<H3>Solaris 2.2</H3> 85<P> 86Solaris 2.2 and later contain completely re-written clock code to 87provide high resolution microsecond timers. A benefit of the 88re-written clock code is that adjtime does not round off its 89adjustments, so ntp does not have to compensate for this 90rounding. Under Solaris 2.2 and later, ntp #define's 91<CODE>ADJTIME_IS_ACCURATE</CODE>, and does not look for the <I>tickadj</I> 92kernel variable. 93<P> 94<H3>Solaris 2.1</H3> 95(This originally written by William L. Jones <jones@chpc.utexas.edu>) 96<P> 97Solaris 2.1 contains fairly traditional clock code, with <I>tick</I> 98and <I>tickadj</I>. 99<P> 100Since settimeofday under Solaris 2.1 only sets the seconds part of timeval 101care must be used in starting xntpd. I suggest the following start 102up script: 103<BLOCKQUOTE><TT> 104tickadj -s -a 1000 105<BR>ntpdate -v server1 server2 106<BR>sleep 20 107<BR>ntpdate -v server1 server2 108<BR>sleep 20 109<BR>tickadj -a 200 110<BR>xntpd 111</TT></BLOCKQUOTE> 112 113The first tickadj turns of the time of day clock and sets the tick 114adjust value to 1 millisecond. This will insure that an adjtime value 115of at most 2 seconds will complete in 20 seconds. 116<P> 117The first ntpdate will set the time to within two seconds 118using settimeofday or it will adjust time using adjtime. 119<P> 120The first sleep insures the adjtime has completed for the first ntpdate. 121<P> 122The second ntpdate will use adjtime to set the time of day since the 123clock should be within 2 seconds of the correct time. 124<P> 125The second tickadj set the tick adjust system value to 5 microseconds. 126<P> 127The second sleeps insure that adjtime will complete before starting 128the next xntpd. 129<P> 130I tried running with a tickadj of 5 microseconds with out much success. 131200 microseconds seems to work well. 132<P> 133<HR> 134Prior versions of this file had major text contributed by: 135<MENU> 136<LI>Denny Gentry <denny@eng.sun.com> 137</MENU> 138<BODY> 139</HTML> 140