Re: ntpclient and setting clock
- Dear Mike,
Thanks very much for taking the time with this detailed answer. I have been able to make some progress but not yet to the point where ntpclient "just works" ... that would be nice.
The realization that SlugOS is a normal Linux and not the hybrid beast of UnSlung is important and will help me a lot.
Once I get this nailed down, I will look into updating the Wiki.
All the best,
--- In email@example.com, "Mike Westerhof (mwester)" <mwester@...> wrote:
> On 2/8/2011 12:13 AM, mspohr wrote:
> > I'm running SlugOS 5.3 and trying to get the clock to have the correct time (it's stuck in 2005).
> > I installed ntpclient using opkg (not ipkg).
> > The instructions here:
> > http://www.nslu2-linux.org/wiki/HowTo/FixTheClockUsingAdjtimexAndNtpclient
> > ... are confusing and seem to refer to unslung only.
> Yep. Unslung is a completely different beast from any normal Linux
> system - you can't use Unslung directions on anything else. For SlugOS,
> well, it's a normal Linux system -- use any other normal linux reference
> to figure out how to use a package.
> > It says something was fixed in SlugOS (but not the clock, apparently).
> The clock in SlugOS works just fine. The reference is to an ancient bug
> in the Linux kernel that got the clock frequency wrong, so the clock
> drifted. It was fixed in SlugOS, then pushed upstream, and the fix has
> been part of the standard Linux kernel for a long, long time.
> But, to be clear, that fix is only for a clock that drifts -- if yours
> is merely at the *wrong* time, then just set the time in the normal
> Linux fashion. If yours is literally *stuck*, then you may need to take
> more drastic action -- pop the device open, and replace the internal
> battery. See the wiki for instructions.
> > I did create the file S10ntpclient in /opt/etc/init.d as directed on this page but I don't have the unslung directories for the other files. This did not fix the clock... still 2005.
> > Any suggestions on how to fix this in SlugOS 5.3?
> Well, start by correcting your clock the normal way. Use the "date"
> command to set the system's idea of the current date and time. Then use
> the "hwclock" command to push the current (now correct) time into the
> hardware clock chip. Take care to note the timezone -- if you followed
> the wiki instructions on how to turnup and configure SlugOS, you have
> set your local timezone, and you'll want to use the '--utc' option to
> "hwclock" so that the hardware clock is set to UTC time (which is the
> right way to do it for Linux machines):
> root@frankenslug:~# date
> Sun Jan 4 12:19:35 CST 2004
> root@frankenslug:~# date '2011-02-08 08:23:00'
> Tue Feb 8 08:23:00 CST 2011
> root@frankenslug:~# date
> Tue Feb 8 08:23:04 CST 2011
> root@frankenslug:~# hwclock --systohc --utc
> root@frankenslug:~# hwclock -r
> Tue Feb 8 14:24:05 2011 0.000000 seconds
> As for ntpclient, I just installed it, and it works out-of-the-box. No
> configuration necessary. It will NOT adjust your hardware clock, though
> - just the system clock. If it fails to do that, then perhaps your
> NSLU2 can't reach the internet (try pinging pool.ntp.org from the
> NSLU2). Or perhaps, like NTP, if you clock is too far off it decides
> that something is too wrong for it to correct, and requires human
> interaction to set the clock at least close to the real time before it
> will adjust it.
> Feel free to add the above instructions to the wiki article so as to
> help the next person who wishes to use ntpclient.
> -Mike (mwester)