Rescue my system

FreeBSD 15 Release.

I am slowly learning about FreeBSD and ZFS (very slowly:rude:) and decided to switch our entertainment NUC and ditch the last Linux install in the house.
So I had boot to autologin to Openbox setup and wanted to try and get resolution on the HDMI feed to HDTV over scan right.
So I edited a file that I fat-fingered and now it can't complete boot because console display is broken.
Gets as far as "EFI framebuffer information:" and locks up.

I have forgotten exactly which file in my panic and need to check all the usual suspects. (/etc/rc.conf, /boot/rc.conf).

Can't get to single user mode either.

So I boot NUC off bsdinstall usb and run live system.

Code:
root@:~ # zpool import
ZFS filesystem version:5
ZFS storage pool version: features support (5000)
 pool: a
   id: (long number)
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
      a ONLINE
      ada0p3 ONLINE
zpool import a
cannot mount '/zroot': failed to create mountpoint: Read-only file system

How do I get RW access to /etc/rc.conf?
 
So I boot NUC off bsdinstall usb and run live system.

Code:
cannot mount '/zroot': failed to create mountpoint: Read-only file system
The FreeBSD installer media has a read-only file system, the /zroot mount point for the file system can not be created at the file systems root ( / ).

You can create a mount point under /tmp (which is a tmpfs(4)) and import the pool with the -R option, e.g.:
Code:
zpool  import  -R  /tmp/zfs  zroot
 
zpool import shows:

Code:
config:
      a ONLINE
      ada0p3 ONLINE

If I do mount, it mounts something:

Code:
# zpool import -R /tmp/zfs a

It shows:
Code:
root@:/tmp/zfs # ls -al

I see home, tmp, usr, var, and zroot. And I'm unsure where the 'a' zpool name came from.

ls -al zroot/ shows only the dots for next directories up.

ls -al home/ shows the files I have (had?) but no sign of /boot/ or /etc/
 
Yes boot menu show up as normal.
Good, then all is not lost.

Pick "Escape to loader prompt", then on the loader prompt:
Code:
unload
load /boot/kernel/kernel
load /boot/kernel/zfs.ko
boot -s
Does that successfully boot to single user mode? If yes, you probably messed up /boot/loader.conf which causes it to crash, even in single user mode.
Code:
zfs set readonly=off zroot/ROOT/default
zfs mount -a
Fix loader.conf, just disable everything that's in there. Then reboot and see if it boots properly.
 

it about /boot/loader.conf but you get the idea about how to edit /etc/rc.conf also.
 
I managed to mount /etc but rc.conf was someone else's file or got corrupted.
I gave up and re-installed from scratch.
I did not have all that much there anyway and I have backups.
Thanks for all the help.👍
 
Something to keep in mind, only load drivers in /boot/loader.conf you absolutely need to boot the system. Everything 'non-essential' can be loaded with kld_list in rc.conf.

If you happen to load a broken driver through kld_list you can still boot to single user mode from the boot menu. With that option /boot/loader.conf still gets processed. However, if you had a broken driver in loader.conf it would crash and burn. The trick then is to drop to loader prompt, load the kernel (and some essential modules like zfs.ko) and boot -s to boot it to single user mode. That way loader.conf is skipped and you can usually fix the system.
 
Another trick is to just boot a live system (from usb stick perhaps) - the OP already did do this.
Then mount the partition for the system failing to boot, and edit any files that needs correcting. And then it will boot again.
 
Trying to learn something here.
Have re-installed FreeBSD 15 system on the SSD from the NUC with X11 & Openbox and all seems good.
I take the drive out and put it in a USB external disk box, and plug it into a usb port on my laptop running 14.3-Release-p6.

geom disk list says SSD is da0.

Code:
doas zpool import -fR /mnt matrix

This pool uses the following feature(s) not supported by this system:
        com.truenas:block_cloning_endian (Fixes BRT ZAP endianness on new pools.)
All unsupported features are only required for writing to the pool.
The pool can be imported using '-o readonly=on'.
cannot import 'matrix': unsupported version or feature

Am I correct in understanding that I need FreeBSD 15 on my laptop to be able to mount this?
 
Right so the next step is to upgrade laptop. Watch me screw that right up ;)
I should have acknowledged your tip that I can use /mnt as well...thanks
 
you miiiiiight be able to install an upgraded zfs kernel module package on 14, but, yeah, upgrading is probably the move.

(we say, still on 13.2 at home because we're a lazy bum slacking on our ass)
 
Back
Top