Bug 205805 - nfsroot documentation: inconsistent argument format for `ip=`
Summary: nfsroot documentation: inconsistent argument format for `ip=`
Status: ASSIGNED
Alias: None
Product: Other
Classification: Unclassified
Component: klibc/kinit (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Ben Hutchings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-09 01:06 UTC by schmittlauch
Modified: 2022-09-14 09:11 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.19.87
Subsystem:
Regression: No
Bisected commit-id:


Attachments
screenshot of ipconfigs success message after network configuration (13.48 KB, image/png)
2019-12-09 01:06 UTC, schmittlauch
Details

Description schmittlauch 2019-12-09 01:06:28 UTC
Created attachment 286231 [details]
screenshot of ipconfigs success message after network configuration

While setting up a system with networking enabled in its initramfs, I encountered that the documentation for nfsroot [1] seems to be outdated:

In nfsroot.txt, the format for the `ip=` kernel cmdline parameter has up to 10 fields:

>
> ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>:<ntp0-ip>

But it turned out that this 10-field format results in an error at boot:
ipconfig: too many options for eth0

Thanks to an old Ubuntu bug report [2] I discovered the documentation of Klibc's ipconfig command. And there the interface spec only has 7 fields:
> <client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

When trying out the kernel cmdline parameter with these 7 fields only, the network setup was successful. (examples further below)

So obviously current kernels are only able to deal with an `ip=` argument if it has 7 fields and the nfsroot.txt documentation should be updated.

But at a closer look, the situation isn't completely clear: During boot, the kernel ouput still shows the 2 DNS servers set (see attached screenshot), although the DNS server config fields are exactly the ones abolished from the ipconfig interface spec.

I ask the maintainers of nfsroot and the ones of Klibc's ipconfig to get together and decide on a consistent interface spec format and kernel output. Either the nfsroot.txt argument specifiction needs to be update or the ipconfig success screen should not display DNS server if there's no possibility to set them.

How to reproduce:
1. Use an initramfs that makes use of networking capabilities
2. Specify a static network configuration as a kernel cmdline argument at boot:
   `ip=192.168.178.5::192.168.178.1:255.255.255.0:myhostname:eth0:off:1.1.1.1:8.8.8.8:`

results in a kernel error: `ipconfig: too many options for eth0`

   `ip=192.168.178.5::192.168.178.1:255.255.255.0:myhostname:eth0:off`

works fine and network is successfully configured

Downstream bugreport for NixOS: https://github.com/NixOS/nixpkgs/issues/75314

[1] https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt
[2] https://bugs.launchpad.net/initramfs-tools/+bug/1251274
Comment 1 Ben Hutchings 2019-12-11 17:21:06 UTC
klibc 2.0.7 added support for the DNS server fields in the ipconfig utility, but it currently fails if additional fields are provided beyond these. It should ignore them (and maybe warn that it is doing so).
Comment 2 Ben Hutchings 2019-12-11 18:03:27 UTC
The handling of additional fields should be fixed by these patches:

https://lists.zytor.com/archives/klibc/2019-December/004266.html
https://lists.zytor.com/archives/klibc/2019-December/004267.html

Let me know if these don't work for you.

Note You need to log in before you can comment on or make changes to this bug.