Skip to content

ZFS Recovering from a bad loader.conf with ZFS root

Lucas Holt edited this page Aug 22, 2022 · 1 revision

Tested with MidnightBSD 2.0.1 on a UEFI system with "auto zfs guided" during install.

Boot using your "Live CD" then import the zpool(8) and fix your loader.conf

  1. Boot under LiveCD from bootable usb drive or CD
  2. Login using root without password
  3. Create an altroot mount point under /tmp/root mkdir /tmp/root
  4. Import the zroot pool under the /tmp/root zpool import -fR /tmp/root zroot (notice there's no trailing forward slash after /tmp/root)
  5. Mount the zroot/ROOT/default which contain the /boot zfs mount zroot/ROOT/default
  6. Edit your loader.conf which now is mounted under /tmp/root/boot ee /tmp/root/boot/loader.conf remove the last modification from it then press "ESC" -> leave editor -> save changes
  7. Export the zpool cd / zpool export zroot
  8. Shutdown and remove the usb bootable drive or cd then boot normally shutdown -p now

loader.conf kern.geom.label.disk_ident.enable="0" kern.geom.label.gptid.enable="0" opensolaris_load="YES" zfs_load="YES"

based on a post from VladiBG from the FreeBSD forums