This was surprising to me: # dd if=/dev/urandom of=/dev/stdout bs=1 count=4 > /etc/hostid # hexdump /etc/hostid 0000000 9872 1823 0000004 $ hostid 72982318 # xzcat /boot/initramfs | cpio -id # hexdump ./etc/hostid 0000000 2318 7298 0000004 The byte order in the file in the initramfs is incorrect. In my case, with a root ZFS, this value is loaded first at initramfs time, from this incorrect value. Then forever on after the system is booted, "zpool status" will complain about a mismatch. Workaround: copy the hostid file out of the initramfs into /etc/ of the booted system and the error goes away. Probably manually copying the file _into_ the initramfs would work as well. I believe this should not happen. After running genkernel, the hostid file in the initramfs should match that in /etc/ exactly. It appears that today genkernel is doing: printf "$(hostid | sed 's/\([0-9A-F]\{2\}\)/\\x\1/gI')" > ${TEMP}/initramfs-base-temp/etc/hostid But this is incorrect, due to the network ordering of the bytes in that file. Note the difference between the output of the first hexdump and hostid commands above.
I've got the exact same problem; apoc ~ # hexdump /etc/hostid 0000000 6302 a8c0 0000004 Doing the same on the output of the line from ./gen_initramfs.sh: apoc ~ # printf "$(hostid | sed 's/\([0-9A-F]\{2\}\)/\\x\1/gI')" | hexdump 0000000 c0a8 0263 0000004 Adding perl -0777e 'print scalar reverse <>' fixes this; printf "$(hostid | sed 's/\([0-9A-F]\{2\}\)/\\x\1/gI')" | perl -0777e 'print scalar reverse <>' | hexdump 0000000 6302 a8c0 0000004
Same issue observed today. Once I extracted the hostid file from the initramfs - all was happy.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=4e46cfcd6f50560a9e8c31163663940a99875e0c commit 4e46cfcd6f50560a9e8c31163663940a99875e0c Author: Thomas Deutschmann <whissi@gentoo.org> AuthorDate: 2019-03-27 11:53:54 +0000 Commit: Thomas Deutschmann <whissi@gentoo.org> CommitDate: 2019-03-27 11:53:54 +0000 ZFS: Change hostid handling No need to deal with hostid value: We assume that /etc/hostid exists if ZFS is used. So just copy that existing file. If file is missing tell user that kernel command-line parameter "spl_hostid=<hostid>" must be used. Same is true when generated initramfs is used for multiple systems. Closes: https://bugs.gentoo.org/531192 Closes: https://bugs.gentoo.org/616738 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> gen_initramfs.sh | 26 ++++++++++++-------------- genkernel | 23 +++++++++++++++++++---- 2 files changed, 31 insertions(+), 18 deletions(-)