no dns server on nfsroot with systemd-networkd

2

I've created my own Sysroot with Yocto and mounting it via NFS on an ARM-Board. It uses systemd-networkd and systemd-resolved for networking. I am starting the board like this:

U-Boot Bootloader loads kernel and devicetree via tftp and passes

root=/dev/nfs nfsroot=192.168.x.x:/Path/To/Sysroot,vers=3,tcp rootwait ro ip=dhcp

to the Kernel. Kernel starts and receives IP and DNS from our local DHCP-Server:

IP-Config: Complete:
 device=eth0, hwaddr=XX:XX:XX:XX:XX:XX, ipaddr=192.168.X.X, mask=255.255.255.0, gw=192.168.X.X
 host=192.168.XX.XX, domain=XXX.XX, nis-domain=(none)
 bootserver=0.0.0.0, rootserver=192.168.XX.XX, rootpath=
 nameserver0=192.168.XX.XX, nameserver1=192.168.XX.XX

After that the Kernel mounts the NFS-Sysroot and starts SystemD. At this point the systemd-networkd service would take over and request an IP from DHCP. Even when it receives the same IP the kernel received earlier, this would break the nfs-mount. I am avoiding this by changing my systemd-networkd configuration file to:

[Match]
Name=eth0
KernelCommandLine=!nfsroot

[Network]
DHCP=ipv4

So the config file is only applied when im not using nfsroot.

But now dns is not working. I can see the previously detected DNS-Servers with:

cat /proc/net/pnp 
#PROTO: DHCP
domain XXX.XX
nameserver 192.168.XX.XX
nameserver 192.168.XX.XX
bootserver 0.0.0.0

but the system does not seem to use them. How can i use these dns servers?

daly

Posted 2018-02-05T07:14:50.013

Reputation: 21

Is it worth hard coding your namesevers in /etc/resolvconf/resolv.conf.d/head ? – ThorSummoner – 2018-02-20T04:47:52.367

I've also been having issues with powering the machine down due to the nfsroot being broken by the time the shutdown target hits. – ThorSummoner – 2018-02-20T04:48:57.727

No answers