My System
Raspberry Pi 3B running RaspberryPi OS Bullseye 32 bit. Even though it has a desktop I mainly use it as a server, running Pihole inside a docker container.
Probable Cause
After the most recent system updates that updated systemd and quite a few other things (but not dhcpcd) and a reboot, dhcpcd.service failed to start.
● dhcpcd.service - DHCP Client Daemon
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:dhcpcd(8)
Diagnosis
ip a && ip r
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:ac:eb:8a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.146/24 brd 192.168.0.255 scope global dynamic noprefixroute eth0
valid_lft 7087sec preferred_lft 7087sec
inet6 2600:4040:4448:1800:2c23:e13e:29e7:d26a/64 scope global dynamic noprefixroute
valid_lft 86290sec preferred_lft 14290sec
inet6 fe80::b824:f9d:715:ce85/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 66:ed:0c:59:93:73 brd ff:ff:ff:ff:ff:ff permaddr b8:27:eb:f9:be:df
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:0f:0f:14:f5 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
5: br-9691d3b33dc8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:69:20:05:26 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global br-9691d3b33dc8
valid_lft forever preferred_lft forever
inet6 fe80::42:69ff:fe20:526/64 scope link
valid_lft forever preferred_lft forever
7: vethdfd065d@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-9691d3b33dc8 state UP group default
link/ether 42:21:48:23:cf:a8 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::4021:48ff:fe23:cfa8/64 scope link
valid_lft forever preferred_lft forever
9: vethec71e9f@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-9691d3b33dc8 state UP group default
link/ether c6:f9:14:1a:26:bf brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::c4f9:14ff:fe1a:26bf/64 scope link
valid_lft forever preferred_lft forever
default via 192.168.0.1 dev eth0 proto dhcp metric 100
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.18.0.0/16 dev br-9691d3b33dc8 proto kernel scope link src 172.18.0.1
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.146 metric 100
This shows eth0 is assigned 192.168.0.146 out of the dynamic IP address range instead of the static IP address 192.168.0.65.
The Problem
The Pi is not getting the static IP address set in /etc/dhcpcd.conf:
interface eth0
#inform 192.168.0.65
static ip_address=192.168.0.65/24
static routers=192.168.0.1
Instead the Pi gets a different IP address assigned by the home router. This breaks remote access.
Note, 192.168.0.65 is outside the range of the IP addresses dynamically assigned by the home router. It was working fine until the update.
A Workaround
First, I ran the command:
sudo dhcpcd -g
Later I found running the command:
sudo systemctl restart dhcpcd.service
Both the commands assign the correct IP address.
The Question
How do I troubleshoot what is causing the problem with dhcpcd at reboot so that I don't have to locally login after each reboot and restart the service?
Thanks