Fedora Linux Support Community & Resources Center
  #1  
Old 10th April 2012, 09:22 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxfirefox
Automatically set the RTC

Hi all,

I've got Fedora 16 on a laptop - I've read that Linux purposefully doesn't set the RTC because of some dualbooting setups. The problem is that because of this, when I am not connected to the network (I enabled network time syncing during setup), during summer time the clock is incorrect. How do I enable the setting of the RTC by linux in order that I do not have this issue?

Kind regards,

Yax
Reply With Quote
  #2  
Old 10th April 2012, 10:32 PM
Gareth Jones Offline
Official Gnome 3 Sales Rep. (and Adminstrator)
 
Join Date: Jul 2011
Location: Leamington Spa, UK
Age: 31
Posts: 2,750
linuxfirefox
Re: Automatically set the RTC

EDIT: I think I may have misunderstood your question! As for how to save the time on shutdown, I'll have a look, but I'm not familiar with the new systemd way of doing things.

For my attempt at an explanation of the relationship between Linux and the hardware clock, see http://forums.fedoraforum.org/showpo...41&postcount=8.

To change the settings, run system-config-date. Make sure that your hardware clock is set correctly too – i.e. if "System clock uses UTC" is checked, as is best unless you dual-boot with Windows, then the BIOS clock must be set to UTC, otherwise set it to local time. You might want to enable network time too.

Last edited by Gareth Jones; 10th April 2012 at 10:38 PM.
Reply With Quote
  #3  
Old 11th April 2012, 02:13 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxfirefox
Re: Automatically set the RTC

Actually, although you misunderstood, your comments were useful. I'd read somewhere that the NTP Daemon sets the RTC, but I somewhat glossed over it - when you mentioned network time I checked to see if my system was running ntpd. Nope.

Checked with systemctl --all, and it had errored / not loaded. ntpd is not installed - i don't know how my system time was being updated when I had a network connection, but it was. yum install ntp fixed the issue and now my system time is correct regardless of whether I have a network connection or not.

Cheers for the help.

Yax
Reply With Quote
  #4  
Old 11th April 2012, 06:43 PM
Gareth Jones Offline
Official Gnome 3 Sales Rep. (and Adminstrator)
 
Join Date: Jul 2011
Location: Leamington Spa, UK
Age: 31
Posts: 2,750
linuxfirefox
Re: Automatically set the RTC

I think F16 switched from NTPD to Chrony as the default network time client. I'm not sure of the rationale, or whether switching back to NTPD is likely to cause problems; just something to beware of by way of explanation.
Reply With Quote
  #5  
Old 11th April 2012, 10:30 PM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 5,997
linuxfirefox
Re: Automatically set the RTC

chrony is a bit better at dealing with sporadic network connections. ntp has a maximum error limit of 1000 secs, if the RTC was off more than that, ntpd gives up and exit. The way past that was to use
the ntpd -g option or ntpdate like mentioned below. I'm not sure if chrony has a default max limit, I don't see mention of it in the man page.

I think Fedora 16 uses ntpdate.service to do a 'one shot' setting of the clock at boot up. That's to take care of the clock being wildly off like months/days/hours (maybe you replaced the bios battery so the clock is way off)
then chronyd.service runs and keeps it accurate.

Last edited by marko; 11th April 2012 at 10:36 PM.
Reply With Quote
  #6  
Old 11th April 2012, 11:58 PM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
windows_7firefox
Re: Automatically set the RTC

Well chronyd was not updating the RTC, only the system time, so whenever I booted up without a network connection, I saw the time as if summer time had not been applied.

I'll have a look to see if I can get chrony to update the RTC.
Reply With Quote
  #7  
Old 12th April 2012, 12:18 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 5,997
linuxfirefox
Re: Automatically set the RTC

Maybe you make sure you've got the ntpdate.service activated via systemctl and then go in /etc/sysconfig/ntpdate and set SYNC_HWCLOCK to yes like this (quoting the file ):

Quote:
# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=yes
I have SYNC_HWCLOCK set "no" but the command
Quote:
hwclock --show
shows my RTC clock is set, so I'm not sure why mine is updated, I do have the time-sync.target so maybe that does it?

See also this BUG -- https://bugzilla.redhat.com/show_bug.cgi?id=753487

Last edited by marko; 12th April 2012 at 12:25 AM. Reason: added bugzilla report url
Reply With Quote
  #8  
Old 12th April 2012, 04:43 AM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,696
linuxfirefox
Re: Automatically set the RTC

Quote:
Originally Posted by marko View Post
chrony is a bit better at dealing with sporadic network connections. ntp has a maximum error limit of 1000 secs, if the RTC was off more than that, ntpd gives up and exit.
The ntp protocol is quite complex, but yes if the ntp derived time (after sync'ing with multiple (3 min) servers) duesn't match the system time (aka kernel time) within 1000 seconds, then ntp refuses to set the HWclock (which is not the system clock). So the 1000 second error from system time requires manual intervetion but this prevents setting the hwclock with a grossly bad time without human intervention - that's very reasonably behavior.

It does not just quit or exit. For any amount of error between ntp time and system time - then ntp slowly drifts to clock toward the correct value. ntp also keeps statisticis about the variability of it's own time estimates based on ntp server data and estimates of packet delay - then then it ceases to tweak the system time very much when the system time matches 'within the noise'.



Quote:
Originally Posted by marko View Post
Maybe you make sure you've got the ntpdate.service activated via systemctl and then go in /etc/sysconfig/ntpdate and set SYNC_HWCLOCK to yes like this (quoting the file ):
SYNC_HWCLOCK=yes
DO NOT do that if you use chrony. the documentation makes clear that chrony leaves a setting and drift file behind and it uses that at boot to correct system time from the hwclock value. detail here ...
http://chrony.tuxfamily.org/FAQ.html#question_9.1

Also note that in F16 that chrony is setup to set the hwclock every 11 minutes by default.
See the rtcsync parameter
/usr/share/doc/chrony-1.26/chrony.txt

In /etc/chrony.conf we have
Code:
# Enable kernel RTC synchronization.
rtcsync
The documentation is ....
Quote:
The `rtcsync' directive will enable a kernel mode where the system time
is copied to the real time clock (RTC) every 11 minutes.

This directive is supported only on Linux and cannot be used when the
normal RTC tracking is enabled, i.e. when the `rtcfile' directive is
used.

Quote:
Originally Posted by yaxattax View Post
Hi all,

I've got Fedora 16 on a laptop - I've read that Linux purposefully doesn't set the RTC because of some dualbooting setups.
That's not quite true. Sometime ther is an option to NOT set the HWclock (usually outsude of chrony/ntp) , but the default a have generally been to set it. F16 does not reset the rtc(hwclock) in scripts but does set it from chrony.



Quote:
The problem is that because of this, when I am not connected to the network (I enabled network time syncing during setup), during summer time the clock is incorrect. How do I enable the setting of the RTC by linux in order that I do not have this issue?
Why only summer ? Is the error close to 1 hour - as in failure to set daylight saving time ?

i suggest you post the output of .....
Code:
[root@lycoperdon stevea]# date ; date -u; TZ=0 hwclock 
Wed Apr 11 23:26:53 EDT 2012
Thu Apr 12 03:26:53 UTC 2012
Thu 12 Apr 2012 03:26:54 AM   -0.219197 seconds
Then verify the local time and UTC times are correct. Compare to ....
http://www.time.gov/timezone.cgi?UTC/s/0/java


==========

Quote:
Well chronyd was not updating the RTC, only the system time, so whenever I booted up without a network connection, I saw the time as if summer time had not been applied.
That sort of one-hour error has to do with an incorrect Time-zone setting (and maybe a correcsponding RTC setting error) and not a problem with chrony or system time.

The time zone value is in /etc/adjtime and you should only edit that file using the clock utility on the top panel clock - click it, select edit .. and find some place in your TZ.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #9  
Old 12th April 2012, 08:24 AM
Doug G Offline
Registered User
 
Join Date: Jul 2005
Posts: 640
linuxfirefox
Re: Automatically set the RTC

On a recent fresh un-tweaked f16 dvd install ntp & ntpdate aren't even installed.

Quote:
I think Fedora 16 uses ntpdate.service to do a 'one shot' setting of the clock at boot up. That's to take care of the clock being wildly off like months/days/hours (maybe you replaced the bios battery so the clock is way off)
__________________
======
Doug G
======
Reply With Quote
  #10  
Old 12th April 2012, 08:29 AM
yaxattax Offline
Registered User
 
Join Date: Dec 2011
Posts: 60
linuxfirefox
Re: Automatically set the RTC

Code:
[root@yaxattax-vse:~]$ date ; date -u; TZ=0 hwclock
Thu Apr 12 08:12:05 BST 2012
Thu Apr 12 07:12:05 UTC 2012
Thu 12 Apr 2012 07:12:06 AM   -0.532218 seconds
[root@yaxattax-vse:~]$
Code:
[root@yaxattax-vse:~]$ cat /etc/adjtime 
0.004817 1334214476 0.000000
1334214476
UTC
[root@yaxattax-vse:~]$
Quote:
Why only summer ? Is the error close to 1 hour - as in failure to set daylight saving time ?
The error was one hour. The problem is not reproducible now - after I set

Code:
systemctl enable ntpd.service
and rebooted the system, even now when I have disabled the ntp daemon, I no longer observe the issue where the system time is incorrect when I have no network connection after a reboot.

My TZ settings were correct - I had "System clock uses UTC" and my TZ set as London. Do you have any idea as to why Summer time was not being correctly applied before I used the ntpd?
Reply With Quote
Reply

Tags
automatically, rtc, set

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I log in automatically, imksa Using Fedora 3 13th April 2009 12:59 PM
Anyone getting updates automatically? SlowJet Alpha, Beta & Snapshots Discussions (Fedora 10 Only) 3 6th November 2008 10:29 AM
X doesn't run automatically :( nutter426 Using Fedora 2 25th January 2008 10:19 AM
Run fsck automatically steve941 Using Fedora 1 14th July 2005 11:31 PM
Can yum run automatically ? mha Using Fedora 6 5th March 2005 04:22 AM


Current GMT-time: 10:11 (Friday, 25-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat