[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#43219] [PATCH] gnu: Handle nfs-root device strings.
From: |
Stefan |
Subject: |
[bug#43219] [PATCH] gnu: Handle nfs-root device strings. |
Date: |
Mon, 7 Sep 2020 14:50:05 +0200 |
Hi Danny!
>> * gnu/bootloader/grub.scm (grub-root-search): Suppor nfs-root device strings
>> to
>> set the root to tftp.
>
> Why does having a NFS root "device" imply using TFTP?
>
> I can see that it would be nice--but I've been using NFS for many years
> without
> using TFTP.
True.
If you use an NFS share as the root file system, it’s just very likely that you
use a diskless setup.
It is uncommon, that you have some storage device, from which you load the
kernel and the initrd, but which is not also your root file system device.
Usually the kernel and the initrd are located in the root file system.
But take a closer look at (grub-root-search device file): This function gets a
device record or device string, which is expected to contain the file to look
for.
If that device string is an NFS share, then GRUB has only two possibilities to
access that file: either via TFTP or HTTP. Actually there is no way yet to
divide between these two possibilities.
GRUB does not support NFS, and the chance that the searched file on the NFS
share is accessible on a local storage as well is very low.
I chose TFTP over HTTP because of this reasons:
• PXE specifies TFTP but seems not to specify HTTP.
• The ‘file’ field inside the DHCP header implies TFTP.
• For BOOTP/DHCPv4 the RFC 2132 defines a TFTP server for option 66.
• U-Boot supports TFTP but not HTTP (important for chain-loading).
• The Raspberry Pi only supports TFTP.
Only with DHCPv6 there is RFC 5970, which specifies option 59 to contain a
boot-file-url, which may start with ‘http://’ but also allows ‘tftp://’.
>> + ((? (lambda (device)
>> + (and (string? device) (string-contains device ":/"))) nfs-uri)
>> + "set root=(tftp)")
>
> What is that required for in practice?
As stated above, (grub-root-search device file) is used to find the device from
which to load the file. It normally generates a GRUB search command to specify
inside the root variable where to find that file. That the root variable gets
set is not obvious from the generated search command. But take a look here, it
is the default:
<https://www.gnu.org/software/grub/manual/grub/grub.html#search>.
However, searching for files is not possible via TFTP, so with “set
root=(tftp)” we specify not to search for the file, but to assume that it is
accessible via TFTP. Beside a “set root=(http)” this is the only way to specify
the root, if the device is an NFS share.
However, the grub.cfg is loaded via TFTP as well, so root must be preset to
‘(tftp)’ or even ‘(http)’ due to DHCP options. So omitting the search command
could be enough and even allow the use of HTTP.
It could also be possible to keep the ‘search —file’ command, if it does not
produce an error.
I’ll check that.
> Pushed all the other hunks except for the one above--for now.
>
> Guix master commit 1c3b709edb8e6248a9a84dde57b27f3fdc997f21.
Thanks.
Bye
Stefan