Subject: dhcpcd not updating /etc/resolv.conf

From: David Demelier <[email-masked]>
Date: Thu, 29 Apr 2021 08:04:21 +0200

Hey there,

For some reasons I could not get dhcpcd to update /etc/resolv.conf on Alpine 3.13 (aarch64) on a Raspberry Pi.

The system:

Linux vanille 5.10.29-0-rpi4 #1-Alpine SMP PREEMPT Mon Apr 12 15:55:08 UTC 2021 aarch64 Linux

The daemon acquire a lease correctly in both eth0 and wlan0 and set default route, IP address and such (I can ping every IP address) but for some reasons the resolv.conf file is empty.

Example of syslog messages when it receives DHCP lease:

Apr 28 22:42:11 vanille daemon.info [3203]: wlan0: connected to Access Point `Bbox-4D2019EB'
Apr 28 22:42:11 vanille daemon.info [3203]: eth0: waiting for carrier
Apr 28 22:42:11 vanille daemon.info [3203]: DUID 00:01:00:01:27:87:66:06:dc:a6:32:5f:6f:dc
Apr 28 22:42:11 vanille daemon.info [3203]: wlan0: IAID 32:5f:6f:dc
Apr 28 22:42:11 vanille daemon.info [3203]: wlan0: adding address fe80::dea6:32ff:fe5f:6fdc
Apr 28 22:42:11 vanille daemon.info [3203]: wlan0: soliciting an IPv6 router
Apr 28 22:42:12 vanille daemon.info [3203]: wlan0: rebinding lease of 192.168.1.97
Apr 28 22:42:12 vanille daemon.info [3203]: wlan0: probing address 192.168.1.97/24
Apr 28 22:42:17 vanille daemon.info [3203]: wlan0: leased 192.168.1.97 for 86400 seconds
Apr 28 22:42:17 vanille daemon.info [3203]: wlan0: adding route to 192.168.1.0/24
Apr 28 22:42:17 vanille daemon.info [3203]: wlan0: adding default route via 192.168.1.254
Apr 28 22:42:17 vanille daemon.info [3203]: forked to background, child pid 3221
Apr 28 22:42:25 vanille daemon.warn [3221]: wlan0: no IPv6 Routers available

And the ip a show:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 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 mq state UP qlen 1000
    link/ether dc:a6:32:5f:6f:da brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.95/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 86054sec preferred_lft 75254sec
    inet6 fe80::dea6:32ff:fe5f:6fda/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether dc:a6:32:5f:6f:dc brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.97/24 brd 192.168.1.255 scope global dynamic wlan0
       valid_lft 86071sec preferred_lft 75271sec
    inet6 fe80::dea6:32ff:fe5f:6fdc/64 scope link 
       valid_lft forever preferred_lft forever

And the resolv.conf once done:

# Generated by dhcpcd
# /etc/resolv.conf.head can replace this line
# /etc/resolv.conf.tail can replace this line

The /etc/dhcpcd.conf is quite simple:

hostname

interface eth0
	metric 10

interface wlan0
	metric 20

If I install openresolv, dhcpcd calls it but the generated file is also empty (only the header changes). However using busybox’s udhcpd works fine and generates the appropriate nameserver line in /etc/resolv.conf.

I’ve been using dhcpcd for years without any problems on many machines but now I’m completely out of ideas about this problem. I also prefer dhcpcd over busybox’s udhcpd/ifplugng because it does a very good job about hotplugging interfaces and non blocking boot (also offers a GTK UI).

Any idea would be appreciated.

---

From: Konstantin Kulikov <[email-masked]>
Date: Thu, 29 Apr 2021 10:02:05 +0300

You can add a bunch of printfs in /usr/lib/dhcpcd/dhcpcd-hooks/20-resolv.conf

---

From: David Demelier <[email-masked]>
Date: Thu, 29 Apr 2021 10:32:06 +0200

> On 29 Apr 2021, at 09:02, Konstantin Kulikov <[email-masked]> wrote:
> 

Hmm, what’s seems strange at first is that (if openresolv is installed) resolvconf -l does not list anything on the Raspberry Pi install while my Alpine laptop works fine:

(amd64 laptop, running Alpine 3.13)
$ resolvconf -l
# resolv.conf from wlan0.dhcp
# Generated by dhcpcd from wlan0.dhcp
domain lan
search lan
nameserver 192.168.1.254

(aarch64 raspberry pi 4)
$ resolvconf -l

Both systems are running almost the same services.

— 
David