LesniakM
Posts: 3
Joined: Wed Aug 07, 2019 11:20 am

DHCP service during boot

Wed Aug 07, 2019 11:29 am

Hello there,

I'm quite new in Raspi and currently I'm heading to make headless, fast booting board with python app to controll some GPIO trough WiFi.

I'm using Rasbian Lite and I've already did some improvements to boot time and it currently takes from 10 do 15 seconds. However, the longest starting service is DHCP, when I've disabling this service, boot took me only 5 seconds, what is very satysfaing for me. Anyway, just disabling DHCP cuts off wifi, so it's not suitable solution for me.

Is there any way to speed up boot without disabling DHCP? Or maybe it is possible to start DHCP process and not waiting with whole boot to establish connection? That would be really helpful, beacuse my app need some time anyway, so it would be really cool to have working app and dhcp service making his owm job in background instead of freezing whole Pi. Static IP address doesn't help to much.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: DHCP service during boot

Thu Aug 08, 2019 9:55 am

I believe WiFi authentication takes more time than the subsequent DHCP lease negotiation, in the nominal case.

The Raspbian/Debian init system, systemd, starts tasks in parallel at boot. There is no pre-specified order, but there are predefined “targets” that represent stages in the state of the machine. Network-online.target is one of them. You can add targets of your own.
Tasks are described in “unit” files, the file describes before or after which target the task shall run.

To make boot duration independent of networking state I would try the simplest first, and make sure “wait for network” is deselected in raspi-config.
If that isn’t enough, by analyzing the boot order “systemd-analyze” and modifying unit files “systemctl edit” you should be able to alter the standard boot behavior.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Beginners”