FreeBSD on a Pi =============== 1. Download and copy to an SD card one of these: FreeBSD-11.2-RELEASE-arm-armv6-RPI-B.img.xz FreeBSD-11.2-RELEASE-arm-armv6-RPI2.img.xz from https://download.freebsd.org/ftp/releases/arm/armv6/ISO-IMAGES/11.2/ or, for 12.0 on a B, FreeBSD-12.0-RELEASE-arm-armv6-RPI-B.img.xz from https://download.freebsd.org/ftp/releases/arm/armv6/ISO-IMAGES/12.0/ for a B, or, for 2 and above, FreeBSD-12.0-RELEASE-arm-armv7-RPI2.img.xz from https://download.freebsd.org/ftp/releases/arm/armv7/ISO-IMAGES/12.0/ 2. Hook up screen and keyboard, boot. This takes noticably longer than booting Raspbian. Alternatively, watch your router's DHCP status page for a lease from rpi-b or rpi2. 3. Login as freebsd, password freebsd. The default setup does not contain sudo. The root password is root. Since this is a BSD, only users in the "wheel" group may su to root. Freebsd is one of them. 4. Turn off access time updates, to not wear out your SSD prematurely, by adding "noatime" to the root partition's mount options in /etc/fstab: freebsd@pi2b03:~ % cat /etc/fstab # Custom /etc/fstab for FreeBSD embedded images /dev/ufs/rootfs / ufs rw,noatime 1 1 /dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0 tmpfs /tmp tmpfs rw,mode=1777,size=50m 0 0 freebsd@pi2b03:~ % 5. Set up networking. Historically, BSD's configuration is maintained in /etc/rc.conf: freebsd@pi2b03:/etc % pwd /etc freebsd@pi2b03:/etc % cat rc.conf hostname="rpi-b" # ifconfig_DEFAULT="DHCP" sshd_enable="YES" sendmail_enable="NONE" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" growfs_enable="YES" kldxref_enable="YES" ifconfig_ue0="inet 192.168.100.23 netmask 255.255.255.0 \ broadcast 192.168.100.255" defaultrouter="192.168.100.1" hostname="pi2b03" freebsd@pi2b03:/etc % This file is sourced by scripts in /etc/rc.d. Changes are often appended to the end, overriding earlier settings. Configure at least networking. For this, provide network settings in a variable named "ifconfig_INTERFACE", value are the parameters to ifconfig. The default route is specified by defaultrouter. 6. Configure name servers. If the BSD-Pi's networking has been brought up once before via DHCP, chances are that there is a resolv.conf in place. If not, create one: freebsd@pi2b03:~ % cat /etc/resolv.conf # Generated by resolvconf nameserver 8.8.8.8 nameserver 9.9.9.9 nameserver 1.1.1.1 freebsd@pi2b03:~ % 7. The contents of /etc/ttys determine which terminals allow logins. By default there are 8 (eight). Switch between them using ALT-F1 through ALT-F8. To enable login on a terminal, set it to "on" or "onifexists". "Secure" terminals allow root-logins. An insecure terminal only allows regular user logins. # If console is marked "insecure", then init will ask for the # root password when going to single-user mode. console none unknown off secure # ttyv0 "/usr/libexec/getty Pc" xterm onifexists secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" xterm onifexists secure ttyv2 "/usr/libexec/getty Pc" xterm onifexists secure ttyv3 "/usr/libexec/getty Pc" xterm onifexists secure ttyv4 "/usr/libexec/getty Pc" xterm onifexists secure ttyv5 "/usr/libexec/getty Pc" xterm onifexists secure ttyv6 "/usr/libexec/getty Pc" xterm onifexists secure ttyv7 "/usr/libexec/getty Pc" xterm onifexists secure #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd # etc. ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure ttyU0 "/usr/libexec/getty 3wire.9600" vt100 onifexists secure freebsd@pi2b03:/etc % The last entry, for ttyU0, spawns off a login on a USB-RS232 cable. It is not part of the default configuration. When running a 3wire configuration, a serial port's status lines (RTS/CTS, DTR/DSR, CD) are being ignored. In that case, you might want to start out with a reasonably low bitrate, to not overflow the terminal. 8. Traditionally, BSD installed software from source, through it's ports collection underneath /usr/ports. This has been depreciated (though it's still an option), replaced by "pkg", a package installer similar to yum and apt. To become usable, pkg needs to be bootstrapped: freebsd@pi2b03:~ % su - Password: root@pi2b03:~ # pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:armv6/quarterly, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.10.5_5... Extracting pkg-1.10.5_5: 16% pkg: not enough arguments Usage: pkg [-v] [-d] [-l] [-N] [-j |-c |-r ] [-C ] [-R ] [-o var=value] [-4|-6] [] For more information on available commands and options see 'pkg help'. root@pi2b03:~ # Once done, pkg with arguments results in the above error message. 9. Upgrade package catalogs: root@pi2b03:~ # pkg update FreeBSD repository is up to date. All repositories are up to date. root@pi2b03:~ # 10. Linux, like SVR4, keeps passwords in /etc/shadow. BSDs keep theirs in /etc/master.passwd. To manually tweak /etc/passwd, always use "vipw" (as root), which upon exit rebuilds /etc/passwd. 11. BSDs traditionally have two root accounts, root and toor, the former running csh, the latter sh. Some older BSD releases (way back when) used to not assign passwords to either by default, Some administrators would secure root, but not toor. FreeBSD on a Pi locks out toor logins by putting a "*" into master.passwd's password field. Might want to change that. 12. Add pi's group and user, to match Raspbian's default setup. Make sure that pi has wheel group membership: root@pi2b03:~ # pw group add 1000 -n pi root@pi2b03:~ # grep 1000 /etc/group pi:*:1000: root@pi2b03:~ # pw user add pi -u 1000 -c Pi -s /bin/sh -m -g pi -G wheel root@pi2b03:~ # finger pi Login: pi Name: Pi Directory: /home/pi Shell: /bin/sh No Mail. No Plan. root@pi2b03:~ # id pi uid=1000(pi) gid=1000(pi) groups=1000(pi),0(wheel) root@pi2b03:~ # passwd pi Changing local password for pi New Password: Retype New Password: root@pi2b03:~ # 13. For old-school software installation, download the ports collection, untar (as root) underneath /usr/ports: freebsd@pi2b03:~ % pwd /home/freebsd freebsd@pi2b03:~ % fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports /ports/ports.tar.gz ports.tar.gz 100% of 55 MB 187 kBps 05m04s freebsd@pi2b03:~ %