zfs-import-cache.service fails on startup – How to Fix
Recently I’ve upgraded ZFS on Linux to 0.6.3 on my CentOS 7 server.
After reboot my pool was not available and I was only capable to force the import.
In the logs I had:
Oct 24 10:26:33 hs kernel: SPL: using hostid 0x00000000 Oct 24 10:26:34 hs zpool: cannot import 'tank': pool may be in use from other system Oct 24 10:26:34 hs zpool: use '-f' to import anyway Oct 24 10:26:34 hs systemd: zfs-import-cache.service: main process exited, code=exited, status=1/FAILURE Oct 24 10:26:34 hs systemd: Failed to start Import ZFS pools by cache file. Oct 24 10:26:34 hs systemd: Unit zfs-import-cache.service entered failed state.
After quick search on the Internet I found that I’m not alone.
Original thread is here: https://github.com/zfsonlinux/zfs/issues/2575.
The fix for me was to create hostid:
dd if=/dev/urandom of=/etc/hostid bs=4 count=1