2

I am trying to nfs-boot a linux managed with systemd, via tftp kernel + nfs rootfs, my bootargs:

root=/dev/nfs rw nfsroot=192.168.0.10:/nfsroot/rootfs,nolock ip=192.168.0.60:192.168.0.10:192.168.0.10:255.255.255.0

Both kernel and rootfs loads successfully and the system is running, until systemd-networkd starts. After that, I can not ping the machine and NFS mount hangs (obviously).

I tried to add network config for systemd-networkd to initialize the network, but it does not work.

The serial console log:

         Starting Network Service...
...
[  OK  ] Started Network Service.
[  OK  ] Reached target Network.
...
[  *   39.330000] nfs: server 192.168.0.10 not responding, still trying

The network config:

[Match]
Name=eth0
[Network]
Address=192.168.0.60/24
Gateway=192.168.0.10
[Route]
Gateway=192.168.0.10
Destination=192.168.0.0

I wonder why systemd-networkd.service breaks the network when the system is started via nfs?

I guess when networkd starts, it withdraws the ip address, and then tries to read the config file. At this time the nfs mount already breaks, and it does not have a chance to read the config file.

If my guess is true, how to "fix" or "workaround" this issue?

1
  • I guess when networkd starts, it withdraws the ip address, and then tries to read the config file. At this time the nfs mount already breaks, and it does not have a chance to read the config file.
    – Mine
    Commented Dec 22, 2017 at 8:42

2 Answers 2

3

It turns out that systemd-networkd provides an option to not releasing the IP.

Adding below in the config

[DHCP]
CriticalConnection=true

Then the IP will not be released and NFS will not hang.

1
  • 1
    By way of an update: from systemd v243, the CritialConnection setting has been deprecated; now there's a KeepConfiguration setting instead. Check the systemd.network manual page for details. Commented Mar 9, 2022 at 7:36
2

Though it was a question 2 years ago, I still googled here. And I finally get a better solution from NFS ROOT WITH SYSTEMD

[Match]
Name=eth*
KernelCommandLine=!nfsroot
1
  • But the author said @Mine 's solution is "an alternative method as well". I will confirm whether linux kernel parameter 'ip=dhcp' works for multiple ethernet cards. If not, this patch blocks multiple enthernet cards got ips expect the first one.
    – Kai
    Commented Jun 20, 2019 at 2:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .