Root + Boot on ZFS + rEFInd, anyone had any luck?
So I’m attempting to get root on ZFS working while booting with rEFInd.
I’ve managed to get Root + Native Encryption working with /boot on ext4.
I have 3 zpools: bpool, rpool and hpool. (Boot, root and home.) Bpool has one dataset mounting to /boot, unencrypted. Rpool has one dataset mounted to / encrypted with a password. Hpool has an encrypted dataset for each user unecrypted with PEM at login.
My esp is mounted at /efi. It is shared with a Windows 10 install, a Manjaro on ext4 install that I recently converted back to an arch install (and where I’ve been building the ZFS install from), and zfsbootmenu.
I cannot get /boot on ZFS discoverable by rEFInd. I’m using the grub2 ZFS driver in rEFInd as per the rEFInd instructions. I can successfully boot from grub, as well as from zfsbootmenu.
I’ve tried manually adding a menu option for the ZFS boot, but I’m not entirely sure what it should look like. And examples are hard to come by.
Wondering if anyone else has had any success with this, or can point me in the right direction for answers.
Edited 25 Feb 2023. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 8 · 90% up
- Kind
- Text
- ID
- 11ariit
16 comments
While I do not have answer at hand since I don't use ZFS what wonders me what decrypts your boot, since refind does not support encrypted boot, whereas grub does.
Boot isn’t encrypted. Root and home are ZFS native encryption. Root gets decrypted when booting with a pass phrase and home gets decrypted on login with PEM.
My question was based on that. If it is not encrypted you might want to edit it, as it may be a bit confusing.
I haven't tried the driver, but you can just create a ZFSBootMenu entry for refind and use that. My current setup has both:
The direct to ZBM entry in the motherbard is new. I only added it because I'm tired of the extra wait time with rEFInd. Before that, I used rEFInd. There was also a windows entry which I've since deleted.
Interesting! I want to stick with refind because I jump between windows and linux quite a bit. (A side project has been trying to get an easy flow to kexec between the two.)
My plan was to have arch/windows/any live usb/images show up as menu items. Then make a submenu item under the arch menu item with ZBM for recovery.
Where you say you have ZBM entries plural in refind, is that ZBM somehow presenting multiple boot environments/kernels to refind?
Sorta. They're both Arch via ZBM, but with slightly different options.
This is what I have at the end of my refind.conf:
These showcase roughly what you need. The end result was that I had 3 options (excluding subentries) in refind:
There's a bunch of other garbage/my setup specific things here, so don't blindly copy it. Particularly the boot options. Some of it does literally nothing, It's just there because I kept forgetting to clean it up. If you use this as a reference though, you should be able to get what you want without too much pain.
As mentioned in my last comment though, I used efibootmgr to add the equivalent of the
Archentry directly to the motherboard. I almost never boot anything else, so now refind is just a backup in case I screw something up.The only other thing to note is that ZFSBootMenu/kexec can't load additional initrd files. The initrd in the options string does nothing (I think. I can't double check because I update my BIOS). You'll have to either keep your motherboard BIOS updated or concatenate the ucode/initramfs files every time a new initramfs is generated.
Sounds like a refind question, not an arch one.
Not even really a refind question as refind doesn’t support the third party drivers.
Used the support flair as it didn’t fit any of the others. Not expecting dedicated support but just dropping the question in one of the few communities I’m likely to find someone else who has stacked the same pile of niches I’m trying to onto each other.
Very much aware of the fact that I’m going outside the supported parameters of all 3 pieces I’m trying to combine here and arch is the least relevant of the 3, but alas refind don’t have a subreddit, and the ZFS one is more concerned with pool management than boot management.
ZFS UEFI drivers have never worked for me with rEFInd, while loading kernels/initramfs's from FAT32 (standard for ESP) has worked on everything I tried from old Atoms to the latest EPYCs.
It may be because of the feature flags enabled in your boot pool which the driver doesn't support. If you want a config that always works I'd recommend just putting the boot files in the ESP. The archzfs initcpio hook handles using an encrypted dataset as the rootfs.
Boot is in grub2 compatibility mode, but I feel like this is probably the case and refind is just missing some piece of knowledge it would need to mount or search a ZFS dataset.
I’ve got plenty of space to put boot on the esp, and it works, I’ve tried it. I just wanted to push at the edge of the problem a bit before falling back on that.
Outside of easy rollback if I break my init or kernal there’s I’m not losing much by not having boot on ZFS. I’d just like to learn a bit about the problem before moving on.
I do zfs root with crypto and /boot on ext using systemd-boot. You can put your kernel and initrd on esp if you want. You don’t need a /boot volume but you’d have to setup your own hooks to copy kernel and initrd to the esp. I haven’t used rEFInd in a decade. Does it support encrypted zfs?
I’m still not even sure (other than one account I’ve found and implication in the refind manual) that refind even supports unencrypted zfs. But I haven’t encrypted my boot dataset, door is encrypted but that’s handled init.
Moving kernel and init to the ESP is my next step (and works just fine) I just wanted to explore the problem a bit before going with that.
Just don't. If you want to use ZFS and not go insane with boot configuration, just go for FAT32 or ext4 /boot. Assuming you have EFI, you could try go for systemd-boot, if you need multi-boot-configuration. Even on rodsbooks website, the guy suggests to use /boot as ESP for rEFInd.
Yeah that seems to be working out to be the most painless solution.