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