It is, yes.Is that an option to zpool import?
It is, yes.Is that an option to zpool import?
It is, yes.
That shows the pool itself and the data it contains is still good. It'll be easier to work from here. The loader(8) is quite versatile but a bit of a pain to use interactively when trying to solve issues.I now have the ZFS system mounted on /tmp/tmproot
gpart show
?Can you show the output fromgpart show
?
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
This is slightly dangerous but at worst the system won't boot, which it doesn't do now anyway, so the risk is minimal. Make sure the installer image you used is the same version as your system was (similar enough, it doesn't need to have the exact same patch level, just the same major version).
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
Then reboot, cross your fingers and hope that was enough to get it booting again.
freebsd-version(1) uses a little trick:Before I do that, is there any way to check what version the system was?
what -qs /boot/kernel/kernel
freebsd-version(1) uses a little trick:
what -qs /boot/kernel/kernel
Point it to your imported filesystem of course or else you get the version of the boot image you used.
That would definitely explain the "can't load kernel" messages. Is the entire directory empty or are the *.ko kernel modules still there? If everything is mostly there but you're only missing kernel you can try copying the kernel from the install media you used. Yes, that would be a blank (patch-less) version but something is better than nothing. Alternatively, if you're still unsure about the version, copy the kernel file from the kernel.old directory.There is no file called "kernel" the boot/kernel directory of the imported filesystem.
That would definitely explain the "can't load kernel" messages. Is the entire directory empty or are the *.ko kernel modules still there? If everything is mostly there but you're only missing kernel you can try copying the kernel from the install media you used. Yes, that would be a blank (patch-less) version but something is better than nothing.
Well, it's some progress, now the kernel has started.Unfortunately copying the kernel didn't yet solve the problem. Now it seems the issue is inability to mount root.
Standard FreeBSD console allows scrolling if you hit the "Scroll lock" button on your keyboard. You can use the cursor keys or PgUp/PgDown to scroll up and down. Hit "Scroll lock" again to stop. That key might be tricky on a laptop, you may need to use some function (Fn) key for it.Of course the error message is just above the last console screen - is there any way to pause/scroll back boot console output?
Standard FreeBSD console allows scrolling if you hit the "Scroll lock" button on your keyboard. You can use the cursor keys or PgUp/PgDown to scroll up and down. Hit "Scroll lock" again to stop. That key might be tricky on a laptop, you may need to use some function (Fn) key for it.
Trying to mount root from zfs:zroot/ROOT/default []...
Mounting from zfs:zroot/ROOT/default failed with error 2: unknown file system.
Probably not necessary to do a complete reinstall. We just need to get the kernel in order, then we can boot the system further. On the installation media there's a /usr/freebsd-dist/kernel.txz, you can extract that one;Is there a safe way to reinstall the system without overwriting existing application data (such as the dovecot mailboxes)?
tar -C /your/tmp/root -zxvf /usr/freebsd-dist/kernel.txz
. Change the /your/tmp/root to where you imported your pool to. Unpacking those files is what the installer normally does.Which kernel did you copy? The error looks like it has problems loading the zfs.ko kernel module. Which may be because the kernel you copied and the modules don't exactly match up. You probably need to copy a whole /boot/kernel/ directory, modules and all.
Probably not necessary to do a complete reinstall. We just need to get the kernel in order, then we can boot the system further. On the installation media there's a /usr/freebsd-dist/kernel.txz, you can extract that one;tar -C /your/tmp/root -zxvf /usr/freebsd-dist/kernel.txz
. Change the /your/tmp/root to where you imported your pool to. Unpacking those files is what the installer normally does.
Hurray! Good. Keep in mind that you now have a "plain" 12.0 kernel, no security patches. You may want to try running freebsd-update(8), hopefully that detects the "old" kernel and will update it for you.
As you're here now, I often copy that "plain" kernel from the install media to a /boot/kernel.RELEASE/ or /boot/kernel.GOOD/. You can just copy it, then you can use it in emergencies like this one.
Done - just about to see if it still boots.
Reasonably safe, yes. Bulletproof, no.ZFS is extremely safe in that sense.
We can only speculate, but I'm guessing aStill, the question is, how could the system end up without any kernel.
rm -r /boot/kernel/*
(or similar) happened at some point, and it went unnoticed until the power outage.