I have recently finished setting up a dual boot of Gentoo Linux and FreeBSD 12.1-RELEASE on my old laptop. Both systems are installed on a ZFS pool named zroot, with the zroot/linux/gentoo volume holding the root of the Gentoo installation, and zroot holding the FreeBSD root.
After rebooting from FreeBSD into Gentoo, I reach a point in the boot process where Linux's initramfs attempts to import the zpool zroot, and after several seconds I receive at least a hundred lines with this error message:
(this comes from one of the kernel parameters passed to Linux:
Upon entering the rescue shell for my initramfs, I tried running
The only way to fix this is to forcefully import the pool with
It's important to note that rebooting from Linux back into Linux works. I even tested this with my USB installation of Arch Linux: I booted Arch from the USB, imported the zroot zpool, and re-booted; I was able to boot back into Gentoo and go back and forth as much as I wanted without errors.
From my limited understanding, the
What's happening here? It seems as if ZFS on FreeBSD is not resetting
Do I need to define a hostid for Gentoo, either through a kernel parameter or /etc/hostid & my initramfs?
Or am I missing something else entirely?
I'm using FreeBSD 12.1-RELEASE. Both Gentoo Linux and Arch Linux are using openZFS 0.8.3.
After rebooting from FreeBSD into Gentoo, I reach a point in the boot process where Linux's initramfs attempts to import the zpool zroot, and after several seconds I receive at least a hundred lines with this error message:
Code:
!! zroot/linux/gentoo is not a filesystem
root=ZFS=zroot/linux/gentoo
Upon entering the rescue shell for my initramfs, I tried running
zpool import -R /mnt zroot
and was met with this:
Code:
cannot import 'zroot': pool was previously in use from another system
Last accessed by <hostname> (hostid=67518724) at <date>
The pool can be imported, use 'zpool import -f' to import the pool.
The only way to fix this is to forcefully import the pool with
zpool import -R /mnt -f zroot
, export it with zpool export zroot
, and reboot the system. Next time Linux tries to load the zpool, it succeeds and boots my system.It's important to note that rebooting from Linux back into Linux works. I even tested this with my USB installation of Arch Linux: I booted Arch from the USB, imported the zroot zpool, and re-booted; I was able to boot back into Gentoo and go back and forth as much as I wanted without errors.
From my limited understanding, the
hostid
is set when a pool is imported to prevent another system from importing the pool and trying to concurrently modify data, and the hostid
is reset when the pool is exported. A system may define its hostid in /etc/hostid, and at least on Linux, this variable gets baked into the initramfs. I do not have a hostid
set on Gentoo.What's happening here? It seems as if ZFS on FreeBSD is not resetting
hostid
on the pool, whereas OpenZFS on Linux is?Do I need to define a hostid for Gentoo, either through a kernel parameter or /etc/hostid & my initramfs?
Or am I missing something else entirely?
I'm using FreeBSD 12.1-RELEASE. Both Gentoo Linux and Arch Linux are using openZFS 0.8.3.