DNS option not being used with DHCP (Mycroft II)

We got our shiny new Mycroft II and it’s pretty good! I’ve got Home Assistant integration working, however, I’m noticing, concerning, 8.8.8.8 keeps getting set in /etc/resolv.conf when Mycroft reboots and I can’t figure out where that’s coming from. My DHCP server hands off our local DNS which I need for MyCroft to be able to hit my Home Assistant server. I tried putting some settings in systemd/networkd.conf but that didn’t seem to survive the reboot. I can make resolv.conf immutable but that seems like a bad way to do it.

Any insight here? I kinda find forcing 8.8.8.8 is not ideal where the DNS setting handed off from DHCP should be honored.

2 Likes

Hi there, thanks for reporting this.

I’ve moved it to our bugs category as it certainly isn’t intended.

Have you tried using the official resolvconf package?

The following should theoretically achieve this, but isn’t for some reason.

sudo apt update
sudo apt install resolvconf
sudo nano /etc/resolvconf/resolv.conf.d/head  # add entries as needed
systemctl reboot

I’ll reach out to some others in the team and see what we can dig up here.

Thanks for the help! I indeed hadn’t tried the resolvconf package so yep I gave your instructions a go! I did run into an issue and I think it might have something to do with squashfs? Here’s the output:

(.venv) mycroft@localhost:/etc$ sudo apt install resolvconf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  resolvconf
0 upgraded, 1 newly installed, 0 to remove and 27 not upgraded.
Need to get 54.7 kB of archives.
After this operation, 200 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 resolvconf all 1.82 [54.7 kB]
Fetched 54.7 kB in 1s (94.9 kB/s)  
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package resolvconf.
(Reading database ... 77386 files and directories currently installed.)
Preparing to unpack .../resolvconf_1.82_all.deb ...
Unpacking resolvconf (1.82) ...
Setting up resolvconf (1.82) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/
perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Created symlink /etc/systemd/system/sysinit.target.wants/resolvconf.service → /lib/systemd/system/resolvconf.serv
ice.
/usr/sbin/policy-rc.d returned 101, not running 'start resolvconf.service'
Created symlink /etc/systemd/system/systemd-resolved.service.wants/resolvconf-pull-resolved.path → /lib/systemd/s
ystem/resolvconf-pull-resolved.path.
/usr/sbin/policy-rc.d returned 101, not running 'start resolvconf-pull-resolved.path resolvconf-pull-resolved.ser
vice'
ln: failed to create symbolic link '/etc/resolv.conf': Device or resource busy
dpkg: error processing package resolvconf (--configure):
 installed resolvconf package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (245.4-4ubuntu3.18) ...
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 resolvconf
E: Sub-process /usr/bin/dpkg returned an error code (1)

(.venv) mycroft@localhost:/etc$ sudo mv /etc/resolv.conf /etc/resolv.bak
mv: cannot move '/etc/resolv.conf' to '/etc/resolv.bak': Device or resource busy

(.venv) mycroft@localhost:/etc$ lsattr resolv.conf
lsattr: Inappropriate ioctl for device While reading flags on resolv.conf

The install failed seemingly because it can’t remove resolv.conf. I’m not able to do that either however the file can be edited and saved as root, but as noted, reverts back after reboot. I haven’t really used squashfs so I’m not sure how that might be working, but since I can install packages (and they persist) it makes me think resolv.conf might have some sort of copy-on-write mode enabled or something?

@m00dawg do you have a /usr/share/udhcpc/default.script script?

See: networking - What overwrites /etc/resolv.conf on every boot? - Unix & Linux Stack Exchange

Hope this helps.

-Mike Mac

If the guys from pantacore use a squashfs which by design is read only, they most likely also use an OverlayFS to write to certain files.

/etc is heavily integrated within systemd so if systemd already touches/uses the file before the OverlayFS is mounted it can not be altered.

As systemd basically is “init” (/usr/sbin/init) which is the first thing that gets started by the kernel, you need to mount the overlay before init gets called.

In OpenVoiceOS i basically added a pre-init which mounts the overlayfs and then hands over the control to the systemd init.

See the WIP pre-init at below link;

I add the kernel cmdline parameter “init=/user/sbin/pre-init” to boot this pre-init which mount the overlayfs and then the normal init is started.

(Bare in mind the pre-init is still wip as i need to included the mirrored boot A/B logic to it for the update system later on)

Thanks folks! Mike, I checked and I don’t have that file:

(.venv) mycroft@localhost:/usr/share$ find ./ -name udh*
(.venv) mycroft@localhost:/usr/share$

This is a default install of whatever came with Mycroft II out of the box plus some helper utils at this point (e.g. lsof) but I"ve tried to minimize changes. Oh well I also messed around with changing Mycroft’s voice since the Mycroft web UI doesn’t expose those changes yet.

For now, I managed to work around this by adding a public DNS record (which points to the private IP of my HA instance) and that’s allowed HA to work for now. I don’t want to keep doing that but at least the rest of the fam can now turn lights off an on by voice.