Solved Shutdown stuck for dual booting Windows10 + FreeBSD with ZFS and GELI

My goal was to install FreeBSD with GELI and ZFS alongside of currently installed Windows 10. I am testing it on an Oracle Virtual Box with EFI turned on. I have continued FreeBSD setup up to the Partitioning step, then selected shell and entered the following,
Code:
     gpart add -t freebsd-swap -s 2G ada0
     gpart add -t freebsd-zfs ada0

     geli init -g -s 4k ada0p6
     geli attach ada0p6

     zpool create -o ashift=12 -O compression=lz4 -O atime=off -m none -R /mnt tank ada0p6.eli
     zfs create -o canmount=off tank/os
     zfs create -o canmount=noauto -o mountpoint=/ tank/os/main
     zfs mount tank/os/main
     zfs create -o mountpoint=/usr/home tank/home

     zpool set bootfs=tank/os/main tank
     mkdir -p /mnt/boot/efi
     mount -t msdosfs /dev/ada0p1 /mnt/boot/efi

     vi /tmp/bsdinstall_etc/fstab
     # Add the following lines,
     # /dev/<boot-partition-name>        /boot/efi    msdosfs    rw         2    2
     # /dev/<swap-partition-name>.eli    none         swap       sw,late    0    0
     exit
After that continued the regular installation until Manual Configuration and selected yes. Then I entered the following,
Code:
     vi /boot/loader.conf
     # Add the following lines,
     # # GELI module
     # geom_eli_load="YES"

     vi /etc/rc.conf
     # Add the following line,  
     # zfs_enable="YES"
     exit
Finally, at Complete step, I selected Live CD and logged in as root and entered the following,
Code:
     umount /dev/ada0p1
     zfs unmount tank/home
     zfs unmount tank/os/main
     zfs inherit mountpoint tank/os/main
     reboot
After successful booting, I installed and configured refind as follows,
Code:
mount -t msdosfs /dev/ada0p1 /media # /dev/ada0p1 Windows10's EFI

cd /tmp
fetch https://nchc.dl.sourceforge.net/project/refind/0.13.1/refind-bin-0.13.1.zip
unzip refind-bin-0.13.1.zip

cd /media/EFI/Boot
mv bootx64.efi bootx64-windows10.efi
cp /boot/loader.efi bootx64-freebsd.efi
cp -a /tmp/refind-bin-0.13.1/refind/icons .
cp -a /tmp/refind-bin-0.13.1/refind/refind_x64.efi bootx64.efi
cp /tmp/refind-bin-0.13.1/refind/refind.conf-sample refind.conf

# vim refind.conf, append:
menuentry "FreeBSD/amd64 -CURRENT" {
loader \EFI\Boot\bootx64-freebsd.efi
icon \EFI\Boot\icons\os_freebsd.png
}

menuentry "Windows 10 Professional x64" {
loader \EFI\Boot\bootx64-windows10.efi
icon \EFI\Boot\icons\os_win.png
}

# create reFind boot
efibootmgr --create --activate --label "FreeBSD" --loader "/media/EFI/Boot/bootx64.efi"
umount /media

Results
Booting and Rebooting are working fine. However, shutdown is stuck forever at a point.
Screenshot from 2023-10-16 06-27-53.png

Any help would be highly appreciated. Thank you.

Reference materials:
1. https://xyinn.org/md/freebsd/zfs_manual_partition_encrypted
Note: Following only this tutorial also ended up with the same result.
2. https://forums.FreeBSD.org/threads/dual-boot-to-windows10-and-freebsd-in-uefi.79208/
 
For some reason a shutdown via virtualbox EFI doesn't work. This just tells it to use the 'old fashioned' way. This might be specific to Virtualbox EFI as my desktop shuts down just fine with EFI enabled.
 
Back
Top