This post is about trying out FreeBSD on a Raspberry Pi B. I’m new to FreeBSD (any BSD flavor, really), so I’ve compiled this from a number of sources, e.g., this.
Creating the memory card
The images are found at ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES.
Guides on writing to memory card using different operating systems can be found here.
Here I use a Mac.
(On a GNU/Linux distribution use
df to identify memory card and
umount /dev/sdX to unmount the card;
dd is still used for writing the image)
Extract the image:
Identify the memory card:
In this case it is
Unmount the card using
diskutil unmountDisk /dev/disk2 and write the image using
Unmount the newly written memory card with
sudo diskutil eject /dev/disk2 and plug the memory card in the Pi.
By default, the only user is
root with an empty password.
Once logged in, be sure to add a password using
My first setup is done ‘locally’, with the Pi plugged into a TV:
- I use a Danish keyboard and FreeBSD assumes a US layout. To change this, edit the file
/etc/rc.conf. Add the line
keymap=danish.isoand reload the configurations using
service syscons start(or reboot).
- The output spills of the left of the screen.
This can be fixed be adding the following lines to the top of
- To enable ssh login for
root, edit the file
/etc/ssh/sshd_configand add/uncomment the following lines:
Restart the SSH service with
service sshd restart.
After transferring my (public) key to
.ssh, the line
PasswordAuthentication yes is deleted and
RSAAuthentication yes is added instead.
With these initial setups out of the way the rest is done using SSH.
Remember to shutdown the Pi with the command
shutdown -p now.
The clock must be set correctly for a lot of stuff to work.
Find an IP address for an NTP server with
ntpdate -q pool.ntp.org.
/etc/rc.conf add the following lines and reboot:
FreeBSD uses the ports system to install software; get it with
Both commands will take a while to execute. During the extraction the local computer I used dropped the connection and this caused the command to cancel.
It appears at the time of writing that the available pre-compiled packages are very limited for FreeBSD on a Pi so everything has to be compiled locally; this is often very time consuming.
Furthermore, with a regular compile the user is prompted for several installation options during the compilation – this makes it difficult to start the installation and just leave it for the night. One way to make a quiet installation is to compile with
This accepts the standard options.
To see the compilation options run
The first thing for me to install is a terminal multiplexer in order to log out during subsequent compilations; I use
Further necessary ports are Git, Vim, zsh, rcm, sudo.
Finally, add a normal user with
adduser to avoid spending unnecessary time as root – and remember too add the user to the
wheel group to allow use of the
To give the new user access to the
sudo command, edit the file
locate for the first time you are informed that the database is too small.
It is suggested to run
/usr/libexec/locate.updatedb – but if you run this command as root you are informed that it is a security liability.
As an alternative, run the command that periodically recreates the database: