RootOnZFS issue with boot after power down

Peace!

I'm using FreeBSD 10.0-RELEASE with RootOnZFS and full disk encryption. I had a problem booting after power down, with a kernel panic after boot message (just after entering GELI passphrase).
So here is what I did to get back in. I used a FreeBSD 10.0-RELEASE Live CD (it was a bootonly I think -- to minimize download)
Boot into the CD and choose "Live CD" from the options. (login as root)

Code:
mkdir /tmp/bootpool
zpool import -f bootpool
zfs set mountpoint=/tmp/bootpool bootpool
zfs mount -a
cp /tmp/bootpool/boot/encryption.key /tmp/
zfs umount -a
zfs set mountpoint=/bootpool bootpool
zfs export bootpool
geli attach -k /tmp/encryption.key /dev/ada0p4
zpool import -f -R /mnt zroot

I had to zpool import with -f flag because the power down problem didn't export the partition in the right way, I think. After executing these commands I rebooted and the system went online again. Though, I had another problem with bootpool not loading correctly after boot. The /boot folder was empty, it was also a symbolic link to the /bootpool/boot. I also found out that when importing the ZFS bootpool partition it created /bootpool/boot/boot so the issue was the double boot directories under /bootpool.

So I had to do this after reboot to load the bootpool manually.
Code:
zpool export bootpool
zpool import -f bootpool
(cd to root and remove the old symbolic link boot)
cd /
rm boot
(notice the double boot directory issue)
ln -sf bootpool/boot/boot/

That's it and the /boot symbolic link worked again and I could load the missing kernel modules, for example kldload linux or anything else. Hope that helps, and if anybody knows a clean fix for the bootpool problem above please share it with me.

Thanks,
Draco

References:
http://lists.freebsd.org/pipermail/free ... 77201.html
viewtopic.php?&t=42980
 
Back
Top