FreeBSD: After the First Boot

Last edited on 2026-03-19 Tagged under  #freebsd   #bsd 

FreeBSD logo in ASCII

Part of the “FreeBSD on a Laptop” series.

After the first boot of my new FreeBSD installation, these are some extra steps I like to make right away to get a system off to a good start!



Package management

Package management is one area where the differences between the Linux philosophy and the BSD philosophy about how to build a system becomes apparent.

Linux is an operating system kernel. Developers take this kernel and combine it with various independent software projects in a collection of packages that is released as a Linux distribution (Ubuntu, Debian, Fedora, etc.).

In contrast, each of the BSDs develop their own kernel and combine it with system components that are developed together “in-house” and released as a whole. The idea being that this approach leads to a more robust and tightly integrated core operating system. Third-party “userland” packages not included in the core may still be installed at the discretion of the user, with source code and binary packages provided from a ports repository.

A major change in FreeBSD 15.0 is the introduction of a new method for installing and managing the core operating system using the pkg(8) package manager. Currently marked as being a “technology preview”, the plan is it will become the default method for managing all base and userland binary packages on the system when FreeBSD 16.0 is released.

When I ran my fresh install of FreeBSD, I opted to use this pkg tool in combination with a network install, and the base system was installed as a set of packages from the “FreeBSD-base” repository.

To keep packages up-to-date, compare installed packages to the versions in ports, and generate a list of packages due for an upgrade, run the command:

pkg upgrade

To add a package:

pkg install [package]

One of the first packages I like to install on any BSD or Linux system is htop(1):

pkg install htop

More: FreeBSD Handbook - Installing Applications: Packages and Ports

Set pkg manager to default to yes

From pkg.conf(5):

> DEFAULT_ALWAYS_YES: boolean
		    When  this	option is enabled pkg(1) will default to "yes"
		    for	all questions which require user confirmation before
		    doing anything. Default: NO.

Open the file for editing:

vi /usr/local/etc/pkg.conf

Change:

#DEFAULT_ALWAYS_YES = false;

… to:

DEFAULT_ALWAYS_YES = true;

Save changes and exit.

Allow designated users to run commands as root

A user account (example: foo) was created during installation and assigned to the wheel group.

Install doas to run root-level access commands, and allow members of wheel to do so by default, by creating doas.conf:

pkg install doas
echo "permit :wheel" > /usr/local/etc/doas.conf

To allow user foo to run commands as root without asking for a password:

echo "permit nopass keepenv foo" >> /usr/local/etc/doas.conf

Log out as root, log back in as your user, and use doas to run any commands that require root privileges.

Use a larger font in console

On some of the higher-resolution displays I find the default font size in the console pretty small. The base system includes a selection of console fonts in /usr/share/vt/fonts.

Try a different, larger font size:

doas vidcontrol -f terminus-b32

Download (in raw format) this nice selection of terminus fonts of different sizes, converted for use in the FreeBSD console.

Unpack the .txz package and copy the fonts to /usr/share/vt/fonts:

tar xvf vt-font-terminus-*.txz && doas cp terminus-font/ter-u* /usr/share/vt/fonts/

Try different font sizes:

doas vidcontrol -f ter-u22

Use sysrc to make a selection permanent by modifying rc.conf:

doas sysrc allscreens_flags="-f ter-u22"

More: Fix small font in FreeBSD

Add user to additional groups

Add my user account created during installation to a group with the syntax:

doas pw groupmod [group_name] -m [username]

Example: Permit powering off the system as a non-root user using shutdown by adding my user foo to the operator group:

doas pw groupmod operator -m foo

Alias for root mail

Rather than login to root to collect system mail, I forward the root user’s mail to my non-root user’s inbox.

Open the aliases file for editing:

doas vi /etc/aliases

Modify:

# root: me@my.domain

… by uncommenting the line and replacing me@my.domain with my foo username:

root: foo

Save changes and exit.

Let the MTA know about the modification by running the newaliases command with no arguments:

doas newaliases

Test whether mail is indeed being forwarded by using the mail command as my user to send root a message:

$ mail root
Subject: Test new alias 
Is it working?

Press CTRL-d to exit and send message.

It works!

$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/mail/foo": 1 message 1 new
>N  1 dwa@tukturjuit.home.  Thu Mar 19 15:05  13/427   "Test new alias"

More: How to Forward Root’s Mail

Switch user shell from sh to bash

If a user account is created during the install of FreeBSD, the default shell assigned is sh. I prefer bash, which is not included in the base system:

doas pkg install bash bash-completion 

List available shells:

$ cat /etc/shells

...

/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/bash
/usr/local/bin/rbash

Open .bashrc for editing:

vi ~/.bashrc

Enable the bash completion library:

[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \
  source /usr/local/share/bash-completion/bash_completion.sh

Save changes and exit.

Open .bash_profile for editing:

vi ~/.bash_profile

Source .bashrc on shell launch:

. ~/.bashrc

Save changes and exit.

Make the switch from sh to bash:

chsh -s /usr/local/bin/bash

Log out and back in to start using the new shell.

More: FreeBSD Handbook - Shells

Create SSH keys

Create an SSH public/private key pair to facilitate passwordless logins to remote servers and (optional) configure remote access to the localhost. Read More

Boot delay

By default the system will pause at the boot menu for 10 seconds. I shorten this to 3 seconds by setting:

echo 'autoboot_delay="3"' | doas tee -a /boot/loader.conf

Message of the day

Quiet the “message of the day” (motd) output after logging into the system by creating an empty .hushlogin file:

touch ~/.hushlogin

Clear terminal at logout

For the bash shell, add to .bash_profile:

echo 'test -f ~/.exitrc && trap ". ~/.exitrc" EXIT' >> ~/.bash_profile

Create .exitrc with:

echo "type clear >/dev/null 2>&1 && clear" > ~/.exitrc

More: How to clear terminal after logging out?

You can like, share, or comment on this post on the Fediverse 💬

Thanks for reading! Read other posts?

» Next: Configure SSH on NetBSD for Passwordless Logins to Servers

« Previous: Install FreeBSD (Short and Sweet Version)