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

Writings

Install Folding@Home on OpenBSD 4.3

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

DEPRECATED
A more recent version of this HOWTO is available for 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.3 first.

The fine people of the OpenBSD project have written an excellent installation manual,
which we'll follow to get our OpenBSD 4.3 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. 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.calyx.nl/pub/OpenBSD/4.3/packages/i386/wget-1.10.2p1.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
Connected to ftp.calyx.nl.
220-
220-                                    .__
220-                        ____ _____  |  | ___.__.___  ___
220-                      _/ ___\__  \ |  |<   |  |\  \/  /
220-                      \  \___ / __ \|  |_\___  | >    <
220-                       \___  >____  /____/ ____|/__/\_ \
220-                           \/     \/     \/           \/
220-                        ------ Calyx Internet B.V. -----
220-                      http://www.calyx.net - New York City
220-                       http://www.calyx.nl - Amsterdam
220-
220-           Large-scale security-focused web hosting and colocation.
220-                  Internet systems design and integration.
220-
220-           For any questions or comments regarding this archive
220-           please email ftpadmin@calyx.nl.
220-
220- =============================================================================
220-    Legal Notice: This PRIVATE system is for the use of authorized users only.
220-    Individuals using this computer system without authority, or in excess of
220-    their authority, are subject to having all of their activities on this
220-    system monitored and recorded by system personnel.
220- =============================================================================
220-
220 ftp.calyx.nl FTP server ready.
331 Guest login ok, send your email address as password.
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
200 Type set to I.
250 CWD command successful.
Retrieving pub/OpenBSD/4.3/packages/i386/index.txt
local: /root/.bsd-get.index remote: index.txt
150 Opening BINARY mode data connection for 'index.txt' (108282 bytes).
100% |*******************************************************|   105 KB    00:00
226 Transfer complete.
108282 bytes received in 0.21 seconds (513.59 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-3
# bsd-get install screen-4.*p1.tgz
# bsd-get install rsync-2
# 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.0p3.tgz

Do you want to continue? (yes/no) [yes]: yes
/usr/sbin/pkg_add -r ftp://ftp.calyx.nl/pub/OpenBSD/4.3/packages/i386/fedora_base-4.0p3.tgz
fedora_base-4.0p3: 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
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]:
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-3.2$ echo "PS1='\u@\h:\w\$ '" >> .profile
-bash-3.2$ echo "export PS1" >> .profile
-bash-3.2$ . .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: 2008-05-03


Fortune:

The choice of approaches could be made the responsibility of the
programmer.
	-- Larry Wall in <199709081901.MAA20863@wall.org>