[RESOLVED] Time(zone) Problem

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

[RESOLVED] Time(zone) Problem

Unread post by dkeg » Sun Jul 06, 2014 4:58 am

Release is Spring rev2 (Gruffalo)
Okay, so even after the efforts (Thank you!!)of pidsley though IRC, and also alad, I cannot seem to get this fixed. Just noticed it this evening, but it definitely happened today some time. My output of date is all wrong. First off it display's UTC time instead of localtime. I have run /etc/tzdata, and dpkg-reconfigure tzdata, and cat /etc/timezone correctly display's America/New_York.

However when I run date, I get Sun Jul 6 03:41:45 America 2014, which right now its 23:42 EDT. So two things, why is it showing UTC time and not local, and two, why is it not displaying timezone, but Geographic location instead? That is probably why defaulting to UTC time.

If I run date +%Z I should get my timezone, EDT, but get America. Another thing of note, is when I reboot, and log back in, the correct timezone, date, and time show for my last login. But after that, its back to what I describe above.

I've tried everything I know or have found. Also tried to reinstall tzdata and booted a different kernel. We also tried removing /etc/localtime and pretty much starting over. I also tried a symlink from /usr/share/zoneinfo/America/New_York to /etc/localtime, and even tried echo "America/New_York" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
Booting into a different partition/spin fixes it, so its specific to this spin. But I could change the bios settings time and date, which was UTC to localtime, which did fix time and date, but it still displayed America instead of EDT. Nothing changes that.

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Time(zone) Problem

Unread post by machinebacon » Sun Jul 06, 2014 5:27 am

how about

Code: Select all

sudo hwclock --utc --debug --show
date
Edit: some interesting posts here: http://forums.debian.net/viewtopic.php?t=48474
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Time(zone) Problem

Unread post by dkeg » Sun Jul 06, 2014 5:35 am

thanks. same thing. pidsley also had suggested that. We had tried so many things, hard to remember them all. Also tried updating ntpd, but I don't think it has to do with that. For whatever reason it is America instead of the timezone.
hwclock from util-linux 2.20.1
Using /dev interface to clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2014/07/06 04:31:42
Hw clock time : 2014/07/06 04:31:42 = 1404621102 seconds since 1969
Sun 06 Jul 2014 04:31:42 AM America -0.891539 seconds

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Time(zone) Problem

Unread post by machinebacon » Sun Jul 06, 2014 5:59 am

Do you actually have ntp running?

ntpdate pool.ntp.org

You could be really cheap and set the time zone with

Code: Select all

export TZ=EST
in .bashrc for example ;)
..gnutella..

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Time(zone) Problem

Unread post by machinebacon » Sun Jul 06, 2014 8:21 am

Oh and one more:

cat /etc/adjtime

make sure it is really UTC there
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Time(zone) Problem

Unread post by dkeg » Sun Jul 06, 2014 12:05 pm

no nothing changes. I can change tzdata to Asia, and it is still America as timezone and time as UTC. So where is it coming from?

Yes, I can change in .bashrc, and timezone does display as EDT, but time is still UTC

Work hard; Complain less

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Time(zone) Problem

Unread post by dkeg » Sun Jul 06, 2014 12:16 pm

as explained above, last login is correct, then all wrong from there. You can see I was messing around and set my tzdata to Asia, but timezone still says America
date.png
date.png (3.15 KiB) Viewed 2414 times

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Time(zone) Problem

Unread post by machinebacon » Sun Jul 06, 2014 12:49 pm

Isn't that managed via /etc/init.d/hwclock.sh ? Don't edit it, but take a look how it works. IIRC it gathers a few things and then sets the time zone.

I really have no idea what this all means. But googling this showed so many similar results (time plus x hours, next reboot it adds up again and again), ...
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Time(zone) Problem

Unread post by dkeg » Sun Jul 06, 2014 2:44 pm

I seemed to have resolved it with these steps, in this order.

Code: Select all

# set timezone
dpkg-reconfigure tzdata
# sync clock with network
ntpd -qg
# write current software clock to hardware clock
hwclock --systohc
reboot
So it seems everything we all did to try to fix was correct. Either I was not doing in the right order, or not rebooting immediately after, and instead messing up a potential fixed issue by running another command, like tzdata(?). I don't know, but it is resolved. I spent hours on it last night, and a couple hours this morning.

Seems the reason date was showing America was because the system was confused as hardware was set for localtime, system set for UTC.

Thank you Pidsley!, MB, and alad for taking time out to help me. I appreciate it.

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: [RESOLVED] Time(zone) Problem

Unread post by machinebacon » Sun Jul 06, 2014 3:15 pm

^ Yeah, I saw a similar post saying that exactly the order does count, because hwclock saves the time at shutdown (!) -- guess that's why they placed it in /etc/init.d/

Step 16.2 -> http://www.debian.org/doc/manuals/syste ... -time.html
says something similar. Ye good ole Administrator's Handbook ;)
..gnutella..

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: [RESOLVED] Time(zone) Problem

Unread post by dkeg » Sun Jul 06, 2014 3:25 pm

right, seems so much more clear now that I've spent the time diagnosing and investigating. First time is the hardest.

Work hard; Complain less

Post Reply