Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"clock skew" , openrc cache file, and boot time
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Mon Oct 15, 2018 11:34 am    Post subject: "clock skew" , openrc cache file, and boot time Reply with quote

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
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Mon Oct 15, 2018 3:47 pm    Post subject: Reply with quote

Have a read of this thread: https://forums.gentoo.org/viewtopic-t-1073968-postdays-0-postorder-asc-start-0.html?sid=b9e55fa2af27b5f5b8d6b15a68a2ec24

its either a locale issue (bios saved time and the local OS time) or something else.
Try going through this thread to at least rule out a mismatch in locale
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Mon Oct 15, 2018 4:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Oct 15, 2018 5:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
Super tux
n00b
n00b


Joined: 11 Oct 2018
Posts: 9

PostPosted: Mon Oct 15, 2018 8:05 pm    Post subject: Reply with quote

To fix clockskew issue
$ cd /
$ touch currtime
$ find . -cnewer /currtime -exec touch {} \;

If you want to read what it does http://www.cydeweys.com/blog/2007/08/27/fixing-clock-skew-problems-in-gnulinux/
You can set date then $ hwclock --systohc
To sync the sytem clock to bios.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Mon Oct 15, 2018 8:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Super tux
n00b
n00b


Joined: 11 Oct 2018
Posts: 9

PostPosted: Mon Oct 15, 2018 8:21 pm    Post subject: Reply with quote

I think it sets it, and does not change value, beside counting seconds.
Back to top
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Tue Oct 16, 2018 5:52 am    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Oct 16, 2018 10:19 am    Post subject: Re: "clock skew" results in higher boot time Reply with quote

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.

ranran wrote:
https://pasteboard.co/HIyx21m.jpg

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
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Tue Oct 16, 2018 10:51 am    Post subject: Reply with quote

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. :roll:
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" :lol:
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Wed Oct 17, 2018 11:55 am    Post subject: Reply with quote

Hi,

Sorry for the confusion. I changed the subject to make it clearer.
Thanks for all comments , and the jokes :)

Ranran
Back to top
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Wed Oct 17, 2018 12:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Oct 17, 2018 12:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Thu Oct 18, 2018 8:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21600

PostPosted: Fri Oct 19, 2018 1:43 am    Post subject: Reply with quote

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
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Fri Oct 19, 2018 5:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Oct 20, 2018 6:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum