IT Services

How to diagnose and troubleshoot FreeBSD before you reach a login screen

On this page:

FreeBSD enables you to observe exactly what it going when you start your machine. The following assumes that you are familiar with the decription of the FreeBSD boot process from the FreeBSD handbook.

 

loader.conf(5): increase dmesg verbosity

When your system misbehaves at an early stage you usually find answers in the system message buffer, accessible using dmesg(8). The system message buffer's size is sufficient under normal circumstances. With increased verbosity and additional timestamps you need to increase it though.

You may wish to do this even without problems to collect verbose dmesg(8) output as a reference.

# increase dmesg buffer size to 1 MiB
kern.msgbuf.size="1048576"

# microsecond granularity timestamps
kern.msgbuf_show_timestamp="2"

# enable verbose output
boot_verbose="yes"
 

loader.conf(5): observingobserving the start of your FreeBSD system over a serial connection

If your serial connection appears to be dead for some reason then you might need to make changes in your BIOS. You might encounter problems when dealing with more sophisticated out of band managment systems (think IPMI and vendor-specific technologies). Look for terms like "COM", "IRQ", and I/O-related information such as "0x3f8" (or similar hexadecimal notations) which corresponds to COM1. Troubleshooting this is out of the scope of this page. What is a Serial Port and the related Quick Help are good starting points.

# see what's happening on both, your display and the serial line
boot_multicons="YES"

# see loader.conf(5) for other options such as "efi" and "nullconsole"
console="comconsole,vidconsole"

# enable boot messages on the serial console
boot_serial="YES"

# set the baud rate, this should be the default
comconsole_speed="115200"
 

Recover your system from FreeBSD's loader prompt

Boot from a different ZFS dataset from FreeBSD's loader prompt. You can interrupt the boot process and access the loader prompt by typing an arrow key when the Beastie Screen appears. If you did so by accident just type boot and confirm with Enter to continue booting.

### BEASTIE SCREEN HERE ###
Exiting menu!
Type '?' for a list of commands, 'help' for more detailed help.
OK [your loader prompt commands here]

# fix typos by settin or unsetting configuration from loader.conf
unset amdgpu_load="YES"
set hw.pci.do_power_nodriver="0"

# look for available ZFS pools, e.g pool name = zmypool
OK lsdev
zfs devices:
    zfs:zmypool

# check if the content is what you would expect
OK lszfs zmypool

# 'default' must be present
OK lszfs zmypool/ROOT
default

# inspect where you would boot from if you entered 'boot' and hit Enter
OK show currdev
 
# reload bootenvironments
OK reloadbe

# load kernel and zfs.ko module
OK load /boot/kernel/kernel
OK load /boot/kernel/zfs.ko

# change ZFS dataset to boot from
# you need the double quotes and all colons :
OK set currdev="zfs:zmypool/ROOT/default:"

# NOTE: similar syntax for UFS filesystems or CDs
# ufs:/dev/da0s1a
# cd9660:/dev/cd0 ro

# the loader prompt is now set up to boot from the 'zmypool' pool
OK boot

# hit Enter

Make a payment