You are not logged in.

#1 2020-05-30 02:38:37

posop
Member
Registered: 2019-05-14
Posts: 13

Can't Configure Grub for BIOS when Installing Arch on ZFS

as the title suggests I cannot get across the finish line installing arch on zfs.  I get to the point where I try and install grub on my /boot after chrooting into my /mnt from the live cd.  anyway here is my command and error:

# nvim /etc/grub.d/40_custom
set timeout=5
set default=0

menuentry "Arch Linux" {
   search -u UUID
   linux /vmlinuz-linux zfs=rpool/ROOT/default rw
   initrd /initramfs-linux.img
}

Then I try and make my grub via:

# ZPOOL_VDEV_NAME_PATH=1 grub-mkconfig -o /boot/grub/grub.cfg

And I get this error:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
/usr/bin/grub-probe: error: unknown filesystem.
Found fallback initrd images(s) in /boot: initramfs-linux-fallback.img
done

As you can see I am getting an unknown filesystem error, however when I run:

# grub-probe /

I get

zfs

So I see zfs when I run grub-probe but get unknown filesystem when I run grub-mkconfig.

Not sure what information you need to help me track this down... been googling and hacking on this for 2 days now, I would really appreciate some help on this one.

Last edited by posop (2020-05-30 02:40:34)

Offline

#2 2020-05-30 15:12:04

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,679
Website

Re: Can't Configure Grub for BIOS when Installing Arch on ZFS

https://wiki.archlinux.org/index.php/Zf … l_creation?

Why are you trying to use 40_custom? The grub-mkconfig script should be able to generate a working boot entry for you. Also the paths to the kernel & initramfs images are wrong if /boot is on a ZFS dataset: https://wiki.archlinux.org/index.php/In … bootloader

Offline

#3 2020-05-30 17:38:54

posop
Member
Registered: 2019-05-14
Posts: 13

Re: Can't Configure Grub for BIOS when Installing Arch on ZFS

Head_on_a_Stick wrote:

Why are you trying to use 40_custom?

The truth is I've tried with and without using 40_custom, I've gotten the furthest with this...

Head_on_a_Stick wrote:

The grub-mkconfig script should be able to generate a working boot entry for you.

So to do this properly I simply delete my 40_custom entry? or do I have to update something else in its place?

Head_on_a_Stick wrote:

Also the paths to the kernel & initramfs images are wrong if /boot is on a ZFS dataset:

I am using legacy BIOS, I thought I had to leave this outside the ZFS dataset.  Here is the scripts I wrote to get along this far.  You can see how I am creating my boot drive for BIOS outside the zfs structure:

D0= /dev/disk/by-id/ata-QEMU_HARDDISK-qm00001
D1= /dev/disk/by-id/ata-QEMU_HARDDISK-qm00002

# Partition the drives and format boot partition
sgdisk -n1:0:+400M -t1:ef02 ${D0}
sgdisk -n2:0:0 -t2:bf00 ${D0}
mks.vfat ${D0}-part1

sgdisk -n1:0:+400M -t1:ef02 ${D1}
sgdisk -n2:0:0 -t2:bf00 ${D1}
mks.vfat ${D1}-part1

zpool create -f -o ashift=12 rpool mirror ${D0}-part2 ${D1}-part2

zfs set atime=on rpool
zfs set relatime=on rpool

# Creating datasets
zfs create -o mountpoint=none rpool/data
zfs create -o mountpoint=none rpool/ROOT
zfs create -o mountpoint=/ -o canmount=noauto rpool/ROOT/default
zfs create -o mountpoint=/home rpool/data/home
zfs create -o mountpoint=/root rpool/data/home/root

# Import / Export
zfs umount -a
zpool export rpool
rm -rf /mnt/*
zpool import -d /dev/disk/by-id/ -R /mnt rpool -N

# Mount rootfs dataset
zfs mount rpool/ROOT/default
zfs mount -a

# Set bootfs property
zpool set bootfs=rpool/ROOT/default rpool

# Mount boot partition
mkdir /mnt/boot
mount --rw -t vfat ${D0}-part1 /mnt/boot

# Generate fstab
mkdir -p /mnt/etc
genfstab -U -p /mnt >> /mnt/etc/fstab

# Install Base System
pacstrap /mnt base base-devel linux linux-firmware neovim

# Edit mkinitcpio
sed -i 's/keyboard/keyboard zfs/g' /mnt/etc/mkinitcpio.conf

# Chroot into new system
arch-chroot /mnt

Then in my Chroot environment I am doing:

# Add archzfs to repository
echo "[archzfs]" >> /etc/pacman.conf
echo "SigLevel = Optional TrustAll" >> /etc/pacman.conf
echo 'Server = http://archzfs.com/$repo/x86_64' >> /etc/pacman.conf
pacman-key -r F75D9D76
pacman-key --lsign-key F75D9D76
pacman -Syu --noconfirm

# Configure time zone
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc

# Generate locale
sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf

# Set hostname
echo zarch > /etc/hostname
echo -e "127.0.0.1 localhost\n::1 localhost" >> /etc/hosts

# Install packages
pacman -Syu zfs-linux neovim sudo dhcpcd grub

# Make networking work after reboot
systemctl enable dhcpcd@ens3.service

# Set up zpool.cache
zpool set cachefile=/etc/zfs/zpool.cache rpool

# remake mkinitcpio
mkinitcpio -p linux
# zpool set cachefile=/etc/zfs/zpool.cache rpool

# Set up grub
grub-install /dev/sda
ZPOOL_VDEV_NAME_PATH=1 grub-mkconfig -o /boot/grub/grub.cfg

Everything seems to be going well until I get to the #Set up grub, but I am also sure I'm doing something wrong before that since my install is breaking at that point.

Thank you foryour help so far.  the linked sites seem to be addressing the canonical path issue but not my unknown filesystem error.

The sites I've looked at to get me thus far are:
https://wiki.archlinux.org/index.php/In … nux_on_ZFS


And Referenced:

https://openzfs.github.io/openzfs-docs/ … 20ZFS.html

https://wiki.archlinux.org/index.php/GRUB#BIOS_systems

https://ramsdenj.com/2016/06/23/arch-li … ation.html

https://gist.github.com/p7cq/f9993eba4c … bf0dd266b1

Thank you for helping me think through this.  I really appreciate any pointers.

Offline

#4 2020-05-30 18:02:20

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,679
Website

Re: Can't Configure Grub for BIOS when Installing Arch on ZFS

posop wrote:

So to do this properly I simply delete my 40_custom entry? or do I have to update something else in its place?

You don't have to delete 40_custom (it will just be added as an extra entry) but you shouldn't need it at all. And anyway you haven't set the root device in that file so I don't think it would work.

posop wrote:

I am using legacy BIOS, I thought I had to leave this outside the ZFS dataset.

No, not at all. If you have a disk with a GUID partition table (GPT) then you will need a BIOS boot partition (type "ef02" in {s,}gdisk) but that is just to hold GRUB's core.img — it shouldn't have a filesystem and it certainly shouldn't be mounted under /boot

If you're using a non-UEFI system then I would recommend an MS-DOS partition table ("MBR" style) instead, some machines won't boot in non-UEFI mode from a GPT disk.

Offline

Board footer

Powered by FluxBB