2006-07-01

ntpd Tests

Compelled by the temptation of my recent post regarding ntpd improvements in OpenBSD-current, I put OpenBSD on an old Packard Bell and ran some tests.

This, I hope, will document how I did it for posterity's sake.

  1. ntpd is usually started by the system in /etc/rc.conf or /etc/rc.conf.local. Screw that. Remove or comment out any lines in these files that begin with "ntpd_flags=".

  2. Find the ntpd process if it is running. "ps -aux | grep ntpd". OpenNTPD runs in privilege separation mode, so you must run "kill -TERM XXX", where XXX is the pid of the root-owned ntpd process, not the one owned by the "_ntp" user.

  3. Download and install daemontools.

  4. Create a new daemontools service for ntpd:
    # mkdir -p /usr/local/ntpd/log/main
    # mkdir -p /usr/local/ntpd/log/adjust
    # chmod -R 02755 /usr/local/ntpd
    # chmod +t /usr/local/ntpd
    # cat /usr/local/ntpd/run
    #!/bin/sh
    exec 2>&1
    exec /usr/sbin/ntpd -d
    # cat /usr/local/ntpd/log/run
    #!/bin/sh
    exec multilog t \ 
    -* '+* adjust*' ./adjust \
    +* ./main
    # chmod 0755 /usr/local/ntpd/run
    # chmod 0755 /usr/local/ntpd/log/run
    # ln -sf /usr/local/ntpd /service
    

Complicated? Yes. Useful? You bet. This will take the "adjusting local clock by 0.005s" messages that would ordinarily be written to /var/log/daemon and put them in /service/ntpd/log/adjust/current. This is more complicated than "grep 'adjust' /var/log/daemon", but it's also in my opinion easier to maintain.

I'm running this setup on two systems: a 3.9-current system and an OpenBSD 3.8 system without the ntpd improvements. I'm going to let this run for a while (a looong while if I get distracted and forget about all of this) and then see if the 3.9-current logs provide smaller, more finely-tuned adjustments over time.

No comments: