Michael Shriver Senior Computer Specialist - College of the Environment

Notes on Running a FreeBSD Server on a Mac Pro 5,1

Automatic recovery from power failures

MacOS has options to configure Mac hardware to automatically reboot after power failure, but this option is set within the hardware at every boot. Lacking a configurable ‘BIOS’, we must configure our OS to set this option after boot time.

For the Mac Pro 5,1, locate the appropriate ‘LPC Controller’:

% pciconf -vl|grep -B2 LPC
isab0@pci0:0:31:0:	class=0x060100 rev=0x00 hdr=0x00 vendor=0x8086 device=0x3a18 subvendor=0x8086 subdevice=0x7270
    vendor     = 'Intel Corporation'
    device     = '82801JIB (ICH10) LPC Interface Controller'

We will need to set a specific register in the controller in order to enable automatic power recovery. For this controller, the register is located at address 0xa4. By default the value should be set to 1:

# pciconf -r -b pci0:0:31:0 0xa4 #reads one byte from device pci0:0:31:0 address 0xa4
01

A simple command run as root will overwrite the value to 0:

# pciconf -w -b pci0:0:31:0 0xa4 0

This will need to be run at every boot, for which I will use the root crontab:

# On reboot, enable automatic power-failure recovery:
@reboot /usr/sbin/pciconf -w -b pci0:0:31:0 0xa4 0

Additionally, adding the following lines to /etc/rc.conf will allow automatic file system recovery after a failure:

fsck_y_enable="YES"
background_fsck="NO"

One final caveat: running headless may require some kind of DVI ‘Dummy Plug’ in order for your mac to boot without a display attached.

References:

Enable Core Temperature kernel modules:

Add the following line to /boot/loader.conf:

# Load Temperature Sensor Modules
coretemp_load="YES"

Full Config File Contents

/etc/rc.conf

# Miscelanneous OS Settings
hostname="evergiven"
clear_tmp_enable="YES"
syslogd_flags="-ss"

# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"

# Disable Sendmail; sSMTP will take these duties
#sendmail_enable="NONE"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Enable automatic filesystem checking when needed
fsck_y_enable="YES"
background_fsck="NO"

# Ethernet Adapter Settings
ifconfig_em0="inet 128.208.74.74 netmask 255.255.255.0"
ifconfig_em1="inet 172.28.74.74 netmask 255.255.255.0"
defaultrouter="172.28.74.100"

# Default Services
sshd_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
zerotier_enable="YES"
plexmediaserver_plexpass_enable="YES"
pf_enable="YES"
gateway_enable="YES"
pflog_enable="NO"

# Virtual Machine Settings
vm_enable="YES"
vm_dir="zfs:storage/vm"
#vm_list="plex"

/etc/sysctl.conf

# $FreeBSD$
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
#security.bsd.see_other_gids=0
#security.bsd.see_jail_proc=0
#security.bsd.unprivileged_read_msgbuf=0
#security.bsd.unprivileged_proc_debug=0
kern.randompid=1
net.link.tap.up_on_open=1

/boot/loader.conf

security.bsd.allow_destructive_dtrace=0

# Boot Screen Settings
#screen.textmode=1
#console="comconsole"
#comconsole_speed=115200
loader_logo="beastie"

# Enable bhyve
vmm_load="YES"
nmdm_load="YES"

# Mask NVidia GeForce GTX 970 from host
#pptdevs="5/0/0 5/0/1"

# Load Temperature Sensor Modules
coretemp_load="YES"