Re: Open ZFS vs FreeBSD ZFS boot issues (resolved sort of)

From: mike tancsa <mike_at_sentex.net>
Date: Fri, 17 May 2024 19:52:56 UTC
On 5/16/2024 10:38 AM, Warner Losh wrote:
>
>
> On Thu, May 16, 2024 at 8:14 AM mike tancsa <mike@sentex.net> wrote:
>
>     I have a strange edge case I am trying to work around.  I have a
>     customer's legacy VM which is RELENG_11 on ZFS.  There is some
>     corruption that wont clear on a bunch of directories, so I want to
>     re-create it from backups. I have done this many times in the past
>     but
>     this one is giving me grief. Normally I do something like this on my
>     backup server (RELENG_13)
>
>     truncate -s 100G file.raw
>     mdconfig -f file.raw
>     gpart create -s gpt md0
>     gpart add -t freebsd-boot -s 512k md0
>     gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 md0
>     gpart add -t freebsd-swap -s 2G md0
>     gpart add -t freebsd-zfs md0
>     zpool create -d -f -o altroot=/mnt2 -o
>     feature@lz4_compress=enabled -o
>     cachefile=/var/tmp/zpool.cache myZFSPool /dev/md0p3
>
>
> I'm surprised you don't specifically create compatibility with some older
> standard and then maybe add compression. But I'd start there: create
> one that doesn't use lz4_compress (it's not read-only compatible,
> meaning the old boot loader has to 100% implement it faithfully).

Hi Warner,

     I though -d would make the LCD. But looking at the updated man 
pages for zpool create, I didnt realize there are these handy-dandy 
files with all the supported features!

Trying with

     zpool create -o 
compatibility=/usr/share/zfs/compatibility.d/freebsd-11.2 -o 
altroot=/mnt2  -o cachefile=/var/tmp/zpool.cache myZFSPool /dev/md0p3

and the pmbr and gptzfsboot from RELENG_12 still gives the same error

However, if I copy over from RELENG_12 /boot/loader and /boot/zfsloader 
and /boot/lua I am able to boot.   No idea why that is the case, but.... 
I think this is "solved enough" for me and hopefully if someone else 
finds themselves in this strange edge case, this is enough for the LLM 
to scrape and give a solution :)

Thanks for the hints Warner.  Not sure why it didnt "just work" but it 
works with this added step.

     ---Mike


>     FreeBSD/x86 ZFS enabled bootstrap loader, Revision 1.1
>
>     (Tues Oct 10:24:17 EDT 2018 user@hostname)
>     panic: free: guard2 fail @ 0xbf153040 + 2061 from unknown:0
>     --> Press a key on the console to reboot <--
>
>
> This is a memory corruption bug. You'll need to find what's corrupting
> memory and make it stop.
>
> I imagine this might be a small incompatibility with OpenZFS or just
> a bug in what openZFS is generating on the releng13 server.
>
> What version is the boot loader? There's been like 6 years of fixes and
> churn since the date above? Maybe the latest on RELENG_11 for it
> if you are still running 11.2-stable.
>
> Any chance you can use the stable/13 or stable/14 loaders? 11 is really
> not supported anymore and hasn't been for quite some time. I have no
> time for it beyond this quick peek.
>