GNU bug report logs -
#40998
Guix System's initrd doesn't honor rootflags
Previous Next
Reported by: maxim.cournoyer <at> gmail.com
Date: Fri, 1 May 2020 13:54:01 UTC
Severity: normal
Tags: patch
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi Ludovic!
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi!
>
> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>
>> This version field exposes the (already present) version information of a boot
>> parameters file.
>>
>> * gnu/system.scm (%boot-parameters-version): New variable.
>> (<boot-parameters>)[version]: New field.
>> (read-boot-parameters): Use it.
>> (operating-system-boot-parameters-file): Likewise.
>> * tests/boot-parameters.scm (test-read-boot-parameters): Use
>> %boot-parameters-version as the default version value in the template.
>
> [...]
>
>> (define-record-type* <boot-parameters>
>> boot-parameters make-boot-parameters boot-parameters?
>> (label boot-parameters-label)
>> @@ -322,7 +326,9 @@ (define-record-type* <boot-parameters>
>> (kernel boot-parameters-kernel)
>> (kernel-arguments boot-parameters-kernel-arguments)
>> (initrd boot-parameters-initrd)
>> - (multiboot-modules boot-parameters-multiboot-modules))
>> + (multiboot-modules boot-parameters-multiboot-modules)
>> + (version boot-parameters-version ;positive integer
>> + (default %boot-parameters-version)))
>
> [...]
>
>> (match (read port)
>> - (('boot-parameters ('version 0)
>> + (('boot-parameters ('version (? version? version))
>> ('label label) ('root-device root)
>> ('kernel kernel)
>> rest ...)
>> (boot-parameters
>> + (version version)
>> (label label)
>> (root-device (device-sexp->device root))
>
> There’s no need to have a ‘version’ field in live <boot-parameters>
> records: have the ‘version’ field in the serialized format (the sexp)
> and make sure the deserializer correctly converts to the internal
> representation.
>
> Here, I think you can bump the version number in the serialized form,
> and have ‘read-boot-parameters’ automatically augment ‘kernel-arguments’
> when VERSION is 0 with “--root=XYZ”.
I initially went that route, as this was the idea you'd given me
initially. However, 'read-boot-parameters' deals with serializing the
parameters file only; to add 'root', 'gnu.load' and 'gnu.system', the
operating-system object as well as the root device are needed. The
reason 'gnu.load' and 'gnu.system' aren't written to the parameters file
to start with is because they would cause the system directory to no
longer be content-addressable; this is explained in the docstring of
'operating-system-boot-parameters-file':
When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as 'root'
and 'gnu.load' to the returned file (since the returned file is then usually
stored into the content-addressed "system" directory, it's usually not a
good idea to give it because the content hash would change by the content hash
being stored into the "parameters" file).
So, unless we were to pack 'read-boot-parameters' with unrelated duties
and a 'system-kernel-arguments?' argument, it seems unavoidable to
expose the 'version' metadata.
> (It might be that you can even do that without bumping the version
> number. Bumping is clearer but the downside is that an older Guix will
> abort when attempting to read ‘parameters’. This could happen if you
> roll back to an earlier generation and try to run ‘guix system
> reconfigure’ or similar from there.)
>
> Also, you could write the ‘match’ pattern like this:
>
> ('boot-parameters ('version (and version (or 0 1)))
> ('label label) …)
I think this patch's current form is preferable, as it means future
boot-parameters version bumps won't break older Guices (when
reconfiguring), as long as the version is an exact, non-negative integer
(e.g. when going from 1 to 2).
Let me know what you think!
Thank you,
Maxim
This bug report was last modified 3 years and 78 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.