Given the urgency for research on the novel COVID-19 virus, I have been running Rosetta@Home and Folding@Home on my Windows machine.
BOINC (which powers Rosetta@Home) runs reasonably well on FreeBSD with some special instructions.
I also wanted to run Folding@Home. I currently have a Linux VM in bhyve to do so. But, that is rather inefficient. How bad would it be to run it in a Linux compat jail? Turns out, it’s not too bad.
Since BOINC is also linux-compat, I basically followed the BOINC instructions (translating the instructions from FreeNAS to stock FreeBSD iocage).
I then installed (within the jail) the rather newly-refreshed biology/linux-foldingathome port.
Here are step-by-step instructions. I am using VNET jails and assign hosts in the jail to the 192.168.2.0/24 network attaching to a vnet1.X (X picked by iocage) interface created on the fly by iocage.
1 |
sudo iocage create -n "fah" -r 12.1-RELEASE vnet="on" ip4_addr="vnet1|192.168.2.21/24" interfaces="vnet1:bridge1" defaultrouter="192.168.2.1" resolver="search domain.tld;nameserver 192.168.2.1" boot="on" |
Get a console to the jail with:
1 |
sudo iocage console fah |
Within the jail (root console from previous command), I ran
1 2 3 4 5 6 |
env ASSUME_ALWAYS_YES=YES pkg bootstrap pkg update pkg upgrade portsnap fetch portsnap extract # takes a while to extract all ports directories Building new INDEX files… done. |
Then, it’s time to build the new biology/linux-foldingathome, which basically encapsulates the recipe here.
1 2 |
cd /usr/ports/biology/linux-foldingathome make config # I left defaults (of building DOCS) |
To save a build dependency, I used the same process as the BOINC instructions: use pkg to get as many as possible. In this case, linux-base-c7 is the only one:
1 2 3 |
pkg install linux_base-c7 make make install |
Now, I edited /usr/local/etc/fahclient/config.xml and updated my username and passkey. I deferred joining Team FreeBSD (team #11743) until I know things are working correctly.
I also added the following lines to the config file to allow access within my trusted network (192.168.1.0/24):
<allow> 127.0.0.1 192.168.1.0/24</allow>
<web-allow>127.0.0.1 192.168.1.0/24</web-allow>
<password>p@33w0r6</password>
Enable the fahclient service
1 |
sysrc fahclient_enable="YES" |
Now, exit the jail’s console. For some reason I did not have linsysfs loaded (yet), so I had to load it. (I am copying all the things that were previously loaded in the BOINC instructions here):
1 2 3 4 |
sudo kldload linsysfs sudo kldload linux sudo kldload linux64 sudo sysctl security.bsd.unprivileged_idprio=1 |
To make it permanent, add load_linsysfs=”YES” to /boot/loader.conf, linux_load=”YES” to /etc/rc.conf, and security.bsd.unprivileged_idprio=1 to /etc/sysctl.conf. (I already had it added.)
Set up the correct entries in the Jail’s fstab:
1 |
sudo iocage fstab -e fah |
Update to look as follows (change the absolute path to correspond to where your iocage jail sits in the host environment):
1 2 3 |
proc /tank/iocage/jails/fah/root/proc procfs rw 0 0 linproc /tank/iocage/jails/fah/root/compat/linux/proc linprocfs rw 0 0 linsysfs /tank/iocage/jails/fah/root/compat/linux/sys linsysfs rw 0 0 |
Now, it’s time to try it out:
1 2 3 4 5 |
sudo iocage stop fah sudo iocage start fah sudo iocage console fah # Now you're in the jail's console/shell prompt: service fahclient log |
Hopefully, you should see something informative, and your CPU usage should start going up with assigned work.
See my stats here.