mirror_zfs/contrib/dracut/90zfs
Érico Rolim 24c12b48a1 config/dracut/90zfs: handle cases where hostid(1) returns all zeros
On systems with musl libc, hostid(1) always prints "00000000", which
will cause improper behavior when the 90zfs module is configured in a
dracut initramfs. Work around this by copying the host /etc/hostid if
the file exists, and otherwise only write /etc/hostid if hostid(1)
returns something meaningful. This avoids zgenhostid creating a random
/etc/hostid for the initramfs, which could lead to errors when trying to
import the pool if spl_hostid isn't defined in the kernel command line.

Furthermore, tag the /etc/hostid file as hostonly, since it is system
specific and shouldn't be taken into account when trying to use an
initramfs generated in one system to boot into a different system.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
Signed-off-by: Érico Rolim <erico.erc@gmail.com>
Closes #11174
Closes #11189
2020-11-14 17:21:54 -08:00
..
.gitignore Add bootfs.snapshot and bootfs.rollback kernel parameters 2020-05-29 21:16:08 -07:00
export-zfs.sh.in Silence 'make checkbashisms' 2020-08-20 13:45:47 -07:00
Makefile.am Centralize variable substitution 2020-07-14 17:33:44 -07:00
module-setup.sh.in config/dracut/90zfs: handle cases where hostid(1) returns all zeros 2020-11-14 17:21:54 -08:00
mount-zfs.sh.in Silence 'make checkbashisms' 2020-08-20 13:45:47 -07:00
parse-zfs.sh.in cmd/zgenhostid: replace with simple c implementation 2020-09-16 12:25:12 -07:00
zfs-env-bootfs.service.in Move dracut specifics to dracut module 2019-04-02 17:14:39 -07:00
zfs-generator.sh.in bash scripts: use /usr/bin/env for bash shebangs 2020-02-10 13:13:46 -08:00
zfs-lib.sh.in Silence 'make checkbashisms' 2020-08-20 13:45:47 -07:00
zfs-load-key.sh.in Silence 'make checkbashisms' 2020-08-20 13:45:47 -07:00
zfs-needshutdown.sh.in Silence 'make checkbashisms' 2020-08-20 13:45:47 -07:00
zfs-rollback-bootfs.service.in Add bootfs.snapshot and bootfs.rollback kernel parameters 2020-05-29 21:16:08 -07:00
zfs-snapshot-bootfs.service.in Add bootfs.snapshot and bootfs.rollback kernel parameters 2020-05-29 21:16:08 -07:00