Samba/hwclock -- Samba Time Server Not Right

David Rankin drankin at cox-internet.com
Sun Jan 20 14:38:04 GMT 2002


Andrew, you're not going to believe this, but I think you FIXED IT!!!!

I have also attached the tcpdump of the Samba restart for you review. Here is
what I did:

I was working from home on the computer "Skyline" through 2 SSH windows with
Skyline joined as a member of the workgroup at work via a pptp VPN connection.

    I set up the tcpdump "tcpdump -s 1500 -w dumpout

    From the second SSH session I issued "/ect/rc.d/init.d/smb restart"

Then from a dos window issued the "net time \\nemesis /yes" command. To my
great surprise and great delight, the following was returned:

    C:\WINDOWS>net time \\nemesis
    Current time at \\NEMESIS is 1-19-2002 9:52A.M.    (CORRECT!!!)
    The command was completed successfully.

Now this is just my guess at what my problem was -- please look at the dump to
confirm. I think I know what happened. The last time samba was restarted was
when we took the last lightning hit (before the UPS) which happened:

    [root at Nemesis david]# uptime
     10:07am  up 208 days, 19:46,  1 user,  load average: 0.00, 0.00, 0.00

days ago. When samba was started the localtime softlink was not set. Samba was
oblivious to the tz variable and since I haven't restarted samba for 208 days
it didn't matter what I did with the localtime link because samba never saw
it. When you had me resart samba to get the tcpdump this morning, the
localtime link was properly set and "bingo" samba became aware of the tz
setting and now is serving the correct time!!

I think the moral to this story is --

    If you change the localtime soflink or change the tz variable YOU HAVE TO
RESTART SAMBA.

If this is really the case, this would make a great addition to the samba docs
and the hwclock man page. Take a look at the tcpdump output (attached) and see
if my guess at what happened makes sense!

    THANK YOU VERY MUCH!!

    Now, I think I'm just going to go back and issue the net time command
about 50 more times just to delight in the fact that it is giving me the
correct time. It's those small victories that make life worth living!!

Andrew Bartlett wrote:

> David Rankin wrote:
> >
> > Andrew,
> >
> >     Since I got your message I've dived back into my mess with Samba
> > serving the wrong time. I'm pulling my hair out. Look at the following.
> > It doesn't make sense to me at all : (
>
> I've looked at the snif you sent me.  Your Samba is convinced it is in
> GMT.  Looking a the code, this can occur if you system does't supply a
> gmtime() call or your system really thinks its in GMT.  It tells the
> client this - the client should actually be able to say 'well i'm not
> gmt, so I'll add/subtract....' but in any case we can't expect too much
> of MS :-)
>
> I'm wondering if Samba is starting before the timezone is set...
>
> Can you kill off samba, and manually start it with 'smbd -D&& nmbd -D'
> (at a root prompt).
>
> > Ok, so what have I learned?
> >
> >     (1)    It appears to me that Samba serves time based upon the system
> > clock;
> >     (2)    Regardless of what the tz setting is, Samba is going to serve
> > the 'actual' time stored in the system clock regardless of the tz info;
>
> No, regardless of the time zone, samba thinks its in utc.  Does
> 'gmtime()' work/exist on your system?  (Write a small C proggy to
> test).  That failing will set GMT without the slightest mention in the
> logs.
>
> >     (3)    As a result/consequence of (2) above, Samba ignores the tz
> > setting when serving time; and
> >     (4)    All of you who are telling me that you have your server
> > hardware clock and system clock set to UTC and are relying on the tz
> > setting to have Samba serve the correct time to your windows clients ---
> > I WANT TO KNOW HOW IN THE HECK YOU ARE DOING IT!!!!
> >
> > In the immortalized words of Tom Hanks: "That's about all I have to say
> > about that."
> >
> > I hope this is helpful, at least somewhat thorough with regard to the
> > problem I am experiencing. And I really hope that someone smarter than I
> > can point out to me, diplomatically of course, where I have my "CRI."
>
> I would rather like to get to the bottom of this some day...
>
> Andrew Bartlett
>
> --
> Andrew Bartlett                                 abartlet at pcug.org.au
> Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
> Student Network Administrator, Hawker College   abartlet at hawkerc.net
> http://samba.org     http://build.samba.org     http://hawkerc.net

--
David C. Rankin, J.D., P.E.
RANKIN * BERTIN, PLLC
1329 N. University, Suite D4
Nacogdoches, Texas 75961
(936) 715-9333
(936) 715-9339 fax

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dumpout
Type: application/octet-stream
Size: 32539 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba/attachments/20020120/ee7ecab9/dumpout.obj


More information about the samba mailing list