Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NTP delays boot components
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 858

PostPosted: Sat Jul 05, 2014 2:52 pm    Post subject: Reply with quote

I think what I'm really trying to accomplish here is avoiding ntp-client timing out slowly and delaying boot when my laptop isn't online. Is that something I should just live with?
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2967

PostPosted: Sat Jul 05, 2014 6:56 pm    Post subject: Reply with quote

grant123 wrote:
I think what I'm really trying to accomplish here is avoiding ntp-client timing out slowly and delaying boot when my laptop isn't online. Is that something I should just live with?

grant ... you're probably not aware that openrc supports 'runlevels', and that these runlevels can be started via boot parameters ...

Code:
# rc-update del net.wlan0 default
# rc-update del ntp-client default
# rc-update del <other_network_service> default # 'default' should be without network
# mkdir /etc/runlevels/online
# rc-update -s add default online # 'stack' (-s) default onto online
# rc-update add net.wlan0 online
# rc-update add ntp-client online
# rc-update add <other_network_service> online
# rc online

You can then make menu entires in your bootloader's config to call, 'softlevel=online', 'softlevel=single', etc, or use 'rc <runlevel>' to switch to that particular runlevel ('default' is obviously the 'default' runlevel).

You can also make specific configurations for these runlevels, eg, 'net.wlan0.online' which is for configurng 'wlan0' for the runlevel 'online', you can do similarly for other services.

This is much overlooked feature of openrc, and though documented its rarely mentioned here as a method of providing exactly what you're asking for above. You can have as many runlevels as you want so 'home', 'foo', 'bar', etc, etc, each with there own specific setup.

best ... khay
Back to top
View user's profile Send private message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2981
Location: Hamburg/Germany

PostPosted: Sat Jul 05, 2014 7:36 pm    Post subject: Reply with quote

Pff - an itneresting feature, I wasn't aware of till now, probably I'll paly with it.

Nevertheless I can't resist to mention that this 1 1/2 year old bug prevents any genkernel user from starting a different runlevel than "default" from the grub menu ...
Back to top
View user's profile Send private message
grant123
l33t
l33t


Joined: 23 Mar 2005
Posts: 858

PostPosted: Sun Jul 06, 2014 2:01 pm    Post subject: Reply with quote

khay, how would you use that functionality to provide what I'm looking for? Would you put ntp-client in a special runlevel and skip that runlevel when not online?
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 3833
Location: The Peanut Gallery

PostPosted: Sun Jul 06, 2014 2:21 pm    Post subject: Reply with quote

Quote:
Add ntpd to the default runlevel to have the time synchronized automatically. There is no need to run a client when the service is running. Make sure you are not running ntp-client or ntpdate.

Quote:
If ntpd is run as a service, the time will automatically synchronize as long as the difference between the local time and the time on the server is less than 1000s (~17min).

Hmm that sounds like that'd work on its own if you're not got large differences, though this from bug report was interesting:
jer wrote:
/etc/init.d/ntp-client doesn't keep anything running - it runs ntp-client, which sets the system time once and then exits, leaving the NTP ports free for ntpd (or a different NTP daemon) to take over.
..which makes me think we should start that first.

after ntp-client is in /etc/init.d/ntpd so that makes sense:
Code:
# idepend ntpd
/etc/init.d/ntpd: depend
        use net dns logger
        after ntp-client


Not sure about the delay problem, though the before xdm khayyam mentioned seems like a good idea for the custom script.
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 3833
Location: The Peanut Gallery

PostPosted: Sun Jul 06, 2014 2:41 pm    Post subject: Reply with quote

toralf wrote:
Nevertheless I can't resist to mention that this 1 1/2 year old bug prevents any genkernel user from starting a different runlevel than "default" from the grub menu ...

It doesn't look very hard to fix. Though as stated there's no real point in using 'init 2' as "options to init."

Though is that what you get when you just use "init 2" as the command-line? It would be simple enough to remove init as first option, if you wanted to special-case it:
Code:
strip_init(){
   [ init = "$1" ] || return 0
   shift; init_opts=$*
}
strip_init $init_opts

Note that won't hold up very well with spaces in parameters after an init; I'd need to see what the actual strings you get in the script are. eg with
Code:
printf 'init_opts=@%s@\n' "$init_opts" >&2

One might also want to process every word of $init_opts; again it's easier if we see what we're dealing with. (ie is that a possibility, or is this not the whole cmdline?)
Back to top
View user's profile Send private message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2981
Location: Hamburg/Germany

PostPosted: Sun Jul 06, 2014 3:07 pm    Post subject: Reply with quote

I "fixed" it with :
Code:
tfoerste@n22 ~ $ diff /usr/share/genkernel/defaults/linuxrc.orig /usr/share/genkernel/defaults/linuxrc
941c941
< exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" "${INIT_OPTS}"
---
> exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" $init_opts
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


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

PostPosted: Sun Jul 06, 2014 4:23 pm    Post subject: Reply with quote

I have always run just ntpd and never ntp-client.

The only time I've ever had a long wait for ntp is when the external network is down.

Oh and I always have "-g" set for ntpd.
_________________
Asus m5a99fx, FX 8320 - amd64-multilib, 3.15.9-zen, glibc-2.19, gcc-4.9.2, eudev
xorg-server-1.16, openbox w/lxpanel, nouveau, oss4(2011)
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2967

PostPosted: Sun Jul 06, 2014 6:39 pm    Post subject: Reply with quote

grant123 wrote:
khay, how would you use that functionality to provide what I'm looking for? Would you put ntp-client in a special runlevel and skip that runlevel when not online?

grant ... I showed you exactly how to do it above ... with ntp-client, etc, not in the default runlevel you can boot that when "not online", or boot to the "online" runlevel when needing to be "online". Or, if booted call 'rc <runlevel>' to switch to that runlevel. You don't "skip" a runlevel, the default runlevel just doesn't have any 'net' related services, or 'net' initialisation. To get "online" then you select the "Boot Online" enrtry in the bootloader (after having added 'softlevel=online' to that entries kernel parameters). What wasn't clear in the fairly explicite example I provided?

best ... khay
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 3833
Location: The Peanut Gallery

PostPosted: Mon Jul 07, 2014 3:58 am    Post subject: Reply with quote

toralf wrote:
I "fixed" it with :
Code:
tfoerste@n22 ~ $ diff /usr/share/genkernel/defaults/linuxrc.orig /usr/share/genkernel/defaults/linuxrc
941c941
< exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" "${INIT_OPTS}"
---
> exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" $init_opts

If that deals with the init 2 thing you had in the bug then cool.
Back to top
View user's profile Send private message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2981
Location: Hamburg/Germany

PostPosted: Mon Jul 07, 2014 4:00 pm    Post subject: Reply with quote

steveL wrote:
If that deals with the init 2 thing you had in the bug then cool.
the "fix" is just to ignore the buggy processing of the init options within the genkernel script, b/c "init 2" doesn't contain any "=" to separate ky/values as it is done in genkernel for all other options.
Back to top
View user's profile Send private message
djdunn
l33t
l33t


Joined: 26 Dec 2004
Posts: 719
Location: Arrakis

PostPosted: Mon Jul 07, 2014 4:24 pm    Post subject: Reply with quote

in openrc you can go and edit /etc/init.d/ntp-client from "use net dns logger" remove net from there and add a line above or below it "need net"
_________________
A process cannot be understood by stopping it. Understanding must move with the flow of the process, must join it and flow with it.

-The First Law of Mentat
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
Goto page Previous  1, 2
Page 2 of 2

 
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