Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
no hardware clock, how do I get an early ntpdate?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
jarrett
n00b
n00b


Joined: 09 Jul 2003
Posts: 56
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 02, 2010 11:12 am    Post subject: no hardware clock, how do I get an early ntpdate? Reply with quote

I have a small ARM system without a hardware clock. Every time the system comes up, it runs a full fsck because ntpd starts considerably later in the process.

I understand why this happens and I know how to implement a "dirty hack" to setup networking and set the time using ntpdate prior to the mounting of the filesystems, but I would prefer a "supported" solution of some sort. I looked into the system boot scripts, including the inittab and /sbin/rc and I saw that /etc/conf.d/rc-extra gets sourced early in /sbin/rc, but I don't think that would be a good solution as that would get run every single time /sbin/rc is called, including when it's called with sysinit, boot, single, and even shutdown.

Any suggestions? Is there an official solution? Should I just shut up and just deal with a dirty hack? :?
_________________
Jarrett Lee

I used to have company and title here, but I can't do that any more... I guess that's what I get for selling out to an evil corporation. ;)
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 251
Location: Germany

PostPosted: Thu Sep 02, 2010 12:25 pm    Post subject: Reply with quote

Another approach to skip the fsck'ing would be to disable inveral-checks on your filesystem(s):
Code:
tune2fs -i0 /dev/<device-your-fs-is-on>

Regular fscks would still be performed when max-mount-counts is reached.
Back to top
View user's profile Send private message
jarrett
n00b
n00b


Joined: 09 Jul 2003
Posts: 56
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 02, 2010 12:57 pm    Post subject: Reply with quote

I'm dumbfounded. Literally. I cannot believe I didn't think of that. :oops:

I seem to remember there being other issues with the time not being set, so I'm still open to ideas for a way to set time early in the boot process.
_________________
Jarrett Lee

I used to have company and title here, but I can't do that any more... I guess that's what I get for selling out to an evil corporation. ;)
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 251
Location: Germany

PostPosted: Thu Sep 02, 2010 1:19 pm    Post subject: Reply with quote

Hmm, I don't know if write access to root is neccessary to start up networking and ntpdate, but if it isn't it shouldn't be so hard to start ntp-client and net.XX before fsck. Just adding ntp-client to depend() in /etc/init.d/fsck. If you need write access, it gets trickier, because you would have to mount root rw before it is fsck'ed, which is not very safe on the one hand, and which would need to be remounted ro before fsck, which would get us back to "dirty hack".

Have you thought of building an initrd that takes care of starting up the network and runs ntp-client? In an initrd you wouldn't need to have mounted any fs (except /proc and /sys maybe) to get a working environment to start ntp-date before fsck and before anything else that could get messed up with wrong clock settings.
Back to top
View user's profile Send private message
jarrett
n00b
n00b


Joined: 09 Jul 2003
Posts: 56
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 02, 2010 1:47 pm    Post subject: Reply with quote

rw access to root isn't necessary for ntpdate. My previously mentioned dirty hack was to add an ifconfig line, a route add line, and an ntpdate line to the udev script in init.d, but I'm worried that doing that I'll end up forgetting about it later, updating udev, and overwriting my additions to a script that never should have had user modifications in it anyway!


(Edited for clarification.)
_________________
Jarrett Lee

I used to have company and title here, but I can't do that any more... I guess that's what I get for selling out to an evil corporation. ;)
Back to top
View user's profile Send private message
Kompi
Apprentice
Apprentice


Joined: 05 Oct 2002
Posts: 251
Location: Germany

PostPosted: Thu Sep 02, 2010 1:55 pm    Post subject: Reply with quote

You could also write your own init.d-script, say "/etc/init.d/early-ntpd" that does the same thing. You could add "need udev" and "before fsck" (maybe even: provide net) or something as dependency and add it to the boot runlevel. That would be a more clean way without the risk of beein overwritten by any update. Would not be exactly a "native" solution but quite clean.
Back to top
View user's profile Send private message
jarrett
n00b
n00b


Joined: 09 Jul 2003
Posts: 56
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 02, 2010 2:01 pm    Post subject: Reply with quote

I was actually just looking for documentation on how to write init scripts in Gentoo, but I haven't found anything yet. Then again, I've only been looking for about 5 minutes... I'll find the documentation I need soon and will share the results for others who have either no hardware clock or have one that's broken or has a dead battery.
_________________
Jarrett Lee

I used to have company and title here, but I can't do that any more... I guess that's what I get for selling out to an evil corporation. ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures 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