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

init: split initialization into quasi-idempotent parts #599

Merged
merged 3 commits into from
Mar 3, 2024

Conversation

ahesford
Copy link
Member

@ahesford ahesford commented Mar 1, 2024

This is an attempt to overcome issues like #597, where the console blocks waiting for user input and leaves ZFSBootMenu uninitialized for remote logins. Initialization is broken into several functional units, and each is executed and then marked non-executable so that subsequent calls to zfsbootmenu-init will not attempt to run them again. Similarly, early-setup hooks, which are expected to run exactly once, will be marked non-executable after being run the first time for more granularity among these user-configurable components.

Because zfsbootmenu-init is now (more or less) idempotent, /bin/zfsbootmenu can attempt to run it if necessary rather than just spinning forever.

Copy link
Member

@zdykstra zdykstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic!

@ahesford
Copy link
Member Author

ahesford commented Mar 1, 2024

I tested this by adding a custom script, init.d/25-forever, that just sleeps for an hour. When SSH is enabled in the testbed, I can log in, confirm that hooks before 25-forever are not executable, manaully mark 25-forever non-executable, and run zfsbootmenu to trigger initialization and get a functional menu.

@ahesford ahesford force-pushed the init-for-the-long-haul branch from 909d687 to bd01efb Compare March 1, 2024 21:17
@ahesford
Copy link
Member Author

ahesford commented Mar 1, 2024

I'm tempted to make the timed_prompt call in bin/zfsbootmenu much longer than 10 seconds to make attempting to reinitialize more of an opt-in behavior. Maybe something like 3600 seconds and hide the time in the prompt. Thoughts?

@zdykstra
Copy link
Member

zdykstra commented Mar 1, 2024

Extending it out would probably make for more predictable behavior for people connecting over SSH. I see a reasonable way to hack in an infinite timeout into timed_prompt if we want to make that a properly modal dialog.

@ahesford ahesford force-pushed the init-for-the-long-haul branch from bd01efb to 76aac76 Compare March 2, 2024 17:46
@ahesford ahesford force-pushed the init-for-the-long-haul branch from 76aac76 to 517af46 Compare March 2, 2024 17:57
@ahesford
Copy link
Member Author

ahesford commented Mar 2, 2024

OK, I extended your patch to timed_prompt to accept non-positive values for infinite delays, and use that in bin/zfsbootmenu.

@zdykstra
Copy link
Member

zdykstra commented Mar 3, 2024

This all looks great!

@ahesford ahesford merged commit 2994512 into master Mar 3, 2024
3 checks passed
@ahesford ahesford deleted the init-for-the-long-haul branch March 3, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants