Mkinitcpio step on install fails: ERROR: Hook 'zfs' cannot be found

Hello! I'm a long time Manjaro user and am trying to make the switch to Garuda, however I keep getting hung up on this error message while installing through the live USB:

Command <i>mkinitcpio</i> finished with exit code 1.
Output:
==> Building image from preset: /etc/mkinitcpio.d/linux-zen.preset: 'default'
  -> -k /boot/vmlinuz-linux-zen -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-zen.img
==> Starting build: 5.15.12-zen1-1-zen
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
  -> Running build hook: [plymouth]
==> ERROR: Hook 'zfs' cannot be found
  -> Running build hook: [resume]
  -> Running build hook: [filesystems]

Decompress:  1/22 files. Current: ...ire-sbp2.ko.zst : 0 B...    ==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-zen.img
==> WARNING: errors were encountered during the build. The image may not be complete.
==> Building image from preset: /etc/mkinitcpio.d/linux-zen.preset: 'fallback'
  -> -k /boot/vmlinuz-linux-zen -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-zen-fallback.img -S autodetect
==> Starting build: 5.15.12-zen1-1-zen
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [consolefont]
  -> Running build hook: [plymouth]
==> ERROR: Hook 'zfs' cannot be found
  -> Running build hook: [resume]
  -> Running build hook: [filesystems]

Decompress:  1/630 files. Current: ...l/initio.ko.zst : 0 B...    
Decompress: 275/630 files. Current: .../libceph.ko.zst : 0 B...    
Decompress: 538/630 files. Current: ...rnel/bfa.ko.zst : 1.25 MiB...    ==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-zen-fallback.img
==> WARNING: errors were encountered during the build. The image may not be complete.

I've tried searching through the Garuda forums, arch forums, google, etc. and can't seem to find other folks who have had some sort of issue with zfs and mkinitcpio.

I'm installing onto an SSD formatted with BTRFS and GPT.

[[email protected] ~]# inxi -Fxxxza
System:
Kernel: 5.15.12-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/boot/vmlinuz-x86_64 lang=en_US keytable=us tz=UTC
misobasedir=garuda misolabel=GARUDA_DR460NIZED_WHITETAILEDEAG quiet
systemd.show_status=1 driver=free nouveau.modeset=1 i915.modeset=1
radeon.modeset=1
Console: pty pts/0 wm: kwin_x11 DM: SDDM Distro: Garuda Linux
base: Arch Linux
Machine:
Type: Desktop Mobo: ASRock model: Z97 Extreme6 serial: <filter>
UEFI: American Megatrends v: P2.50 date: 10/06/2015
CPU:
Info: model: Intel Core i5-4690K socket: BGA1155 bits: 64 type: MCP
arch: Haswell family: 6 model-id: 0x3C (60) stepping: 3 microcode: 0x28
Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 256 KiB
desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB
desc: 1x6 MiB
Speed (MHz): avg: 2243 high: 3637 min/max: 800/3900 base/boost: 3500/3800
scaling: driver: intel_cpufreq governor: schedutil volts: 1.2 V
ext-clock: 100 MHz cores: 1: 3637 2: 1554 3: 1508 4: 2276 bogomips: 27991
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Vulnerabilities:
Type: itlb_multihit status: KVM: VMX disabled
Type: l1tf
mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled
Type: mds mitigation: Clear CPU buffers; SMT disabled
Type: meltdown mitigation: PTI
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional,
IBRS_FW, STIBP: disabled, RSB filling
Type: srbds mitigation: Microcode
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: AMD Hawaii PRO [Radeon R9 290/390] vendor: Micro-Star MSI
driver: radeon v: kernel alternate: amdgpu bus-ID: 01:00.0
chip-ID: 1002:67b1 class-ID: 0300
Display: server: X.Org 1.21.1.2 compositor: kwin_x11 driver:
loaded: ati,radeon unloaded: modesetting alternate: fbdev,vesa
display-ID: :0 screens: 1
Screen-1: 0 s-res: 2560x1440 s-dpi: 96 s-size: 677x381mm (26.7x15.0")
s-diag: 777mm (30.6")
Monitor-1: DisplayPort-0 res: 2560x1440 hz: 60 dpi: 109
size: 597x336mm (23.5x13.2") diag: 685mm (27")
Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:
Device-1: Intel 9 Series Family HD Audio vendor: ASRock
driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8ca0
class-ID: 0403
Device-2: AMD Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X]
vendor: Micro-Star MSI driver: snd_hda_intel v: kernel bus-ID: 01:00.1
chip-ID: 1002:aac8 class-ID: 0403
Sound Server-1: ALSA v: k5.15.12-zen1-1-zen running: yes
Sound Server-2: JACK v: 1.9.19 running: no
Sound Server-3: PulseAudio v: 15.0 running: no
Sound Server-4: PipeWire v: 0.3.42 running: yes
Network:
Device-1: Intel Ethernet I218-V vendor: ASRock driver: e1000e v: kernel
port: f040 bus-ID: 00:19.0 chip-ID: 8086:15a1 class-ID: 0200
IF: enp0s25 state: up speed: 100 Mbps duplex: full mac: <filter>
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: ASRock driver: r8169 v: kernel port: d000 bus-ID: 05:00.0
chip-ID: 10ec:8168 class-ID: 0200
IF: enp5s0 state: down mac: <filter>
Bluetooth:
Device-1: Broadcom BCM20702A0 Bluetooth 4.0 type: USB driver: btusb v: 0.8
bus-ID: 3-9.1:6 chip-ID: 0a5c:21e8 class-ID: fe01 serial: <filter>
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Drives:
Local Storage: total: 2.33 TiB used: 6.55 GiB (0.3%)
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
model: WDS100T2B0C-00PXH0 size: 931.51 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: 211210WD temp: 54.9 C scheme: GPT
SMART: yes health: PASSED on: 138d 6h cycles: 176
read-units: 1,324,325 [678 GB] written-units: 4,424,785 [2.26 TB]
ID-2: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 850 EVO 250GB
family: based SSDs size: 232.89 GiB block-size: physical: 512 B
logical: 512 B sata: 3.1 speed: 6.0 Gb/s type: SSD serial: <filter>
rev: 1B6Q temp: 25 C scheme: GPT
SMART: yes state: enabled health: PASSED on: 1y 112d 7h cycles: 1710
written: 5.41 TiB
ID-3: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 840 EVO 250GB
family: based SSDs size: 232.89 GiB block-size: physical: 512 B
logical: 512 B sata: 3.1 speed: 6.0 Gb/s type: SSD serial: <filter>
rev: BB6Q temp: 27 C scheme: GPT
SMART: yes state: enabled health: PASSED on: 1y 308d 14h cycles: 2758
written: 13.03 TiB
ID-4: /dev/sdc maj-min: 8:32 vendor: Samsung model: SSD 870 EVO 1TB
size: 931.51 GiB block-size: physical: 512 B logical: 512 B sata: 3.3
speed: 6.0 Gb/s type: SSD serial: <filter> rev: 1B6Q temp: 21 C
scheme: GPT
SMART: yes state: enabled health: PASSED on: 139d 5h cycles: 175
written: 3.79 TiB Pre-Fail: reallocated sector: 99 threshold: 10
ID-5: /dev/sdd maj-min: 8:48 type: USB vendor: Patriot model: N/A
size: 60.54 GiB block-size: physical: 512 B logical: 512 B type: N/A
serial: <filter> rev: PMAP scheme: MBR
SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 15.57 GiB used: 1013.2 MiB (6.4%)
priority: 100 dev: /dev/zram0
Sensors:
System Temperatures: cpu: 35.0 C mobo: N/A gpu: radeon temp: 61.0 C
Fan Speeds (RPM): N/A
Info:
Processes: 235 Uptime: 1h 25m wakeups: 0 Memory: 15.57 GiB
used: 5.07 GiB (32.5%) Init: systemd v: 250 tool: systemctl Compilers:
gcc: 11.1.0 clang: 13.0.0 Packages: pacman: 1180 lib: 294 Shell: Bash (su)
v: 5.1.12 running-in: konsole inxi: 3.3.11

I've tried the Dr460nized (garuda-dr460nized-linux-zen-220101.iso) and gnome (garuda-gnome-linux-zen-220101.iso) editions, verifying the shasums, and I'm flashing my USB using balenaEtcher on OSX.

While looking around the filesystem, the only thing I could really find in regards to this error was that the zsh hook is indeed included in the mkinitcpio.conf file on the target install drive. Here is the mkinitcpio.conf on the target install drive, after the install errored-out:

[[email protected] etc]# pwd
/tmp/calamares-root-b74a4t12/etc
[[email protected] etc]# cat mkinitcpio.conf
# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(crc32c-intel intel_agp i915 amdgpu radeon nouveau)
MODULES="crc32c-intel"

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No raid, lvm2, or encrypted root is needed.
#    HOOKS=(base)
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS=(base udev autodetect block filesystems)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev block filesystems)
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS=(base udev block mdadm encrypt filesystems)
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS=(base udev block lvm2 filesystems)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS="base udev autodetect modconf block keyboard keymap consolefont plymouth zfs resume filesystems"

# COMPRESSION
# Use this to compress the initramfs image. By default, zstd compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

And after chrooting into the target install drive, here is the output of mkinitcpio -L, showing the zsh hook isn't present:

[[email protected] /]# mkinitcpio -L
==> Available hooks
autodetect  grub-btrfs-overlayfs modconf         sd-shutdown
base     hostdata       net      sd-vconsole
block    keyboard       openswap   shutdown
btrfs    keymap    plymouth     sleep
consolefont   lvm2         plymouth-encrypt strip
dmraid     mdadm¹          resume     systemd
encrypt    mdadm_udev      sd-encrypt  systemd-tool
filesystems   memdisk        sd-lvm2²  udev
fsck     mhwd-fb        sd-plymouth   usr

¹ This hook is deprecated in favor of 'mdadm_udev'
² This hook is deprecated in favor of 'lvm2'

Not sure if this is a bug or a mistake on my part- any guidance would be greatly appreciated, thanks!

1 Like

Huh, I guess calamares incorrectly assumes you want to use ZFS?

I think i can help out with this later I'm just at work right now I'll get back to you if I remember :slight_smile:

3 Likes

Run this in a terminal before starting calamares, and it should work:
sudo sed -r '/(if uses_zfs:|hooks.append\("zfs"\))/d' -i /usr/lib/calamares/modules/initcpiocfg/main.py

5 Likes

Do you have any ZFS volumes present on your disks?

4 Likes

I am not sure I tested that scenario. It is possible that having zfs partitions you are not replacing would cause that issue.

1 Like

Running that sed command from @TNE did the trick and i was able to install without a problem! Thank you for the quick help! I'm writing this reply on a new Garuda install.

I have four drives in my machine but I can't quite remember if I was using zfs or not. I'd lean on the side that I did have a zfs partition though, as one of my drives I was passing through to a TrueNAS VM, which favors zfs pretty heavily.

2 Likes

I mean, to be fair, even if those were present, it should never ever add the hook if zfs packages aren't installed.

Right, I am saying it is a bug I will need to do a PR for. It is a scenario that I didn't consider or test. When I was doing the development, I didn't realize that the Partition structure in Calamares contained all the partitions, not only the partitions that were part of the current install.

It needs to ensure that the partition it is checking is one of the partitions that is part of the installation or check for zfs module enablement. Either of those should achieve the same goal.

If a distro decides to enable the zfs module and not include zfs support that is on them. :innocent:

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.