FreeBSD Guide: Install, Network, Root Reset, Boot Fix

Last updated: 30 October 2026

This guide replaces four older FreeBSD posts on this site. It covers installing FreeBSD, setting up the network, resetting a forgotten root password, and getting past a boot that stops at the mountroot> prompt. Commands follow the official FreeBSD Handbook and FAQ. FreeBSD's own releases page currently lists 15.1 (June 2026) as the production release, so check freebsd.org/releases before you download.

Quick answer
  • Static IP: set ifconfig_em0 and defaultrouter in /etc/rc.conf, add DNS to /etc/resolv.conf, then run service netif restart && service routing restart.
  • Forgot root password: boot single user, run mount -urw /, mount -a, then passwd root.
  • Stuck at mountroot>: the kernel cannot find the root disk. Type ? to list disks and enter the right device.

In this guide

Install FreeBSD

  1. Pick the image. The Handbook lists bootonly and mini-memstick (small, need internet during install), disc1 (includes source and ports), dvd1 (adds common binary packages for offline install) and memstick (full install files on USB).
  2. Verify the download. Download the SHA256 or SHA512 checksum file from the same directory and compare it with the image hash. If they differ, download again.
  3. Write the image to a USB drive or burn it to disc, then boot from it.
  4. Run the installer. In order: keymap, hostname, installation type, optional components, (network install menu for bootonly media), disk partitioning (Auto ZFS, Auto UFS, Manual or Shell), then the files are fetched and extracted.
  5. Finish the post-install prompts: set the root password, configure the network interface (IPv4, IPv6, DNS), then accounts, time zone and services.

Auto (ZFS) is the sensible default on a modern server; choose UFS only if you have a reason to.

Network configuration

Find your interface name with ifconfig (the examples use em0; yours may differ).

Static IPv4

Add to /etc/rc.conf (values are examples):

ifconfig_em0="inet 192.168.1.150 netmask 255.255.255.0"
defaultrouter="192.168.1.1"

Add your DNS servers to /etc/resolv.conf:

nameserver 8.8.8.8
nameserver 8.8.4.4

Apply the change:

service netif restart && service routing restart

The same two lines can be written with sysrc, for example sysrc defaultrouter="192.168.1.1".

DHCP

ifconfig_em0="DHCP"

Then run service netif restart. DHCP normally rewrites /etc/resolv.conf itself.

Hostname

hostname="freebsdhostname.example.com"

Check it with hostname.

Reset the root password

  1. Restart the system. At the boot menu choose Boot Single User, or press Escape and type boot -s at the loader prompt.
  2. Press Enter to accept the default shell and get a # prompt.
  3. Remount the root file system read-write: mount -urw /
  4. Mount the rest: mount -a for UFS, or zfs mount -a for ZFS.
  5. Set the password: passwd root
  6. Type exit to continue booting.

If single-user mode still asks for a password, the console is marked insecure in /etc/ttys. Boot the install media, choose Live CD or Shell, mount the root partition (for example mount /dev/ada0p1 /mnt; chroot /mnt) and repeat the steps above. If the root partition will not mount, the disk may be encrypted; see the encrypted disks section of the Handbook.

Boot stops at mountroot>

Messages such as "Mounting from ufs:/dev/ad0s1a failed with error 19" mean the kernel could not find the root device. Typical causes seen in the FreeBSD forums:

  • The disk name changed. For example ad0 became ada0 after an upgrade, but the boot configuration or /etc/fstab still names the old device.
  • A USB disk moved. A root drive that was da1 while the installer was plugged in becomes da0 once it is removed.
  • Wrong partition scheme or fstab. The disk uses a different layout (GPT versus MBR) than the system expects, or fstab points several mount points at the same partition.

Fix it:

  1. At the mountroot> prompt type ? to list the disks the kernel can see.
  2. Enter the root device in the form ufs:/dev/ada0s1a (or the ZFS dataset, if you use ZFS) using the name you found.
  3. Once booted, run gpart show and check /etc/fstab so every entry names the right partition. Using labels instead of raw device names avoids the problem returning when device numbering shifts.

FAQ

Which interface name do I use?

Run ifconfig. Common names are em0, igb0, vtnet0 (virtual machines) and re0.

Do I need to reboot after editing rc.conf?

No. service netif restart and service routing restart apply network changes.

Can I reset a ZFS system's root password the same way?

Yes, but use zfs mount -a instead of mount -a before passwd root.

Sources

Comments