View previous topic :: View next topic |
Author |
Message |
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Mon Oct 15, 2018 11:34 am Post subject: "clock skew" , openrc cache file, and boot time |
|
|
Hello,
Whenever I disconnect RTC battry I get several warnings about "Clock skew":
Quote: | Clock skew detected with `/etc/init.d'
Adjusting mtime of `/run/openrc/deptree' to Mon Oct 15 12:45:57 2018
|
You can also see here:
https://pasteboard.co/HIyx21m.jpg
The reason for the warning is understood (hwclock did not save its value becuase of battery removal).
Yet, I noticed that the boot time changed from ~8 sec to ~14 sec , whenever it happens.
Is there a way to overcome this slow performance because of clock skew.
Thank you,
ranran
Last edited by ranran on Wed Oct 17, 2018 12:02 pm; edited 2 times in total |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Mon Oct 15, 2018 4:29 pm Post subject: |
|
|
Thanks.
The warning is reasonable(, I don't use ntp or ethernet) so I do not think the local will help, Right?
The issue is that this messages or something related that is done in openrc when it has clock skew results in 6 seconds in boot.
I wanted to avoid it if possible. |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Mon Oct 15, 2018 5:51 pm Post subject: |
|
|
openrc generate a cache file for its deptree structure, allowing openrc to just open the file and reuse the stored structure.
with clock skew the comparaison done by openrc on that file date/time with current time is no more reliable, and you have delay while openrc generate the file content to know the tree service dependency.
I wonder (for curisosity) why you do that, i mean what is the reason you disconnect your rtc battery? (as the only "valid" reason i have in mind is forcing a bios reset, but nearly all m/b have a switch to clear it) |
|
Back to top |
|
|
Super tux n00b
Joined: 11 Oct 2018 Posts: 9
|
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6097 Location: Dallas area
|
Posted: Mon Oct 15, 2018 8:12 pm Post subject: |
|
|
Does the /etc/adjtime file have a skew adjustment in it?
Are you saving system time to hwclock when you shutdown? _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
Super tux n00b
Joined: 11 Oct 2018 Posts: 9
|
Posted: Mon Oct 15, 2018 8:21 pm Post subject: |
|
|
I think it sets it, and does not change value, beside counting seconds. |
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Tue Oct 16, 2018 5:52 am Post subject: |
|
|
Hi,
As long as the battery is connected, than there is no issue.
The "clock skew" happens in case I disconnect the battery,
I use the hwclock in openrc (not in kernel).
I left the configuration as-is (default), hwclock is in openrc "boot" , and as I understand the default openrc configuration (I did not make any changes in config file) take care that system clock is saved into hwclock in sutdown and viceversa in boot.
It seems that all this works perfect. But in case of disconnecting battery there is "clock skew" issue.
I would not mind about these warnings, the only thing is that it "eats" 5 seconds in boot for some reason.
It happens only in first boot (after rtc disconnection and connection), so we might ignore it. Yet, I wander if it is possible to fix that too .
Thanks |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Tue Oct 16, 2018 10:19 am Post subject: Re: "clock skew" results in higher boot time |
|
|
ranran wrote: | Whenever I disconnect RTC battry I get several warnings about "Clock skew": |
ranran ... if you remove the CMOS battery then the time is lost, on replacing the battery you will need to go into the bios and reset the time to current time. Not doing that will result in a clock skew. The best thing to do in this case is not to remove the battery ... unless in need of replacement.
Please, unless absolutely unavoidable, post text, or a link to text (ie, pastbin).
ranran wrote: | The reason for the warning is understood (hwclock did not save its value becuase of battery removal). |
No, hwclock did as it was supposed to do, but you removed the battery subsequent to it saving the time to the CMOS, and so it's lost.
ranran wrote: | Yet, I noticed that the boot time changed from ~8 sec to ~14 sec , whenever it happens. |
Yes, as krinn noted, openrc needs to regenerate its cache due to the clock skew ... you can do this manually with 'rc-update -u' ... which you would need to do if you set the time after that reboot ... because your CMOS clock will be set to some time in 1970, as will openrc's cache.
ranran wrote: | Is there a way to overcome this slow performance because of clock skew. |
Don't create the conditions for the clock skew by removing the CMOS battery.
super tux wrote: | To fix clockskew issue
$ cd /
$ touch currtime
$ find . -cnewer /currtime -exec touch {} \; |
Best not, each package installed file has a timestamp, and md5sum, that are used to verify files (ie, with 'equery check'):
Code: | # cat /var/db/pkg/app-admin/ccze-0.2.1-r3/BUILD_TIME
1481288036
# tail -n 1 /var/db/pkg/app-admin/ccze-0.2.1-r3/CONTENTS
obj /usr/bin/ccze-cssdump a61b05d0ef9a9465e542270a4c0b451f 1481288036 |
If you touch, and so reset file creation time to the hwclock, then you loose the ability to verify, and every package will show as 'failed'. Also, if the time in CMOS is 1970 then you'll be setting the file creation time to that date.
Anon-E-Mouse wrote: | Does the /etc/adjtime file have a skew adjustment in it? |
That is just an adjustment for 'drift', if the battery is removed then there is a seismic shift beyond what --adjtime can correct.
best ... khay |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6097 Location: Dallas area
|
Posted: Tue Oct 16, 2018 10:51 am Post subject: |
|
|
I didn't pay attention to the fact that he was removing the cmos battery.
Why would anyone do that, well other than to put a new one in.
If doing it repeatedly, then why start a thread about "the problem"?
Reminds me of the old joke, "doctor, doctor, it hurts when I do this" _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Wed Oct 17, 2018 11:55 am Post subject: |
|
|
Hi,
Sorry for the confusion. I changed the subject to make it clearer.
Thanks for all comments , and the jokes
Ranran |
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Wed Oct 17, 2018 12:00 pm Post subject: |
|
|
Thanks, I got it now. somehow I missed krin explanation above...
"
openrc generate a cache file for its deptree structure, allowing openrc to just open the file and reuse the stored structure.
with clock skew the comparaison done by openrc on that file date/time with current time is no more reliable, and you have delay while openrc generate the file content to know the tree service dependency. "
And it's not avoidable.
Got it! |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Oct 17, 2018 12:20 pm Post subject: |
|
|
ranran wrote: | And it's not avoidable. |
ranran ... it is, don't remove the CMOS battery, or if you do then on booting go into the bios, select "data and time", and set the date/time.
best ... khay |
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Thu Oct 18, 2018 8:33 pm Post subject: |
|
|
Hi,
One more and final on this...
I've found out that in our final board there will be no battery,
We update rtc only after startup (using gps).
Now, I understand from this thread, that we can't overcome the cache files, and the higher boot time in such case.
Thank you all again.
Ranran |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21600
|
Posted: Fri Oct 19, 2018 1:43 am Post subject: |
|
|
You can overcome the issue if you arrange for the clock to be right before you start openrc. What are you doing that you are embedding a general purpose Linux on such a stripped down motherboard? |
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Fri Oct 19, 2018 5:22 am Post subject: |
|
|
Hi
Sort of mobile handler.
We use the same linux for both operation and development.
I dont think I can update rtc right at the start of linux because application need to start, read gps, and only then can update rtc.
Thanks |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Oct 20, 2018 6:53 pm Post subject: |
|
|
If you have a standard GPS device connected over serial you could use the PPS time signal to set the clock in early inittab. But this is all speculative. |
|
Back to top |
|
|
|