Running FreeBSD on Raspberry Pi

There are several different Linux based distributions available for the Raspberry Pi, including Raspbian, Arch Linux and Fedora. However Linux isn’t the only operating system that can run on the board. Among others, including RISC OS, is the popular Unix-like operating system FreeBSD.

FreeBSD has a deep heritage and is in fact derived from the Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) a version of Unix produced by the University of California, Berkeley. For copyright reasons, FreeBSD isn’t allowed to call itself Unix, however; it is actually more Unix-like than Linux. For those who are interested in running FreeBSD on Raspberry Pi, here are the installation instructions.

FreeBSD has supported Raspberry Pi since November 2012, and the current production version (FreeBSD 10) is available as a pre-built image which can be copied onto a memory card.

Download the latest image file from the official FreeBSD ARM page. This page has images for other ARM-based boards like the Beaglebone and the Pandaboard. You need to download an image for the “RPI-B”: for example “FreeBSD-10.0-RELEASE-arm-armv6-RPI-B-20140131-r260789.img.bz2″

Assuming you are using a Windows PC, you need to uncompress the file. The easiest option is to use 7-Zip. Then you need to download Win32 Disk Imager. Do not try to copy or drag and drop the .img file onto an SD card; it won’t work.

Unzip the Win32 Disk Imager .zip file. Insert the SD card into your SD card reader and check what drive letter it was assigned. Find where you unpacked the Win32 Disk Imager .zip file and double-click on “Win32DiskImager.exe.” In the main program window, click on the folder icon at the end of the Image File group and find the uncompressed version of the FreeBSD image you downloaded. Now select the correct drive letter from the “Device” drop-down list. Click “Write.” The Win 32 Disk Imager will overwrite everything on the card with a bootable copy of FreeBSD for the Raspberry Pi.

freebsd on raspberry pi - win32diskimager

Once the image has been written to the SD card, exit the Win32 Disk Imager program and eject the SD card. You should use right-click “Eject” in Windows Explorer on the drive letter before physically removing the card. Insert the SD card into your Raspberry Pi and connect the power.

freebsd on raspberry pi - ps

The FreeBSD installation is very minimal and comes with just the basic system (and binary utils) along with an SSH daemon (so you can connect remotely to the Pi) and a DHCP client so that the board can request an IP address at boot. The first time you boot FreeBSD, the system partition will only be around 1GB. However on the second boot, the OS will automatically grow the root partition to fill the entire SD card.

It isn’t possible to connect to the Pi using the root account over SSH. To enable SSH connections, log in via a keyboard and monitor/TV attached to the Pi and add a new user using:

adduser

Enter a username followed by the full name of the user. Accept the defaults for the rest of the questions except when you are asked to invite the user into other groups. Here you need to enter “wheel.” Part of the FreeBSD security system is that only users in the “wheel” group can “su” to root. The second but last piece of information you need to enter is a password for the new user. Check the summary and type “yes” to create the user. Finally enter “no” when asked if you want to add another user.

freebsd on raspberry pi - adduser

You can discover the IP address of the Raspberry Pi board using

ifconfig

You can then connect to the device using SSH and log in using the username and password set above. Once connected you can become root by typing:

su -

By default, root doesn’t have a password but you can set one using “passwd“.

Administering a FreeBSD system is quite different from managing a Linux system, and although the shell commands (e.g. ls, cd, more, ps, grep, gunzip, df, tar and so on) are common on both systems, tasks like system level configuration and installing additional software will be unfamiliar to Linux admins. A good starting point to learn about FreeBSD is the project’s documentation.

If you get stuck using FreeBSD on the Pi, a good place to get help is the FreeBSD forum over at RaspberryPi.org.

Let us know if you have any problems running FreeBSD on Raspberry Pi.