-
Notifications
You must be signed in to change notification settings - Fork 95
Add support to discover and assume a hostid, as well as fix arguments passed to a BE #147
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…pl_hostid fixer in BE KCL
ahesford
approved these changes
Feb 23, 2021
Member
ahesford
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good solution to a long-standing problem. When we distribute a UEFI bundle, it should set zbm.import_policy=hostid and not disable zbm.set_hostid. We can advise people who use prebuilt initramfs/kernel combinations to set these by whatever means they use.
eb51a5d to
e69fead
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A persistent problem with ZFS and now with ZFSBootMenu is getting
spl.spl_hostidlined up on all pool imports. The contents of an initramfs and the kernel command line can influence this value, making it difficult to determine exactly where and how to change it to get a system to boot.To help combat this recurring issue, ZBM now accepts the following options to control importing behavior.
zbm.import_policy=strict: If no pools can be imported with the hostid embedded in the initramfs, or set viaspl_hostidon the ZBM command line, drop to a recovery shell.zbm.import_policy=hostid: If no pools can be imported with the hostid embedded in the initramfs, or set viaspl_hostidon the ZBM command line, attempt to scrape the hostid used to import the pool defined inroot=zfsbootmenu:POOL=<value>and import the pool. If that pool is missing or can't be imported, any other available pool is scraped for a hostid and attempted to be imported.zbm.import_policy=force: YOLO mode, just force import a pool. Replaces `zbm.force_import'.Right now, when undefined,
zbm.import_policyis set tostrict.With this option available, ZBM can now in most cases import any pool - regardless of the
hostidof the system that built the initramfs or the EFI executable.Next is to ensure that the boot environment imports the pool correctly. Some ZFS initramfs modules can use
spl_hostidto write out/etc/hostidin the initramfs before loading SPL/ZFS modules. Others ... like Arch ... not only do not by default include/etc/hostidin the initramfs, they do not have any methods to line upspl_hostidon the kernel command line with/etc/hostid. However,spl.spl_hostidtakes precedence over/etc/hostid, so we can simply set this on the kernel command line. To this end, we now:spl_hostidif it's part of the discovered command line for a boot environmentspl.spl_hostidif it's part of the discovered command line for a boot environmentspl.spl_hostid=0x<hostid>on the command line for each boot environment.Since we know the
hostidused to import a pool - either discovered inzfsbootmenu-parse-commandline.sh, or discovered whenzbm.import_policy=hostidis set. Suppression / rewriting can be disabled viazbm.set_hostid=0when booting ZBM.I'm unsure if we should default this behavior to on, or make it opt-in initially for people installing ZBM from
masteror Void packages. When building binary releases,zbm.import_policy=hostidandzbm.set_hostid=1should be set, to be maximally usable for people randomly downloading it to test.