1. If using virtio disk, add driver to initrd:

    echo 'filesystems+=" virtio_blk "' >> /etc/dracut.conf.d/fs.conf
  2. Create empty cache file and generate initrd:

    rm -f /etc/zfs/zpool.cache
    touch /etc/zfs/zpool.cache
    chmod a-w /etc/zfs/zpool.cache
    chattr +i /etc/zfs/zpool.cache
    for directory in /lib/modules/*; do
      kernel_version=$(basename $directory)
      dracut --force --kver $kernel_version
  3. Load ZFS modules and disable BLS:

    echo 'GRUB_ENABLE_BLSCFG=false' >> /etc/default/grub
  4. Apply GRUB workaround:

    echo 'export ZPOOL_VDEV_NAME_PATH=YES' >> /etc/profile.d/
    source /etc/profile.d/
    # GRUB fails to detect rpool name, hard code as "rpool"
    sed -i "s|rpool=.*|rpool=rpool|"  /etc/grub.d/10_linux

    This workaround needs to be applied for every GRUB update, as the update will overwrite the changes.

  5. Install GRUB:

    mkdir -p /boot/efi/almalinux/grub-bootdir/i386-pc/
    mkdir -p /boot/efi/almalinux/grub-bootdir/x86_64-efi/
    for i in ${DISK}; do
     grub2-install --target=i386-pc --boot-directory \
         /boot/efi/almalinux/grub-bootdir/i386-pc/  $i
    cp -r /usr/lib/grub/x86_64-efi/ /boot/efi/EFI/almalinux/
  6. Generate GRUB menu:

    grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg
    grub2-mkconfig -o /boot/efi/almalinux/grub-bootdir/i386-pc/grub2/grub.cfg
  7. For both legacy and EFI booting: mirror ESP content:

    ESP_MIRROR=$(mktemp -d)
    unalias -a
    cp -r /boot/efi/EFI $ESP_MIRROR
    for i in /boot/efis/*; do
     cp -r $ESP_MIRROR/EFI $i
    rm -rf $ESP_MIRROR
  8. Notes for GRUB on RHEL

    As bls is disabled, you will need to regenerate GRUB menu after each kernel upgrade. Or else the new kernel will not be recognized and system will boot the old kernel on reboot.

Finish Installation

  1. Exit chroot:

  2. Export pools:

    umount -Rl /mnt
    zpool export -a
  3. Reboot:

  4. On first reboot, the boot process will fail, with failure messages such as “You are in Emergency Mode…Press Ctrl-D to continue”.

    Wait for the computer to automatically reboot and the problem will be resolved.

Post installaion

  1. Install package groups:

    dnf group list --hidden -v       # query package groups
    dnf group install @gnome-desktop
  2. Add new user, configure swap.