dhcpcd: Fix startup process

The *dhcpcd.service* systemd unit file that ships with Buildroot is
broken.  It orders the unit after *network.target*, which makes no
sense.  It also configures the process to fork, but incorrectly
configures the PID file.  Finally, by relying on the fork to indicate
that the network is "online," it does not distinguish between "an
interface is up" and "the network is reachable."  As most daemons only
need the former, they only rely on *network.target*, and thus can fail
to start correctly.

To correct this brokenness, we provide our own unit file for
*dhcpcd.service*, based on the one included in the Fedora *dhcpcd* RPM
package.  For "online" signalling, we provide a pair of shell scripts:
one reads from a named pipe waiting for a message and the other sends a
message to the pipe when configuration is complete.
This commit is contained in:
2022-06-27 10:25:07 -05:00
parent 47d19c033b
commit 52e28b6912
8 changed files with 77 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
[Unit]
Description=Wait for Network to be Configured
DefaultDependencies=no
Conflicts=shutdown.target
After=dhcpcd.service
Requires=dhcpcd.service
Before=network-online.target shutdown.target
[Service]
Type=oneshot
ExecStart=/usr/libexec/dhcpcd-wait-online
TimeoutStartSec=1m
RemainAfterExit=yes
[Install]
WantedBy=network-online.target