_     _                  __  __ _           _          _
 | |   (_)_ __  _   ___  _|  \/  (_)_ __   __| | ___  __| |
 | |   | | '_ \| | | \ \/ / |\/| | | '_ \ / _` |/ _ \/ _` |
 | |___| | | | | |_| |>  <| |  | | | | | | (_| |  __/ (_| |
 |_____|_|_| |_|\__,_/_/\_\_|  |_|_|_| |_|\__,_|\___|\__,_|
| Home | Software | Mirrors | Writings | Dutch Power Cows | About |

Writings

Install Folding@Home on OpenBSD 4.6

This HOWTO shows how you can install Folding@Home using Linux emulation on OpenBSD 4.6.

The basic process is:
Step 1: Install OpenBSD
Before we can even think about running Folding@Home we need to install OpenBSD 4.6 first.

The fine people of the OpenBSD project have written an excellent installation manual,
which we'll follow to get our OpenBSD 4.6 system up and running.

Once the freshly installed system is has been rebooted, we can start to set it up so we can start folding.
Run through the afterboot instructions, and add a user account for yourself if you haven't done so using
the new OpenBSD installer. We'll create a user account to fold under later, before we install the
Folding@Home client with finstall.

Step 1.1: Install bsd-get
After we've installed OpenBSD I always like to install bsd-get, as I'm a long time Debian GNU/Linux user,
it gives me a nice apt-get like method to install OpenBSD packages.

First we'll install wget via pkg_add, after which we'll use it to download bsd-get:
# /usr/sbin/pkg_add -r ftp://ftp.wu-wien.ac.at/pub/OpenBSD/4.6/packages/i386/wget-1.11.4.tgz
# wget http://linuxminded.nl/software/bsd-get/bsd-get -O /usr/local/sbin/bsd-get
# chmod u+x /usr/local/sbin/bsd-get
# bsd-get update
ftp -o /root/.bsd-get.index ftp://ftp.wu-wien.ac.at/pub/OpenBSD/4.6/packages/i386/index.txt
Trying 137.208.3.70...
Connected to ftp.wu-wien.ac.at.
220 (vsFTPd 2.0.7)
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
200 Switching to Binary mode.
250 Directory successfully changed.
Retrieving pub/OpenBSD/4.6/packages/i386/index.txt
local: /root/.bsd-get.index remote: index.txt
150 Opening BINARY mode data connection for index.txt (414345 bytes).
100% |*******************************************************|   404 KB    00:01
227 File send OK.
414345 bytes received in 1.10 seconds (367.13 KB/s)
221 Goodbye.
Now that we have bsd-get up and running we can use it to install additional packages.

Step 1.2: Install additional packages
Some packages you can likely not live without or are simply very usefull to have installed:
  • bash
  • screen
  • rsync
  • lsof
Install these packages with:
# bsd-get install bash-4
# bsd-get install screen-4.*p1.tgz
# bsd-get install rsync-3
# bsd-get install lsof
Now we're ready to install the Linux emulation.

Step 2: Install Linux emulation
Getting the Linux emulation installed on OpenBSD is quite easy as described in the OpenBSD FAQ:
Running Linux binaries on OpenBSD.

The GENERIC OpenBSD kernel already has Linux emulation support, you only need to enable it:
# sysctl kern.emul.linux=1
kern.emul.linux: 0 -> 1
To also have Linux emulation enabled at boot, set kern.emul.linux=1 in /etc/sysctl.conf:
# cat /etc/sysctl.conf | sed 's/#kern.emul.linux=1/kern.emul.linux=1/' > /etc/sysctl.conf.new
# diff -u /etc/sysctl.conf /etc/sysctl.conf.new
--- /etc/sysctl.conf    Wed Mar 12 17:28:24 2008
+++ /etc/sysctl.conf.new        Sat May  3 22:26:30 2008
@@ -42,5 +42,5 @@
 #kern.emul.bsdos=1             # enable running BSD/OS binaries
 #kern.emul.freebsd=1           # enable running FreeBSD binaries
 #kern.emul.ibcs2=1             # enable running iBCS2 binaries
-#kern.emul.linux=1             # enable running Linux binaries
+kern.emul.linux=1              # enable running Linux binaries
 #kern.emul.svr4=1              # enable running SVR4 binaries
# mv /etc/sysctl.conf.new /etc/sysctl.conf
You'll need to install the Fedora base package which install the libraries that are used by Linux executables:
# bsd-get install fedora_base
Going to install 1 packages:
 fedora_base-4.0p5.tgz

Do you want to continue? (yes/no) [yes]: yes
/usr/sbin/pkg_add -r ftp://ftp.wu-wien.ac.at/pub/OpenBSD/4.6/packages/i386/fedora_base-4.0p5.tgz
fedora_base-4.0p5: complete
Now let's install Folding@Home.

Step 3: Install Folding@Home
We'll use Ivo "Ivoshiee" Sarak's finstall to install the Folding@Home client. It's a nice bash script
which allows you to easily install the Folding@Home client (or several instances of the single core
client if you have multiple CPUs), an init script and (optionally) the third party tools qd and fpd.

We won't run Folding@Home as root, but under a dedicated user account used only to run the
Folding@Home client. First we need to create the account:
# adduser folding
Couldn't find /etc/adduser.conf: creating a new adduser configuration file
Reading /etc/shells
Enter your default shell: bash csh ksh nologin sh [ksh]: bash
Your default shell is: bash -> /usr/local/bin/bash
Default login class: authpf daemon default staff [default]:
Enter your default HOME partition: [/home]:
Copy dotfiles from: /etc/skel no [/etc/skel]:
Send message from file: /etc/adduser.message no [no]:
Do not send message
Prompt for passwords by default (y/n) [y]:
Default encryption method for passwords: auto blowfish des md5 old
[auto]:
Use option ``-silent'' if you don't want to see all warnings and questions.

Reading /etc/shells
Check /etc/master.passwd
Check /etc/group

Ok, let's go.
Don't worry about mistakes. There will be a chance later to correct any input.
Enter username []: folding
Enter full name []: Folding@Home user
Enter shell bash csh ksh nologin sh [bash]:
Uid [1001]:
Login group folding [folding]:
Login group is ``folding''. Invite folding into other groups: guest no
[no]:
Login class authpf daemon default staff [default]:
Enter password []:
Set the password so that user cannot logon? (y/n) [n]: y

Name:        folding
Password:    ****
Fullname:    Folding@Home user
Uid:         1001
Gid:         1001 (folding)
Groups:      folding
Login Class: default
HOME:        /home/folding
Shell:       /usr/local/bin/bash
OK? (y/n) [y]: y
Added user ``folding''
Copy files from /etc/skel to /home/folding
Add another user? (y/n) [y]: n
Goodbye!
Note: It's important to set the folding users shell to bash because the finstall script contains bashisms
and thereby only runs correctly in bash.

We can now login to the folding account and give it a prettier prompt:
# su - folding
-bash-4.0$ echo "PS1='\u@\h:\w\$ '" >> .profile
-bash-4.0$ echo "export PS1" >> .profile
-bash-4.0$ . .profile
folding@vmware-openbsd:~$
And finally install the Folding@Home client:
folding@vmware-openbsd:~$ wget http://ra.vendomar.ee/~ivo/finstall
--23:07:06--  http://ra.vendomar.ee/~ivo/finstall
           => `finstall'
Resolving ra.vendomar.ee... 194.204.4.34
Connecting to ra.vendomar.ee|194.204.4.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 164,110 (160K) [text/plain]

100%[==================================================>] 164,110      232.89K/s

23:07:07 (232.43 KB/s) - `finstall' saved [164110/164110]

folding@vmware-openbsd:~$ chmod u+x finstall
folding@vmware-openbsd:~$ ./finstall
[...snip...]
After finstall is done downloading and installing we can let root use the installService script to have
the Folding@Home client started at boot time:
folding@vmware-openbsd:~/foldingathome$ logout
# bash ~folding/foldingathome/installService
Installing FAH as a service...

What user shall I run FAH as?
folding
# tail -3 /etc/rc.local /etc/rc.shutdown
==> /etc/rc.local <==
#Start up Folding@Home Service
echo "Starting Folding@Home Service..."
su - folding -c "/home/folding/foldingathome/folding start"

==> /etc/rc.shutdown <==
su - folding -c "/home/folding/foldingathome/folding stop"
echo "Sleeping 20 seconds to allow Folding@Home service time to shut down properly..."
sleep 20

Note: This script needs to be run by root, because it modifies /etc/rc.local and /etc/rc.shutdown.


Written: 2009-10-23


Fortune:

bug, n:
	An elusive creature living in a program that makes it incorrect.
	The activity of "debugging", or removing bugs from a program, ends
	when people get tired of doing it, not when the bugs are removed.
	-- "Datamation", January 15, 1984