On Mon, Jun 25, 2018 at 6:14 PM, Zbigniew Jędrzejewski-Szmek <zbyszek@xxxxxxxxx> wrote: > On Mon, Jun 18, 2018 at 04:40:41PM +0200, Ondřej Lysoněk wrote: >> On 14.6.2018 12:06, Jan Kurik wrote: >> I noticed the official spec defines a field named "machine-id". AFAICS, >> GRUB2 doesn't implement that option, but it supports a field named "id". >> Are these used for the same thing? If they are, why are they named >> differently? > > This questions wasn't addressed yet afaics. > The reason why are named differently is that the BLS isn't generated on the machine but at kernel build time and shipped in the kernel package. So there's a need for a machine independent id. The ostree BLS snippets also don't define a machine-id BTW, but I don't know if there's a reason for that. > The partial answer is that "id" serves a different purpose to "machine-id": > - "machine-id" is used to specify the machine for which the entry was installed > - "id" is used by grub2 as a unique identifier usable for saving entries > Yes, the "Differences from BootLoaderSpec" section in the Changes page [0] says: id is also used for menuentry's --id parameter, so you can use it in saved_entry > That raises two questions: > 1. Why isn't just the bls-snippet filename used as the key? It's > necessarily unique and should be usable for the purpose of uniquely > identifying the boot entry without creating a separate field. I'll let Peter answer this question since he wrote the grub2 implementation. Doing this will be pretty trivial, but in that case we should also sort using the filenames if the id field isn't defined. This is already the case for Petitboot since the maintainer asked for the filename to be used as the key as well. For zipl the key is the version field because currently the kernel version is used as the zipl.conf section name and the maintainer wanted to keep the same behavior with BLS. Sorting using the filename won't work with ostree though. The BLS snippets are named ostree-$ID-$VARIANT_ID-$index.conf but the entries are sorted using the version field, and the index is the inverse of the version. One option is to change ostree so the BLS snippets are named ostree-$ID-$VARIANT_ID-$version.conf, but I don't know if there's a reason to have the index there. Another option is to give more precedence to the version field and only sort using the filenames if neither the id nor the version fields are defined. > 2. Why is "id" supposed to be sortable? What sorting would grub2 do > with it? > It's sortable so grub2 can display the boot menu entries in the correct order. This is also answered in the Changes page: id - provides us with a sort key, sorted using rpm's version comparison function. Generally of the form: fedora-20180530145228-4.16.13-300.fc28.x86_64 It attempts to sort using the id field, and if this isn't defined other fields are used as fallback in the following order: version, title, linux. > Zbyszek [0]: https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault Best regards, Javier _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx/message/3GAGU3MV2LNLFMJ37DDW2IRKTZNE2GI7/