Dhcpcd is Doing Odd Things

dhcpcd does give me an IP on my local network, but then decides that I am unworthy of internet (temporary failure in name resolution) and autogenerates a resolv.conf. The autogeneration gives:

# Generated by dhcpcd from enp5s0.dhcp, enp5s0.dhcp6, enp5s0.ra
# /etc/resolv.conf.head can replace this line
domain hsd1.co.comcast.net.
nameserver 75.75.75.75
nameserver 75.75.76.76
nameserver 2001:558:feed::1
nameserver 2001:558:feed::2
# /etc/resolv.conf.tail can replace this line

The line doman hsd1.co.comcast.net. has a trailing period, and removing it causes my network to work. Also what causes my network to work is creating a /etc/resolv.conf.head with the line nameserver 1.1.1.1.

When I modify a resolv.conf, it’ll be overwritten by the buggy default in about 10 seconds. This occurs regardless of whether the dhcpcd service is actually running (runit on Void Linux) or if it is disabled.

Ideally I would like dhcpcd to just work. My current solution of /etc/resolv.conf.head seems hacky and just generally-not-all-that-great.

I’m also curious how my “solution” does anything at all, given that it isn’t changing or overriding the errored line in any way.

What do I do to make my system just slightly less cursed? Thanks!

Edit: resolv.conf decided to clear itself for no apparent reason. I went in and edited it to just “nameserver 1.1.1.1” and after quitting the editor and waiting a few seconds, I catted out the file to see:

# Generated by dhcpcd from enp5s0.dhcp, enp5s0.dhcp6, enp5s0.ra
nameserver 1.1.1.1
nameserver 1.1.1.1
domain hsd1.co.comcast.net.
nameserver 75.75.75.75
nameserver 75.75.76.76
nameserver 2001:558:feed::1
nameserver 2001:558:feed::2
# /etc/resolv.conf.tail can replace this line
domain hsd1.co.comcast.net.
nameserver 75.75.75.75
nameserver 75.75.76.76
nameserver 2001:558:feed::1
nameserver 2001:558:feed::2
# /etc/resolv.conf.tail can replace this line

Edit, 10 seconds later:

# Generated by dhcpcd from enp5s0.dhcp, enp5s0.dhcp6, enp5s0.ra
nameserver 1.1.1.1
domain hsd1.co.comcast.net.
nameserver 75.75.75.75
nameserver 75.75.76.76
nameserver 2001:558:feed::1
nameserver 2001:558:feed::2
# /etc/resolv.conf.tail can replace this line
1 Like

First thing I would check if you didn’t make typo (trailing dot) in /etc/hostname or /etc/hosts

I have not - both files appear fine right now, and the OS has been working perfectly fine since install a few months ago.

Nvm, sorry. I misread what you pasted. Domain name with dot at the end should be fine.

I tested removing it again, and this time it had no effect, but adding 8.8.8.8 or 1.1.1.1 is still fixing the issue every time it comes up. I have absolutely no idea what’s going on then. Thanks

More “testing” (just watching resolv.conf) - the file just seems to get cleared intermittently, and then come back with actual information.

Yeah, resolv.conf is updated automaticaly by service in modern distros.
I checked Void and it seems not standard distro. DOes it run systemd?
If yes then I would look up systemd-resolved docu, for Arch should be fine:
https://wiki.archlinux.org/index.php/Systemd-resolved

Try “sudo systemctl status systemd-resolved” if it works

Void uses runit. Running sv status dhcpcd returns run: dhcpcd: (pid 18059) 312s), and it seems to be running.

I checked networking in Void quickly and it seems that dhcpcd overwrites your resolv.
From docs:
"dhcpcd runs /usr/libexec/dhcpcd-run-hooks, or the script specified by the -c , - -script option."

So I would check those scripts in hooks dir.

" (…) dhcpcd then runs the configuration script which writes DNS information to resolvconf(8), if available, otherwise directly to /etc/resolv.conf."

Full text here: https://man.voidlinux.org/dhcpcd.8

I ended up solving this by appending nohook resolv.conf to /etc/dhcpcd.conf so that it wouldn’t edit resolv.conf - seemed easier than going through the dhcpcd-run-hooks scripts.

2 Likes

Had a similar issue with DHCP in void recently… Was as if something was hanging around between restarting dhcpcd, which a reboot solved. Never did figure it out.