dhcpcd needs 12 seconds to boot

Because I want to re-purpose my my Banana Pi, I switched to an old Raspberry Pi 1 as UPnP renderer for the stereo system in the living room.

Since most of the day the power strip is switched off, I wanted the Raspberry Pi to boot as fast as possible - so that we don't have to wait for too long to be able to use it after powering on.

I used systemd-analyze to check what slows down the boot, and saw:

$ systemd-analyze
Startup finished in 3.143s (kernel) + 1min 31.686s (userspace) = 1min 34.830s

$ systemd-analyze blame
         12.246s dhcpcd.service
          6.185s dev-mmcblk0p2.device
          3.501s networking.service
             ...

At first I switched from DHCP to a static IP by adding the following to /etc/dhcpcd.conf:

interface enxb827eb9e8acf
static ip_address=192.168.3.36/24
static routers=192.168.3.3
static domain_name_servers=192.168.3.3

(The network interface name can be found with ifconfig.)

After rebooting I saw that the dhcpcd startup had dropped from 12 seconds to 7! But that's still too long for static network configuration.

The log told me why the DHCP client daemon took so long:

$ journalctl
...
Jan 20 22:26:44 raspistereo dhcpcd[256]: enxb827eb9e8acf: carrier acquired
Jan 20 22:26:44 raspistereo dhcpcd[256]: enxb827eb9e8acf: probing address 192.168.3.36/24
Jan 20 22:26:49 raspistereo dhcpcd[256]: enxb827eb9e8acf: using static address 192.168.3.36/24
...

It spent 5 seconds checking if someone else in the network is using the same IP address. That's something I do not need, so I disabled it in /etc/dhcpcd.conf, together with IPv6 that I don't need in my internal network:

noarp
ipv4only
noipv6

Rebooting and ... 2.2 seconds for dhcpcd. That's 10 seconds faster now. gmediarenderer is available after 16 seconds now:

$ systemd-analyze critical-chain gmrender.service
gmrender.service +1.527s
└─sound.target @14.714s

(I'd like to have 2-3 seconds boot time, but the current state is acceptable.)

Written by Christian Weiske.

Comments? Please send an e-mail.