You are not logged in.

#1 2019-12-01 16:07:27

PeterJansen
Member
Registered: 2019-12-01
Posts: 8

dhcpcd - slow startup - I would like some explanation

I recently installed Arch for the first time (on real hardware, I tried it out in a VM first) and it all went well but I had one issue, dhcpcd took 9-10 seconds to start. I read the Archwiki and I followed the instructions and the problem is solved. Great but I don't understand what exactly was the problem and why this solved the slow boot-up time. The explanation on the Archwiki:

By default the dhcpcd@.service waits to get an IP address before forking into the background via the -w flag for dhcpcd. If the unit is enabled, this may cause the boot to wait for an IP address before continuing. To fix this, create a drop-in file for the unit with the following:

/etc/systemd/system/dhcpcd@.service.d/no-wait.conf

[Service]
ExecStart=
ExecStart=/usr/bin/dhcpcd -b -q %I

Is the slow boot caused because it takes a long time before my system gets the IP-address? If so, is this normal? I have a good router (new technology) from the ISP and the IP-address is static. I wouldn't expect that getting the IP-address would take a long time.

I don't understand what the word "unit" (dhcpcd, network-interface...?) refers to and I don't understand what the "%I" does. As I understand it this little file tells dhcpcd to start up with these flags but I couldn't find any information with "man dhcpcd" about the %I-flag. Could somebody please explain this to me or refer me to webpage which does explain it?

Offline

#2 2019-12-01 16:11:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: dhcpcd - slow startup - I would like some explanation

PeterJansen wrote:

Is the slow boot caused because it takes a long time before my system gets the IP-address?

Yes.

PeterJansen wrote:

If so, is this normal?

It's not unusual.

PeterJansen wrote:

I don't understand what the word "unit" ... and I don't understand what the "%I" does.

read `man systemd.unit`, the %I flag is not passed as is to dhcpcd, it is a placeholder that is filled in by systemd before executing the command in the ExecStart line.

Last edited by Trilby (2019-12-01 16:14:23)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-12-01 16:29:54

seth
Member
Registered: 2012-09-03
Posts: 49,982

Re: dhcpcd - slow startup - I would like some explanation

I have a good router … from the ISP

Such thing doesn't exist.

and the IP-address is static

If you use a static IP, why do you use a dhcp client at all?

Is this a wired or a WiFi connection?
Try to stop the dhcpcd service and run dhcpcd after the boot, the issue might be that the NIC isn't up for business when dhcpcd starts - check the journal.

Another common issue is crng, ie. the entropy pool. See https://wiki.archlinux.org/index.php/Haveged

Offline

#4 2019-12-02 00:43:59

PeterJansen
Member
Registered: 2019-12-01
Posts: 8

Re: dhcpcd - slow startup - I would like some explanation

seth wrote:

I have a good router … from the ISP

 
If you use a static IP, why do you use a dhcp client at all?

Frankly, because dhcpcd is the only one which I know because this is the network-service mentioned on the install page of Archwiki, Should I have gone for another network-service?
I mostly use a wired connection (desktop), almost exclusively but I might occasionally use Wifi for a laptop. Can I use journalctl to see the boot-log? I remember that there is some file (etc-folder?) which has the log of the last boot but I can't remember the path. 

I know about entropy and haveged, I actually used that in the past because from one day to another my boot-time for Manjaro increased by 10 seconds. The lack of entropy was the problem back then (<1000 with an OEM-motherboard and an i5-750, now 3842), Haveged solved the issue. smile
I like Manjaro but the Snap-support (Snap was used for KDE and that gave some small issues) made me try pure Arch out. So far it goes well except for some minor issues which I need to solve (Yakuake which doesn't remember profile-settings and the lack of GRUB-theming). I even upgraded the kernel to 5.4.

Last edited by PeterJansen (2019-12-02 00:51:59)

Offline

#5 2019-12-02 00:58:56

loqs
Member
Registered: 2014-03-06
Posts: 17,195

Re: dhcpcd - slow startup - I would like some explanation

See Dhcpcd#Static_profile for a static IP with dhcpcd.
See Systemd/Journal for the boot log.

Offline

#6 2019-12-08 21:59:12

rowhammer
Member
Registered: 2019-12-05
Posts: 16

Re: dhcpcd - slow startup - I would like some explanation

Hi Peter, thanks for posting this thread. I had the same question.

For an explanation of the -b and -q options, see here: https://www.daemon-systems.org/man/dhcpcd.8.html .

Offline

Board footer

Powered by FluxBB