FreeBSD Fundamentals · Module 02 of 14

Installation, boot and the rc system

Follow the system from firmware and loader through kernel startup, init and rc.d service orchestration.

Learning objectives

By the end of this module, you should be able to:

  • Describe the high-level FreeBSD boot sequence.
  • Use rc.conf and sysrc for persistent service configuration.
  • Distinguish a service start from service enablement.

Boot to multi-user mode

The loader prepares the kernel and modules; the kernel initializes hardware and starts init. In multi-user startup, the rc system reads defaults plus host-specific configuration and starts filesystems, networking and services.

rc.conf is declarative host configuration

Do not edit /etc/defaults/rc.conf. Put host overrides in /etc/rc.conf, commonly through sysrc. Installed package services usually provide scripts under /usr/local/etc/rc.d.

Worked examples

See the idea in practice.

Inspect service configuration

sysrc -a | head
service -e | head
  • sysrc reads effective rc.conf values.
  • service -e lists enabled services.
Hands-on lab

Lab — Enable and inspect SSH safely

Goal: Inspect SSH state, enable it persistently, and understand immediate versus next-boot behavior.

Before you start

  • Console access is recommended before changing remote-access settings.
STEP 1

Check the service

service sshd status || true
sysrc sshd_enable
STEP 2

Enable persistently

sysrc sshd_enable="YES"
STEP 3

Validate and start

sshd -t
service sshd start
service sshd status

Verify

  • sshd_enable is YES and the daemon reports running.

Expected outcome

  • SSH is enabled for future boots and running now.

If it fails

  • If sshd -t fails, fix configuration before restarting; keep console access during remote changes.
Real-world connection

Persistent service state and current process state are separate concerns on production systems.

Avoid these traps

Common mistakes

  • Using service start and assuming the service will survive a reboot.
  • Editing /etc/defaults/rc.conf directly.
Knowledge check

Can you explain it without looking back?

Open each answer only after you have tried to answer the question yourself.

1What does sysrc change by default?

Persistent rc.conf-style configuration.

2Why can service foo start fail when foo_enable is NO?

Many rc scripts require the enable flag for normal start; onestart can bypass that gate for one invocation.

3Which file holds host-specific base-system rc settings?

/etc/rc.conf.

My Learning

Record your progress for this module.

Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.

Not started

Attempt the core lab and knowledge checks before marking the module complete.