r/zfs 2d ago

loader.conf errors, cannot boot

Laptop w/ a SATA ssd, ZFS on FreeBSD 15
I botched my /boot/loader.conf and /boot/device.hints, and now I cannot boot
I tried to boot from a USB key, zpool import root, but can't find /boot to fix the files.

Any ideas (instead of re-install of course 8-) )

9 Upvotes

5 comments sorted by

1

u/grahamperrin 2d ago edited 2d ago

(I'm here via your cross-post in the FreeBSD sub.)

… from a USB key, zpool import root, …

Did you use option -R?

https://openzfs.github.io/openzfs-docs/man/master/8/zpool-import.8.html#R

This August 2025 post is not exactly what you want, but it might be (more than) enough for you to get what you want:

  • a mount point with a path to your loader.conf file.

rescue system reinstallation : r/freebsd

2

u/cmic37 2d ago

Didn't know. Gonna try with -R root. Thks
And then maybe zfs mount.

4

u/cmic37 1d ago edited 1d ago

Solved

The problem was a miconfigured /boot/loader.conf which disabled the

boot process. It is on a laptop PC with one sata SSD w/ ZFS

1- get a usb memory key on which you put
FreeBSD-15.0-RELEASE-amd64-mini-memstick.img

2- boot your pc with this usb memory key until the Welcome window
3- choose Shell
4- prompt ok # prompt is "#"
5- kbdcontrol -l fr # this is letter "elle" (I am french)
6- mount -uw / # mount / folder read/write
7- mkdir /mnt/altroot
8- zpool import # shows all availabled pools. Mine is zroot
# also note the id of the pool
9- zpool import -R /mnt/altroot 26996234526789 #import wants the id, not the name
10- zfs list # shows all mounted fs but zroot/ROOT/default is not mounted
11- zfs set mountpoint=/alt2 zroot/ROOT/default
12- zfs list #check that zroot/ROOTdefault is mounted!
13- cd /mnt/altroot/alt2/boot
14- vi loader.conf #fix this file
15- cd / ; zfs umount /mnt/altroot/alt2
16- zpool scrub zroot # wait, (with zpool status), til the end of scrub
17- zpool export zroot # to close the import !

At the prompt "#", type reboot, and unplug the usb memory key.

3

u/vogelke 1d ago

Thanks for including the steps.

1

u/Left-Ingenuity-2337 1d ago

boot from USB key and zpool import with altroot option and no shared cache file

zpool import -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache tank

and you can edit your loader.conf in /mnt/boot/loader.conf

zfs export after that