Hello,
I'm currently netbooting Openwrt by passing some options on the kernel command line, without any initramfs (I recompiled openwrt to include the network devices drivers).
I launch a few scripts, then, I launch the init from openwrt. At this point, it seems the init mount some root partition on top of my nfs rootfs, and "do something" with the network that basically disconnect the box from the nfs server.
Where should I start, in order to avoid the init system to kill my nfs rootfs ? In particular, I suspect that mount_root: mounting /dev/root is a problem (a few seconds later, I get nfs: server 192.168.183.1 not responding, still trying).
x86, generic. But, again, I have no problem with the netboot, or the rootfs, it's just when I launch the init script from my pre-init custom script, it starts mounting stuff on top of my rootfs, which I don't want.
The kernel image I build already has ip dhcp autoconfiguration, and I kind of want to avoid the init system to try to deal with the network while it's perfectly working before launching it (the same with the root fs).
I'd look into the various pre-init and init steps. In general, they are all shell scripts. They do call mount_root which, as I recall, is a C executable.
Managed it, finally. For the records, this is what i've done:
Prevent the "80_mount_root" hook to be called (I just preventend the boot_hook_add to be executed, in the /lib/preinit/80_mount_root file)
Prevent the "preinit_ip()" function from being called, by just placing a return at the top of the function, in the /lib/preinit/10_indicate_preinit file.
Provide a default /etc/config/network, otherwise a bridge is created on the first boot, on the interface I used to connect my NFS Server and client.
With these two steps, the NFS root fs is not lost, and I'm happy
I wish I had access to "high-level" configuration options that would allow me to avoid editing the preinit files by hand (what happens if the package is updated?), but, well, it works.
No, it wouldn't surprise me if NFS is still broken since it is not considered a supported configuration, so nobody is testing it. I vaguely recall two distinct problems preventing NFS root setup:
netifd, upon starting, will reconfigure all network interfaces, briefly downing lan in the process and shifting the ip address 192.168.1.1 from the underlying ethX to br-lan or - in case no bridge is set up - clear all IP config anyway and apply it from scratch. This will break the established NFS connection
mount_root might attempt to overmount / with something else which might or might not be a problem.
My personal guess would be netifd severing your NFS connection due to the interface reconfiguration.
a pr that cases cmdine for nfs and handles the other breakpoints would be relatively simple... if I ever find my last docs / need this again... ( or someone starts a pr ) i'll post a patch here...