View previous topic :: View next topic |
Author |
Message |
ShanaXXII Apprentice
Joined: 29 Jun 2014 Posts: 283 Location: Canada
|
Posted: Tue Mar 24, 2015 1:41 pm Post subject: [Solved] BIOS time right, date right, hwclock wrong |
|
|
Not sure whats going on. The time in my BIOS is correct.
My date is correct. but my hwclock is wrong and it resets on every boot after I change it
This causes fsck to check the disk every time it boots up
Code: | # date
Tue Mar 24 09:25:18 EDT 2015
# hwclock
Tue 24 Mar 2015 05:25:40 AM EDT -0.766148 seconds
# hwclock --hctosys
# hwclock
Tue 24 Mar 2015 05:26:26 AM EDT -0.859948 seconds
# date
Tue Mar 24 05:26:30 EDT 2015
! -- After a reboot -- !
# date
Tue Mar 24 05:30:49 EDT 2015
# hwclock
Tue 24 Mar 2015 01:29:59 AM EDT -0.813027 seconds
# hwclock --systohc
# hwclock
Tue 24 Mar 2015 05:31:32 AM EDT -0.203613 seconds |
By now, the BIOS clock has been changed from 9 AM to 5 AM :/
Code: | # cat /etc/conf.d/hwclock | grep clock=
clock="local" |
I think I have the right options set in the kernel (vanilla-3.19.2)
Code: |
Device Drivers -->
..... [ * ] Real Time Clock -->
.......... [ * ] Set system time from RTC on startup and resume
.......... [ ] Set the RTC time based on NTP synchronization
..........(rtc0) RTC used to set the system time
.......... [ ] RTC debug support
.......... *** RTC interfaces ***
.......... [ * ] /sys/class/rtc/rtcN (sysfs)
.......... [ * ] /proc/driver/rtc (procfs for rtcN)
.......... [ * ] /dev/rtcN (character devices) |
I changed my BIOS time back to 9 AM
Code: | # /etc/init.d/hwclock restart
* WARNING: you are stopping a boot service
* Setting hardware clock using the system clock [Local Time] ...
* Setting system clock using the hardware clock [Local Time] ...
# hwclock
Tue 24 Mar 2015 05:44:13 AM EDT -0.609853 seconds
# date
Tue Mar 24 09:45:56 EDT 2015 |
The BIOS time is still 9AM
Last edited by ShanaXXII on Wed Mar 25, 2015 2:50 am; edited 1 time in total |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Tue Mar 24, 2015 2:29 pm Post subject: |
|
|
What does `cat /etc/adjtime` say? |
|
Back to top |
|
|
ShanaXXII Apprentice
Joined: 29 Jun 2014 Posts: 283 Location: Canada
|
Posted: Tue Mar 24, 2015 3:55 pm Post subject: |
|
|
Ant P. wrote: | What does `cat /etc/adjtime` say? |
Code: | # cat /etc/adjtime
0.000000 1427189490 0.000000
1427189490
UTC |
|
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2575 Location: Here and Away Again
|
Posted: Tue Mar 24, 2015 4:51 pm Post subject: ><)))°€ |
|
|
I think I had something similar going recently, and I believe I ended up mending it by using the --update-drift option of hwclock.
Never found out what actually caused it, but it happened within a month from now I think. _________________ Kindest of regardses. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Tue Mar 24, 2015 6:57 pm Post subject: |
|
|
You've configured the initscript to save MS Windows local time in the BIOS but then you're running hwclock manually and it's reading it as if it's UTC (the /etc/adjtime setting). Change one or the other. |
|
Back to top |
|
|
freke l33t
Joined: 23 Jan 2003 Posts: 977 Location: Somewhere in Denmark
|
Posted: Tue Mar 24, 2015 6:58 pm Post subject: |
|
|
Isn't hwclock = BIOS clock?
date = system-time ie. hwclock --hctosys copies BIOS clock (hwclock-time) to system-time (date) |
|
Back to top |
|
|
ShanaXXII Apprentice
Joined: 29 Jun 2014 Posts: 283 Location: Canada
|
Posted: Tue Mar 24, 2015 7:36 pm Post subject: |
|
|
Ant P. wrote: | You've configured the initscript to save MS Windows local time in the BIOS but then you're running hwclock manually and it's reading it as if it's UTC (the /etc/adjtime setting). Change one or the other. |
How do I do that? Do I just delete /etc/adjtime?
and I don't have windows on this computer. :/ |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Tue Mar 24, 2015 8:30 pm Post subject: |
|
|
Deleting adjtime won't change anything, as hwclock already defaults to UTC. You need to fix your conf.d file to use UTC time instead of Windows time. |
|
Back to top |
|
|
ShanaXXII Apprentice
Joined: 29 Jun 2014 Posts: 283 Location: Canada
|
Posted: Wed Mar 25, 2015 12:42 am Post subject: |
|
|
Ant P. wrote: | Deleting adjtime won't change anything, as hwclock already defaults to UTC. You need to fix your conf.d file to use UTC time instead of Windows time. |
Are you talking about /etc/conf.d/hwclock?
Should it be something configured to something like this? Code: | # cat /etc/conf.d/hwclock
clock="UTC"
# clock_hctosys="YES"
# clock_systohc="NO"
# clock_args="" |
EDIT: That seems to have fixed it (:
Any idea why it was working before but not working now? I had Windows before, did that have something to do with it? |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2575 Location: Here and Away Again
|
Posted: Wed Mar 25, 2015 8:44 am Post subject: |
|
|
In my case, I've always preferred to manually set the clock via BIOS (hwclock) for whatever reason, even during my Windows-only times (disabled the Windows time-server even; I guess I liked being a little bit off at all times... heh, heh). Since it was recommend to use 'local' when dual-booting, that's what I went with when I first installed Gentoo (although it seems like it should be possible to set the hardware clock to UTC from Windows 7 onward without it messing with it).
That is, my /etc/conf.d/hwclock would be like this:
Code: | # Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
# Greenwich Mean Time). If that clock is set to the local time, then
# set CLOCK to "local". Note that if you dual boot with Windows, then
# you should set it to "local".
clock="local"
# If you want the hwclock script to set the system time (software clock)
# to match the current hardware clock during bootup, leave this
# commented out.
# However, you can set this to "NO" if you are running a modern kernel
# and using NTP to synchronize your system clock.
#clock_hctosys="YES"
# If you do not want to set the hardware clock to the current system
# time (software clock) during shutdown, set this to no.
clock_systohc="NO"
# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here. Alpha users may wish to use --arc or --srm here.
clock_args="" |
In kernel I have:
Code: | # CONFIG_RTC_HCTOSYS is not set
# CONFIG_RTC_SYSTOHC is not set |
Perhaps one day I'll make all that a bit more sane. ^^;
I still do have Windows 7 installed which I boot rarely if I need to test something. Nothing like this happened before, however, so something somewhere probably did change recently, since my system time would be off by hours after boot one day (hardware clock remained in the time I had set it to).
I took a quick peek at the recent changes on util-linux, and I did notice this:
Code: | commit bf6199673bbca046ceed59002004eb1c1aebaca1
Author: JWP <elseifthen@gmx.com>
Date: Wed Jan 7 23:15:39 2015 -0500
hwclock: Incorrect UTC defaults
Hwclock's default timescale was changed to UTC in:
commit 7894bf0f08740f75610990a2ba76af7a7cbce61e
Date: Mon Feb 21 13:27:07 2011 +0000
This change was incomplete.
With no /etc/adjtime file the current behavior is:
hwclock --utc --adjust #Creates a UTC file.
hwclock --localtime --adjust #File is not created.
That is the opposite of what UTC default should do.
With this patch the behavior is:
hwclock --utc --adjust #File is not created.
hwclock --localtime --adjust #Creates a LOCAL file.
'Creates a xxxx file' means: An /etc/adjtime file
is created with zero for all parameters except the
Hardware Clock's timescale field, which is set to
the value indicated by xxxx.
The second item missed in the patch was a test in
the save_adjtime() function that defaults to LOCAL.
Theoretically we cannot get to the save function
without having a value set for adjtime.local_utc,
but the test is there so it needs be correct.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-) |
Just some thoughts! _________________ Kindest of regardses. |
|
Back to top |
|
|
ShanaXXII Apprentice
Joined: 29 Jun 2014 Posts: 283 Location: Canada
|
Posted: Sun Mar 29, 2015 1:54 am Post subject: |
|
|
Hello, again. Sorry to bother ): , but I installed Windows and now the time is messing up again. ):
I tried changing /etc/conf.d/hwclock to local but its still fsck everytime.
date gives right time (after adjustment)
hwclock gives wrong time
hwclock --utc gives wrong time
hwclock --localtime gives right time |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Sun Mar 29, 2015 7:07 pm Post subject: |
|
|
In case it helps, have a look at the following HowTo, which covers installations with OpenRC and installations with systemd: Configuring the Linux clock. _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
ShanaXXII Apprentice
Joined: 29 Jun 2014 Posts: 283 Location: Canada
|
Posted: Sun Mar 29, 2015 9:00 pm Post subject: |
|
|
Fitzcarraldo wrote: | In case it helps, have a look at the following HowTo, which covers installations with OpenRC and installations with systemd: Configuring the Linux clock. |
Thanks (: This helped alot |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Sat Oct 03, 2015 4:37 pm Post subject: |
|
|
Fitzcarraldo wrote: | In case it helps, have a look at the following HowTo, which covers installations with OpenRC and installations with systemd: Configuring the Linux clock. |
Thank you very much for your blog. hwclock wouldn't outut anything, but after following your instructions, it just echoes the correct local time. Perhaps now my timed startups will work correctly. |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Sun Oct 04, 2015 10:45 pm Post subject: |
|
|
Tony0945 wrote: | Thank you very much for your blog. hwclock wouldn't outut anything, but after following your instructions, it just echoes the correct local time. Perhaps now my timed startups will work correctly. |
You're very welcome. I'm glad it was of help. _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
|