Troubles with changing hostid's

Oh, how lucky, that i found this site, because it feels like i am missing something:
After years of using zfs without ever going root with it, i finally gave it a try. And after due preparation it seems to work, but …
… for the time being, i am dual booting this box, the old OS, debian buster uses the same pool(s) as the new root install of bookworm. The first still boots from grub, the newer one from zbm.efi.

I had been using dual boot in the past with different environments accessing the same pools, as i can only run one partition at a time, There was no conflict. This week, i was able to switch systems, each of them accessing pools with same hostid just fine.

But after some work being done, zbm began to introduce a different hostid, and since, the 2 OS/hostid’s are out of sync, which leads to zpool import telling me, the pool was in use by another system, inviting a forced import. But i would rather want to sync the 2 once again.

I am aware of commandline options spl.spl_hostid, but that helps only temporarily. I also have been using a live system, zgenhostid and import/export of a pool, also update-initramfs sometimes helps, but i fail to understand when it happens and why. Anyone more knowledgeable in here?

How to deal with my mess the proper way?
thanks, bardo

What is the kernel command line (as reported by /proc/cmdline) from each OS after you’ve booted it? ZFSBootMenu will read the hostid from the pool itself if it doesn’t match the default internal value we’ve set, reconfigure itself to use that / pass that on to each boot environment.

The only time that becomes a problem is if your hostid is 0, because that’s a special value for the spl.spl_hostid module parameter - some initramfs frameworks handle it, others do not.

The generalized solution is to set the hostid to be the same across every boot environment via zgenhostid and then rebuild each initramfs to make sure the updated /etc/hostid is in each one.

1 Like

Thank you for your pointers, the helpful explanations …
While trying to apply your knowledge, i found the mistake of my ways:
Whenever i looked at /etc/hostid, i used the command hd (hexdump). unfortunately, the bytes from the commandline were reversed, and i did not notice it. A better command would have been:
xxd -e /etc/hostid # reverses little-endian display
After understanding this, and with your help, i was able to clean up my mess.
Thank you very much! <3
bardo

1 Like

Hey, the problem is back!
now, i understand this: the difference was, that i had to enter emergency shell once, and that may have caused the problem.
I will certainly be able to work around it, but it is getting nasty.
Unfortunately, i could not get generate-zbm to work, neither for dracut nor for initramfs, there seem to be missing parts (in bookworm-kde). Any suggestion maybe?
best regards, bardo

What is your actual hostid on each system? With out knowing that, I can’t propose a targeted solution to the problem.

Hello,
i am having all kind of problems, that are unrelated to zfs. Lots of learning necessary…
The good news: zfs is helping quite a bit, especially since i found, that zbm-kcl was enough to introduce my “favorite hostid” into zbm’s command line.
Thank you very much for taking care … of that wonderful alternative to grub!

I guess, that it is not unusual while using zbm, that an OS, started by it, can not reboot properly. The machine does not “cold boot”, but apparently goes directly to some form of restarting the os, which fails to show any desktop.

Another unexpected problem:
After using UEFI to boot another system (with grub installed) i can configure grub to start efi executables (like say memtest86.efi via chainloader), but the zbm.efi cannot be started this way, grub always complains about some line missing … :frowning:

i assume, that never got priority in development. And i have not been able to work around those…

Do you?