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