Subject: [bug#41011] [PATCH] gnu: grub: Support for network boot via tftp/nfs.

From: Danny Milosavljevic <[email-masked]>
Date: Tue, 9 Jun 2020 15:44:00 +0200

Hi Stefan,

On Tue, 9 Jun 2020 14:16:18 +0200
Stefan <[email-masked]> wrote:

> I made your requested change (using <nfs-share>), but when trying a 'guix system reconfigure …' I only get this error:
> 
> guix system: error: #<nfs-share ":/volume5/guix-system">: invalid G-expression input
> 
> There is no backtrace, no nothing. I can’t figure out, which part of the code tries to read this serialisation. Do you have a clue?

I think it's a problem in the transfer of the record from host side to build
side, in this case mostly via Linux kernel command line arguments, which are
strings.

The host side code can use these records, but eventually the build side code
has to get a string and reconstruct it.

I don't know how to debug it except for running the translation in my head.
The error reporting facility could be improved a lot :(

gnu/build/linux-boot.scm is build side.  It runs when the system boots.

In there it has 

  (define (device-string->file-system-device device-string)
    ;; The "--root=SPEC" kernel command-line option always provides a
    ;; string, but the string can represent a device, a UUID, a
    ;; label or a NFS spec.  So check for all three.
    (cond ((string-prefix? "/" device-string) device-string)
          ((uuid device-string) => identity)
          (else (file-system-label device-string))))

But looking at the condition (uuid device-string) I have no idea what that means,
or is bound to!

It was introduced by:

commit 281d80d8e547fe663aaacb3226119166dd3100f9
Author: Maxim Cournoyer <[email-masked]>
Date:   Tue Feb 11 14:00:06 2020 -0500

    linux-boot: Refactor boot-system.
    
    The --root option can now be omitted, and inferred from the root file system
    declaration instead.
    
    * gnu/build/file-systems.scm (canonicalize-device-spec): Extend to support NFS
    directly, and...
    * gnu/build/linux-boot.scm (boot-system): ...remove NFS special casing from
    here.  Remove nested definitions for root-fs-type, root-fs-flags and
    root-fs-options, and bind those inside the let* instead.  Make "--root" take
    precedence over the device field string representation of the root file
    system.
    * doc/guix.texi (Initial RAM Disk): Document that "--root" can be left
    unspecified.

If "--root" is not specified, it should then pick up the root from the root
file system declaration. 

@Maxim: How can we use your commit to boot from NFS?  I see no way to leave
"--root" off in the first place for a regular user.  (Stefan's patch adds
support for network boot via tftp/nfs via grub efi net) 

Cheers,
   Danny