View previous topic :: View next topic |
Author |
Message |
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Mon Oct 22, 2018 8:26 am Post subject: [solved]network services not started when using DHCPD+OpenRC |
|
|
Hi!
I use DHCPCD as main network manager with OpenRC, but I see some network service don't start automatically at boot : ntp-client (from net-misc/ntp) ("Temporary failure in name resolution") and samba ("start-stop-daemon: failed to start `/usr/sbin/smbd'", kinda a crash).
I use parallel startup (RC_PARALLEL=YES).
If I disable parallel startup (RC_PARALLEL=NO), samba starts, but still not ntp-client.
DHCPCD is started at boot runlevel, the other network services at default runlevel.
I have to start them manually.
What can I do to let them natively start?
EDIT: solution is : set dhcpcd at boot runlevel, and put "waitip" in /etc/dhcpcd.conf _________________ Kind regards,
Xavier Miller
Last edited by xaviermiller on Wed Oct 24, 2018 7:01 pm; edited 1 time in total |
|
Back to top |
|
|
Suicidal l33t
Joined: 30 Jul 2003 Posts: 959 Location: /dev/null
|
Posted: Wed Oct 24, 2018 2:18 am Post subject: |
|
|
You could try adding your network adapter to the boot runlevel to give it more time to initialize
before network dependent services start. I know my Wireless takes about 10 seconds after login
before I have a IP, so I just dont use ntp-client.
Once the time is set, ntpd should keep it within a few ms of the servers. |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Wed Oct 24, 2018 9:40 am Post subject: |
|
|
Yeah, you need to leave some time between the network adapter being turned on/modules loaded/etc and the starting up of dhcpcd and then a little more time between that and something like ntp starting up. I know it kind of defeats the purpose of parallel, but .... _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Wed Oct 24, 2018 9:59 am Post subject: |
|
|
Same answer as Anon-E-moose: ntp-client is called after net, it doesn't garanty net has setup the network fine when ntp-client is called.
You may delegate the run of ntp-client and other to another initscript that do nothing except looping ping -c1 8.8.8.8 and once it have an answer trigger ntp-client and friends. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Oct 24, 2018 10:36 am Post subject: |
|
|
krinn wrote: | You may delegate the run of ntp-client and other to another initscript that do nothing except looping ping -c1 8.8.8.8 and once it have an answer trigger ntp-client and friends. |
krinn ... all you need do is check if the network is routable:
Code: | #!/bin/sh
set -e
timeout="15"
while { [ $timeout -gt 0 ] && [ -z "$(ip route show 0.0.0.0/0)" ]; } ; do
sleep 1
: $(( timeout -= 1 ))
done
if [ $timeout -eq 0 ] ; then
echo "do something here"
else
/etc/init.d/ntp-client start
fi |
... or something like that.
best ... khay |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Wed Oct 24, 2018 10:56 am Post subject: |
|
|
once "ip route show default" gives you a valid ip then you're good to go with net-client, samba, etc.
I would imagine a one second delay after dhcpd would be plenty of time or move their startup to /etc/local.d/baselayout1.start
I have a usb drive that (most of the time) was starting normally, but once in a while it would't start up, so I turned of auto mount for it and added the mount command to /etc/local.d _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5934
|
Posted: Wed Oct 24, 2018 10:58 am Post subject: |
|
|
are you using /etc/init.d/dhcpcd or /etc/init.d/net.* ? if you're using the dhcpcd init script, i'd try net.* instead with a /etc/conf.d/net containing Code: | config_eth0="dhcpcd" |
_________________
Neddyseagoon wrote: | The problem with leaving is that you can only do it once and it reduces your influence. |
banned from #gentoo since sept 2017 |
|
Back to top |
|
|
P.Kosunen Guru
Joined: 21 Nov 2005 Posts: 309 Location: Finland
|
Posted: Wed Oct 24, 2018 11:13 am Post subject: |
|
|
Put "waitip" option to dhcpcd.conf and it waits until it gets ip before starting other services depending network. |
|
Back to top |
|
|
Suicidal l33t
Joined: 30 Jul 2003 Posts: 959 Location: /dev/null
|
Posted: Wed Oct 24, 2018 12:20 pm Post subject: |
|
|
There’s also the timeout value in ntpdate, but if you’re willing to do that; there’s no sanity in setting RC_PARALLEL.
Code: | -t timeout
Specify the maximum time waiting for a server response as the. value timeout, in seconds and fraction. The value is rounded to a multiple of 0.2 seconds. The default is 1 second, a valuesuitable for polling across a LAN. |
|
|
Back to top |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Wed Oct 24, 2018 6:49 pm Post subject: |
|
|
Hi,
Thank you all for your replies !
bunder wrote: | are you using /etc/init.d/dhcpcd or /etc/init.d/net.* ? if you're using the dhcpcd init script, i'd try net.* instead with a /etc/conf.d/net containing Code: | config_eth0="dhcpcd" |
|
Yes, I was using dhcpcd and not net.* scripts
P.Kosunen wrote: | Put "waitip" option to dhcpcd.conf and it waits until it gets ip before starting other services depending network. |
This fix works for me ! + setting dhcpcd at boot level, and the network related services in the default runlevel
Thanks _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
|