Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]network services not started when using DHCPD+OpenRC
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8708
Location: ~Brussels - Belgique

PostPosted: Mon Oct 22, 2018 8:26 am    Post subject: [solved]network services not started when using DHCPD+OpenRC Reply with quote

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


Joined: 30 Jul 2003
Posts: 959
Location: /dev/null

PostPosted: Wed Oct 24, 2018 2:18 am    Post subject: Reply with quote

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


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

PostPosted: Wed Oct 24, 2018 9:40 am    Post subject: Reply with quote

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


Joined: 02 May 2003
Posts: 7470

PostPosted: Wed Oct 24, 2018 9:59 am    Post subject: Reply with quote

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


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

PostPosted: Wed Oct 24, 2018 10:36 am    Post subject: Reply with quote

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


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

PostPosted: Wed Oct 24, 2018 10:56 am    Post subject: Reply with quote

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


Joined: 10 Apr 2004
Posts: 5934

PostPosted: Wed Oct 24, 2018 10:58 am    Post subject: Reply with quote

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


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Wed Oct 24, 2018 11:13 am    Post subject: Reply with quote

Put "waitip" option to dhcpcd.conf and it waits until it gets ip before starting other services depending network.
Back to top
View user's profile Send private message
Suicidal
l33t
l33t


Joined: 30 Jul 2003
Posts: 959
Location: /dev/null

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

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


Joined: 23 Jul 2004
Posts: 8708
Location: ~Brussels - Belgique

PostPosted: Wed Oct 24, 2018 6:49 pm    Post subject: Reply with quote

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 8)
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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