Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prairiedog and the kernel may disagree about parsing boot config keys without values #2359

Closed
markusboehme opened this issue Aug 19, 2022 · 2 comments · Fixed by #2565
Closed
Assignees
Labels
type/bug Something isn't working

Comments

@markusboehme
Copy link
Member

Image I'm using: Build of metal-dev variant fresh off develop

What I expected to happen:

When using the example user data from the boot settings section of the README.md, ...

[settings.boot.kernel-parameters]
"console" = [
  "tty0",
  "ttyS1,115200n8",
]
"crashkernel" = [
  "2G-:256M",
]
"slub_debug" = [
  "options,slabs",
]
"usbcore.quirks" = [
  "0781:5580:bk",
  "0a5c:5834:gij",
]

[settings.boot.init-parameters]
"log_level" = ["debug"]
"splash" = []

...I expected those settings to always reflect what the kernel and systemd would see on boot.

What actually happened:

Prairiedog may generate the following boot config...:

bash-5.1# cat /var/lib/bottlerocket/bootconfig.data 
kernel.slub_debug = "options,slabs"
kernel.crashkernel = "2G-:256M"
kernel.usbcore.quirks = "0781:5580:bk", "0a5c:5834:gij"
kernel.console = "tty0", "ttyS1,115200n8"
init.splash = 
init.log_level = "debug"

...which on next boot is read by the kernel as:

bash-5.1# cat /proc/bootconfig 
kernel.slub_debug = "options,slabs"
kernel.crashkernel = "2G-:256M"
kernel.usbcore.quirks = "0781:5580:bk", "0a5c:5834:gij"
kernel.console = "tty0", "ttyS1,115200n8"
init.splash = 'init.log_level = "debug"'

Note that the log_level key got pulled in as the value for the actually value-less splash key.

How to reproduce the problem:

Put the boot settings fragment from above into your user data. There seems to be a random component to it, and it may take a few (clean) boots to hit.

@markusboehme markusboehme self-assigned this Aug 19, 2022
@markusboehme
Copy link
Member Author

As for the semi-random occurrence of the issue: The value-less key must not be the last line in the configured boot config. The order in which prairiedog writes out these keys is determined by Rust's HashMap.iter() method, which is documented to produce an "arbitrary" order which in my tests mostly, but not always, happened to be one that put splash last.

Clearly there is disagreement about how to represent value-less keys in the boot config, and in case of doubt the kernel's implementation wins. Prairiedog could put an empty pair of quotes after the value-less key. I'll check whether there's other ways to represent such keys, though (IIRC init { splash } would be one).

Until a fix has been merged, one may work around the issue by providing "splash" = [""] in the user data, i.e. an empty string instead of an empty array.

@mchaker
Copy link
Contributor

mchaker commented Aug 19, 2022

I've seen this issue and wasn't sure how to describe it in a bug report 😅 thanks for filing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants