ibm-s390-linux / s390-tools

Tools for use with the s390 Linux kernel and device drivers
MIT License
63 stars 60 forks source link

zipl: error when title is not the first field in BLS file #64

Closed stefan-haberland closed 3 years ago

stefan-haberland commented 5 years ago

following error occurs when the title entry is not the first line in a BLS file:

Error: Config file '/root/zipl.conf': Line 0: keyword 'image' not allowed in section 'defaultboot'

zipl.conf:

[defaultboot]
defaultauto
prompt=1
timeout=5
target=/boot

BLS file:

initrd /ostree/fedora-coreos-c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/initramfs-5.0.9-200.fc29.s390x.img
title Fedora 29 (CoreOS preview) 29 (ostree)options 
ostree=/ostree/boot.1/fedora-coreos/c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/0 ignition.firstboot
linux /ostree/fedora-coreos-c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/vmlinuz-5.0.9-200.fc29.s390xversion 1
zhengxiaomei123 commented 5 years ago

zipl uses the BLS snippet title field to create a new menu entry, when in BLS snippet the initrd field is before title, zipl wrongly assumes that initramfs is for the only section it has defined (defaultboot). if title before initrd and linux, it should work, since by the time it parses the initrd and linux, it would already created a new section for 'Fedora 29 (CoreOS preview) 29 (ostree)'.

zhengxiaomei123 commented 5 years ago

BLS file:

initrd /ostree/fedora-coreos-c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/initramfs-5.0.9-200.fc29.s390x.img
title Fedora 29 (CoreOS preview) 29 (ostree)options 
ostree=/ostree/boot.1/fedora-coreos/c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/0 ignition.firstboot
linux /ostree/fedora-coreos-c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/vmlinuz-5.0.9-200.fc29.s390xversion 1

there are some paste error whatever the correctly worked one is : title Fedora 29 (CoreOS preview) 29 (ostree) version 1 initrd /ostree/fedora-coreos-c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/initramfs-5.0.9-200.fc29.s390x.img options ostree=/ostree/boot.1/fedora-coreos/c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/0 ignition.firstboot linux /ostree/fedora-coreos-c2182f8fe3ba1f8ffe5dbc9ee89503637e06a7e1d7a0e12b50d4d0d4665c063e/vmlinuz-5.0.9-200.fc29.s390x

cgwalters commented 5 years ago

We could pretty easily change ostree for this if it helps; what exactly is zipl expecting here? title, linux, options, initrd in that order?

martinezjavier commented 5 years ago

We could pretty easily change ostree for this if it helps; what exactly is zipl expecting here? title, linux, options, initrd in that order?

@cgwalters I think the only constraint is that the title must be the first field. Since as @zhengxiaomei123 mentioned, zipl uses the title field to add a new IPL section that will be the one associated with the other fields in the BLS snippet.

tuan-hoang1 commented 5 years ago

@cgwalters @martinezjavier : and also no blank line in loader entries file or else zipl will complain.

tuan-hoang1 commented 5 years ago

But I think it's zipl's business to peacefully discard blank lines and accept any order of loader entries file.

tuan-hoang1 commented 4 years ago

Just realized blank line issue seems to be fixed in https://github.com/ibm-s390-tools/s390-tools/commit/53f166673d0a338822362f500da4fa33df6c3296 but not backported to F29/F30 yet.

edward6 commented 4 years ago

It seems that the scan code makes an implicit assumption that title is always on the top. I would add an early explicit check for this (to make sure that the title is on the top). If the check is failed, then return an error with a message that "title is not on the top", which is a hint for user to edit BLS file properly.

stefan-haberland commented 4 years ago

There is no real need to have the title field in the first position, also the BLS documentation does not say this. So I would prefer to have the scanner sort the fields properly.

edward-ibm commented 4 years ago

"Title" is something which is always on the top - I don't think that it needs to be documented . So, I would first start from identifying a real need for having it not on the top (just because it will add a complexity to the implementation).