View previous topic :: View next topic |
Author |
Message |
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Sat Jul 05, 2014 2:52 pm Post subject: |
|
|
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 |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sat Jul 05, 2014 6:56 pm Post subject: |
|
|
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 |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3921 Location: Hamburg
|
Posted: Sat Jul 05, 2014 7:36 pm Post subject: |
|
|
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 |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Sun Jul 06, 2014 2:01 pm Post subject: |
|
|
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 |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun Jul 06, 2014 2:21 pm Post subject: |
|
|
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 |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun Jul 06, 2014 2:41 pm Post subject: |
|
|
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 |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3921 Location: Hamburg
|
Posted: Sun Jul 06, 2014 3:07 pm Post subject: |
|
|
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 |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6095 Location: Dallas area
|
Posted: Sun Jul 06, 2014 4:23 pm Post subject: |
|
|
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. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sun Jul 06, 2014 6:39 pm Post subject: |
|
|
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 |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Mon Jul 07, 2014 3:58 am Post subject: |
|
|
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 |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3921 Location: Hamburg
|
Posted: Mon Jul 07, 2014 4:00 pm Post subject: |
|
|
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 |
|
|
djdunn l33t
Joined: 26 Dec 2004 Posts: 810
|
Posted: Mon Jul 07, 2014 4:24 pm Post subject: |
|
|
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" _________________ “Music is a moral law. It gives a soul to the Universe, wings to the mind, flight to the imagination, a charm to sadness, gaiety and life to everything. It is the essence of order, and leads to all that is good and just and beautiful.”
― Plato |
|
Back to top |
|
|
|