terem42 / zfs-hetzner-vm

script to install Debian 10, 11, 12 and Ubuntu 18, 20, 22 LTS with ZFS root on Hetzner VPS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grub-install: error: unknown filesystem

proligde opened this issue · comments

Hi there,

first of all - thanks for the great script! Unfortunately, I stumbled across a problem I seem to be unable to fix myself: After the majority of the installation finished without issues, it crashes while installing grub with:

Creating config file /etc/default/grub with new version
Processing triggers for man-db (2.11.2-2) ...
Installing for i386-pc platform.
grub-install: error: unknown filesystem.

I tried it with both Ubuntu 22.04 and Debian12, but got the same result. The rescue system on hetzner itself is currently a Debian12, too.

I switched to the chrooted environment manually and run the command again with verbose output (see attached File)

log.txt

Additional info: The server is a new AX52 with two nvme's and as far as I can tell, it boots in UEFI mode. Maybe that is an issue?

Reverting latest commit seems to fix this issue.

Unfortunately scripts then fails when installing zst with "zfs command not found" on line 479 or so.

commented

I worked around this with the latest commit by:

  1. Installing ZFS from the hetzner rescue script (on server in rescue mode just type zfs and hit y. This compiles from latest openzfs release, and so takes some time. Hetzner script can be viewed here

  2. Then apt get update && apt get upgrade

  3. I then commented out lines 499 to 510 in this Debian 12 script to stop it replacing the ZFS we've just compiled:

echo "======= installing zfs on rescue system =========="
# echo "zfs-dkms zfs-dkms/note-incompatible-licenses note true" | debconf-set-selections  
#  echo "y" | zfs
# linux-headers-generic linux-image-generic
#  apt install --yes software-properties-common dpkg-dev dkms
#  rm -f "$(which zfs)"
#  rm -f "$(which zpool)"
#  echo -e "deb http://deb.debian.org/debian/ testing main contrib non-free\ndeb http://deb.debian.org/debian/ testing main contrib non-free\n" >/etc/apt/sources.list.d/bookworm-testing.list
#  echo -e "Package: src:zfs-linux\nPin: release n=testing\nPin-Priority: 990\n" > /etc/apt/preferences.d/90_zfs
#  apt update  
#  apt install -t testing --yes zfs-dkms zfsutils-linux
#  rm /etc/apt/sources.list.d/bookworm-testing.list
#  rm /etc/apt/preferences.d/90_zfs
  apt update
  export PATH=$PATH:/usr/sbin
  zfs --version
  1. I also added -o compatibility=grub2 \ to the boot pool zpool create on line 554. This was based on the OpenZFS HOWTO for Debian bookworm. This stops flags being add from newer versions of ZFS which are incompatible with GRUB2
# shellcheck disable=SC2086
zpool create \
  $v_bpool_tweaks -O canmount=off -O devices=off \
  -o compatibility=grub2 \
  -o autotrim=on \
  -O normalization=formD \
  -O relatime=on \
  -O acltype=posixacl -O xattr=sa \
  -o cachefile=/etc/zpool.cache \
  -O mountpoint=/boot -R $c_zfs_mount_dir -f \
  $v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"

Tested on a Hetzner with legacy BIOS with nvmes but obviously this is all at your own risk.

It looked to me like the issue was flags on the boot pool from the newer version of ZFS not being compatible with GRUB2. Specifically for me: com.klarasystems:vdev_zaps_v2

commented

On Ubuntu 20.04 I had to also configure the zpool create command for the rpool to deactivate a couple of features:

# shellcheck disable=SC2086
echo -n "$v_passphrase" | zpool create \
  $v_rpool_tweaks \
  -o feature@head_errlog=disabled \
  -o feature@vdev_zaps_v2=disabled \
  -o feature@zilsaxattr=disabled \
  -o cachefile=/etc/zpool.cache \
  "${encryption_options[@]}" \
  -O mountpoint=/ -R $c_zfs_mount_dir -f \
  $v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"

Hit this issue on Ubuntu 22.04 as well.

Edit: this PR fixed it: #71