You are not logged in.

#1 2009-10-04 18:16:29

rasteenb
Member
Registered: 2009-04-20
Posts: 19

System time / hwclock mismatch, must manual fsck each boot

Greetings:
My system clock is perpetually 5 hours behind the hw clock.
The hw clock is on local time and the GMT offset is 5 hours, although the system clock shows the wrong time as CDT, not GMT.

I have attempted to fix it by:
manually setting the date
removing the /etc/localtime file
by changing the permissions & users on the /etc/localtime file
by including the openntpd daemon on startup

No luck.  After correcting the system time, if I shut down my laptop and reboot later, it tells me that the Superblock time is in the future and forces me to manually fsck to stamp the Superblock with the [incorrect] time.
This is not fun.
For awhile the problem would be automatically fixed (to the incorrect time) at boot, but now I am being forced to fix it myself.

None of the techniques I've found in the forums so far have worked.
A possible clue:
When I reboot after fsck-ing, a message flashes by about a problem writing "/etc/localtime" because of a permission.  I've tried change the permissions and the owner/group (666 and users:users) but this didn't seem to help.

Any suggestions?  I'm running an Acer Aspire One 150, boots XP and Ubuntu from the hard drive and Arch from a USB stick.  I haven't used XP in a long time.

Rob

Offline

#2 2009-10-04 18:59:37

brenix
Member
From: California
Registered: 2008-03-05
Posts: 185

Re: System time / hwclock mismatch, must manual fsck each boot

Hmm, if you take a look at the /etc/rc.sysinit around line 299 (default rc.sysinit), you can see the commands taking place when it adjusts the system clock. This may help find where the issue exists as you can run through each one and see where a problem comes up.. Just a thought..

Offline

#3 2009-10-04 20:00:23

Nepherte
Member
From: Singapore
Registered: 2008-09-09
Posts: 427

Re: System time / hwclock mismatch, must manual fsck each boot

I had this exact problem yesterday myself. I've also seen someone else with the isue as well. To solve the booting problem, using the hwclock command worked. I believe i ran

hwclock -s

I've also tried various things to solve "the core problem" but none so far helped. I first verified my settings were correct: timezone and the way the time is stored in bios (localtime because I occasionally run windows as well). I also used openntpd to sync with time servers. I've put it in the DAEMONS array but it doesn't set the time correctly after it has reached the login screen. Only after restarting the service, the correct time is set. I now tried some other thing that might solve it, but I'm not sure yet. Hell, it might even be the bios battery but it's barely 2 years old.

Offline

#4 2009-10-04 20:05:52

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: System time / hwclock mismatch, must manual fsck each boot

Is the hardware clock in /etc/rc.conf defintetely set to localtime?


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#5 2009-10-05 13:20:12

Nepherte
Member
From: Singapore
Registered: 2008-09-09
Posts: 427

Re: System time / hwclock mismatch, must manual fsck each boot

Positive:

...
LOCALE="nl_BE.utf8"
HARDWARECLOCK="localtime"
TIMEZONE="Europe/Brussels"
KEYMAP="be-latin1"
...

For now I'm not experiencing the problem anymore after removing /var/lib/hwclock/adjtime. Perhaps it might help rasteenb as well.

Offline

#6 2009-10-05 13:27:54

Dieter
Member
From: Germany
Registered: 2005-10-13
Posts: 140

Re: System time / hwclock mismatch, must manual fsck each boot

I have the same problem on my box running Arch x86_64 (I don't know whether this is a 64-bit only issue). HARDWARECLOCK is (definitely) set to "localtime" and TIMEZONE is "Europe/Berlin" here. At boot time I often receive "superblock last mount time is in the future" message. The date command shows UTC time with "CEST" which is wrong; I expected local time with CEST (Central European summer time) or at least UTC without CEST. It seems that "localtime" and/or timezone(s) are ignored during boot before file system check starts.
http://bbs.archlinux.org/viewtopic.php?id=81444 seems to deal with the same issue.

Last edited by Dieter (2009-10-05 13:30:45)

Offline

#7 2009-10-05 14:11:43

lpb331
Member
From: Oregon
Registered: 2007-12-18
Posts: 44

Re: System time / hwclock mismatch, must manual fsck each boot

I had a similar problem a couple months ago. I finally noticed that I was passing different options to the hwclock command on shutdown than on startup. So when I shutdown, the clock was reset to localtime in the rc.shutdown script. Then when I started up, since I was using UTC (5 hrs ahead of me), the clock was then set to the same time in my time zone since hwclock is called twice in the rc.sysinit script. If I restarted within a few hours, I got the message about the superblock being set in the future. Hope this helps!

Offline

#8 2009-10-09 10:06:25

Harey
Member
From: Bavaria, Germany
Registered: 2007-03-24
Posts: 359

Re: System time / hwclock mismatch, must manual fsck each boot

There seems to be a bug in timezone handling by the current initscripts.
I have two systems with identical hardware and software installed. Both are 32 bit and in use as servers without X. Both of them have openntpd running and synchronize time to de.ntp.pool.org. Since a short Period one of them hung during booting with a filesystem error "superblock last mount time is in the future".  I tried to find the difference between the two of them and found that a recent pacman -Syu must have introduced the error. Since the installed software is basically the same and the update was applied to both of them I guessed that there must be a difference in the configuration files. At last I found a difference in the file rc.conf which I missed to update on one server. This is the one that does not hang during boot.
It reads:

LOCALE="de_DE.utf8"                                                         
HARDWARECLOCK="local"                                                   
TIMEZONE="Europe/Berlin"

Which is incorrect according to the new rc.conf template. The other one reads

LOCALE="de_DE.utf8"                                                         
HARDWARECLOCK="localtime"                                                   
TIMEZONE="Europe/Berlin"

which should be correct. Notice the difference in HARDWARECLOCK. Well, this one hangs during boot. I checked hardware clocks on both of them. They are both set to localtime.
As a proof I set the second one to "local" as well and it booted properly. 
rc.conf says

# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
#   in the hardware clock being left untouched (useful for virtualization)

Since this comment changed in the new rc.conf I guess there has been some tweaking her that leads to trouble.


Linux is like a wigwam: No Gates, no Windows and an Apache inside

Offline

#9 2009-10-09 12:03:44

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: System time / hwclock mismatch, must manual fsck each boot

Harey wrote:

Since this comment changed in the new rc.conf I guess there has been some tweaking her that leads to trouble.

I am a bit confused by your comment.

After you changed local to localtime, is everything fine now ?


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#10 2009-10-09 12:27:17

Harey
Member
From: Bavaria, Germany
Registered: 2007-03-24
Posts: 359

Re: System time / hwclock mismatch, must manual fsck each boot

shining wrote:

After you changed local to localtime, is everything fine now ?

No, it's just the other way round. If I change to localtime (which should be the correct setting) the system hangs. According to the comment in rc.conf  anything else then HARDWARECLOCK="UTC" should leave the hardware clock untouched. This does not seem to be correct. 'local' is not a valid keyword anymore, I could as well write "hrmpf" and it should be ignored... wink

I guess the use of "localtime" triggers some weird behaviour from the initscripts.

Harvey


Linux is like a wigwam: No Gates, no Windows and an Apache inside

Offline

#11 2009-10-15 18:13:26

VuDu
Member
Registered: 2007-05-11
Posts: 95

Re: System time / hwclock mismatch, must manual fsck each boot

Harey wrote:

There seems to be a bug in timezone handling by the current initscripts.
I have two systems with identical hardware and software installed. Both are 32 bit and in use as servers without X. Both of them have openntpd running and synchronize time to de.ntp.pool.org. Since a short Period one of them hung during booting with a filesystem error "superblock last mount time is in the future".  I tried to find the difference between the two of them and found that a recent pacman -Syu must have introduced the error. Since the installed software is basically the same and the update was applied to both of them I guessed that there must be a difference in the configuration files. At last I found a difference in the file rc.conf which I missed to update on one server. This is the one that does not hang during boot.
It reads:

LOCALE="de_DE.utf8"                                                         
HARDWARECLOCK="local"                                                   
TIMEZONE="Europe/Berlin"

Which is incorrect according to the new rc.conf template. The other one reads

LOCALE="de_DE.utf8"                                                         
HARDWARECLOCK="localtime"                                                   
TIMEZONE="Europe/Berlin"

which should be correct. Notice the difference in HARDWARECLOCK. Well, this one hangs during boot. I checked hardware clocks on both of them. They are both set to localtime.
As a proof I set the second one to "local" as well and it booted properly. 
rc.conf says

# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
#   in the hardware clock being left untouched (useful for virtualization)

Since this comment changed in the new rc.conf I guess there has been some tweaking her that leads to trouble.

Thanks! I was having the same problem and that did it for me (changing local to localtime).

Offline

#12 2009-10-15 20:19:23

Harey
Member
From: Bavaria, Germany
Registered: 2007-03-24
Posts: 359

Re: System time / hwclock mismatch, must manual fsck each boot

Vudu,

Thanks! I was having the same problem and that did it for me (changing local to localtime).

Unfortunately it did not work for me this way because of openntpd. When openntpd is invoked the system seems to think it is on utc even when timezone is right and  HARDWARECLOCK="localtime" is set. This leads to "superblock last mount time is in the future"-error although everything should be right. The only way out is to set the hardwareclock to UTC and HARDWARECLOCK="UTC" in /etc/rc.conf. This is not related to x86_64 because yesterday i had a box on arch i686 with the same error...

There seems to be an error somewhere in intscripts or openntpd.

Harvey


Linux is like a wigwam: No Gates, no Windows and an Apache inside

Offline

#13 2009-10-31 09:18:49

cleanrock
Member
Registered: 2008-11-17
Posts: 109

Re: System time / hwclock mismatch, must manual fsck each boot

I also experienced this problem lately.
My hw clock is set incorrectly at boot (i see it is ok in bios before boot).
I am using "localtime" and openntpd.
I think the problem is the recent DST shift and the /sbin/hwclock --adjust in /etc/rc.sysinit.
Deleting /var/lib/hwclock/adjtime should fix this but i suspect the problem will popup again with next DST shift.

Offline

#14 2009-11-01 13:28:21

rasteenb
Member
Registered: 2009-04-20
Posts: 19

Re: System time / hwclock mismatch, must manual fsck each boot

I replaced

"local" with

"localtime"

in my rc.conf and now the system clock and hw clock are in agreement the Superblock times work.

Note:  I had turned off Openntpd awhile ago in my attempts to fix this problem.  I did an

ntpd -d -s

to get my system back on the right time.

Thanks for the fix!

Rob

Offline

#15 2009-11-01 18:30:08

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: System time / hwclock mismatch, must manual fsck each boot

cleanrock wrote:

I also experienced this problem lately.
My hw clock is set incorrectly at boot (i see it is ok in bios before boot).
I am using "localtime" and openntpd.
I think the problem is the recent DST shift and the /sbin/hwclock --adjust in /etc/rc.sysinit.
Deleting /var/lib/hwclock/adjtime should fix this but i suspect the problem will popup again with next DST shift.

Quite possible so because using localtime the hardware clock will be set to a new value on DST shifts. This is other than with UTC where the hardwareclock remains unaffected and the system time will be adjusted by software only.

Quoting from the TIMEZONE wiki:

IMPORTANT: When the HARDWARECLOCK setting is set to localtime, Linux will not adjust the time, operating under the assumption that your system may be a dual boot system at that time and that the other OS takes care of the DST switch. If that was not the case, the DST change needs to be made manually.

Thus it would be a good idea to delete adjtime after a DST shift if using localtime.


To know or not to know ...
... the questions remain forever.

Offline

#16 2009-11-02 13:28:20

cleanrock
Member
Registered: 2008-11-17
Posts: 109

Re: System time / hwclock mismatch, must manual fsck each boot

I switched to UTC time, it works dual booting with Windows if you set RealTimeIsUniversal in Windows registry. (google for RealTimeIsUniversal if you are interested)

Offline

#17 2009-11-29 13:28:55

manouchk
Member
Registered: 2008-07-29
Posts: 306

Re: System time / hwclock mismatch, must manual fsck each boot

I guess this problem may occur principally for people using dual boot. Is my hypothesis right?

Offline

#18 2009-11-30 09:39:52

Harey
Member
From: Bavaria, Germany
Registered: 2007-03-24
Posts: 359

Re: System time / hwclock mismatch, must manual fsck each boot

manouchk wrote:

I guess this problem may occur principally for people using dual boot. Is my hypothesis right?

Yes. You have to synchronize the behaviour of all OSes that will boot on this machine. Otherwise they will eventually be setting the hardware clock assuming that the are 'alone'.  I suggest you set your hwclock to UTC. For windows set RealTimeIsUniversal in Windows registry as cleanrock suggested, for arch set HARDWARECLOCK="UTC" in /etc/rc.conf.

Harvey


Linux is like a wigwam: No Gates, no Windows and an Apache inside

Offline

Board footer

Powered by FluxBB