Folding @ Home : Installation – Configuration – Automation : Ubuntu / Debian | RHEL / FC

By | 2007/05/23

Please consider downloading the latest version of folding instead.

Automated script available here.

Before I dive into my tutorial and tell you how to setup your machine for running the Folding @ Home process I’ll take just a minute and introduce those of you unaware to what the project is.

The project is a distributed computing effort put together by Stanford University to help research protein folding and, based on that research, help in medical research for conditions such as: Alzheimer’s Disease, Huntington’s Disease, Osteogenesis Imperfecta, Parkinson’s Disease, etc. Basically, you can use your machines idle processes to help in medical research. Not a bad way to put your computer to good use!

Now to the good stuff. How do I set this up? Well there is a simple way that allows you to simply run the research application when you remember. It’ll save it’s data to your home folder (clutter things up just a bit) and stop when you stop it. This is the way I ran the program for quite a while but I found it to be a little bothersome to have to manually deal with it all the time. There were a few fixes that I found to help move it behind the scenes, but recently I really started looking into a long-term solution, which is the basis for this tutorial.

Overview:

  1. This tutorial will create a dedicated system user on your machine to run the process and store the data. Data will be stored in a subfolder of /var/ (can be changed, if you prefer).
  2. This system user will not be assigned a login, password or shell for security reasons.
  3. I will outline installation, setup and automation of starting, stopping and checking status of the application.
  4. The application will be handled with an init service for automagically starting at boot and allowing you to stop or start the service on demand.

A few notes on the tutorial syntax. Lines prefixed with the ‘sudo’ command are specific for Ubuntu / Debian based machines. If you’d like to run this setup on a RHEL / FC based machine simply ‘su -’ to root to run those commands. Also, near the end I have labeled [Ubuntu / Debian] or [RHEL / FC] for the distribution specific commands.

First on the list is to create a dedicated user to run this process. This is done for a few reasons. For one, some people have concerns that the Folding @ Home process may not be completely secure. While there have been no reported security vulnerabilities in its history, it is a valid concern and one that is addressed here. The Folding @ Home process runs ‘work units’ on your machine and reports back to the main servers at Stanford. One of the best ways to ensure security during this communication is to create a limited system user to handle the work. Even if the service was somehow compromised the affected user would have no access to anything, therefore effectively stopping the threat.

sudo useradd -d /var/folding -r folding

The syntax of this, if you’re not familiar tells the new system user, folding, to use /var/folding as its home folder as opposed to the standard /home/ area.

Second (unless I can figure out the right syntax for the above command), you’ll need to manually create the folder.

sudo mkdir /var/folding

After the folder is created you will also want to make sure that it is owned strictly by the new user.

sudo chown folding.folding /var/folding

Now that you have the user set up, the home folder created and ownerships set properly you will want to download the ‘finstall’ script. This is a third party script that helps automate the whole process. In my testing it has been really solid and can be used on Linux, WINE, BSD or OS X based machines (w00t!).

With this next command we’ll pull down an installer script that will set everything up for us. You’ll want to be in your newly created /var/folding at this point (cd /var/folding/)

sudo wget -c http://www.vendomar.ee/~ivo/finstall

Once this download has finished you’ll need to add the execute permission on the file. This is done simply with:

sudo chmod +x finstall

Ok, now we’re about half way there.

Now we’re ready to run finstall but remembering that we want it installed, owned and run by our new user we’ll want to install it as them first. We’ll need to temporarily switch to that user now.

sudo -i

su - folding

This will land you in a limited shell, if it can even be considered a shell, but you can still run the installer. Use the following command to launch the installer and follow the prompts.

/bin/bash ./finstall

Now, as I mentioned, this installer is very comprehensive and will ask you quite a bit to get things setup initially. It will download the actual Folding @ Home program, allow you to verify the checksum (it’s always nice to verify that we’re installing what we think we’re installing!), and also add a FAQ where you can find out more information.

The questions that it might ask you are as follows, and appended with my suggested answers. (Depending on your system you may not see all / each question listed here.)

Do you want to read finstall FAQ (yes/no?): n (I've read it a few times now, this one is up to you)

Is this the correct MD5SUM value of FAH504-Linux.exe (yes/no?): y (double check if you like here.)

Do you want to use any of these 3rd party FAH utilities (y/n)?: y

Do you want to use automatic MachineID changing (y/n)?: y

Do you want to use it for this client and for all remaining configureless clients as well (y/n)?: y

It will also ask you for a name. The name is optional, or you can use an alias / name of your choice. You can use this page to see if the name is available. The only reason the name might be important is if you want to compare your finished work units vs a friend.

It will also ask you for a (optional) team to join. Might I suggest you join the Ubuntu Folding @ Home Team? Show your Ubuntu pride and save the world with the rest of the Ubuntu crew. To join the Ubuntu Folding @ Home Team use the number 45104.

After the questions about the name and team it prompts for a few more options. The defaults are safely used here.

Ok, once this installer finishes asking you how to set things up you’re *almost* there! Just a few more quick commands and we’re ready to set-and-forget.

You can now type ‘exit’ and ‘exit’ to leave the prompt you are in as the new folding user. The only thing left to do is create the startup script and make sure it runs as the new user.

sudo cp foldingathome/folding /etc/init.d/

sudo update-rc.d folding defaults [Ubuntu / Debian]

chkconfig folding on [RHEL/FC]

sudo chmod 4775 foldingathome/folding

Ok. You’re ready to go now. There is a copy of the start / stop script in your init folder. The update (or chkconfig) has set this script to automagically start on multi-user runlevels and SUID permissions have been set on the script so that it will *always* run as, and with permissions of, your new limited system user.

To go ahead and start the service type:

sudo /etc/init.d/folding start [Ubuntu / Debian]

service folding start [RHEL/FC]

To stop the service type:

sudo /etc/init.d/folding stop [Ubuntu / Debian]

service folding stop [RHEL/FC]

Remember, this will now auto-start at boot so you can safely just ignore it from here on out. No more config, manually starting, remembering to start the service, etc. You’re done.

update: A few people have been wondering how to remove this after it has been installed. This can be done in just a few commands:

sudo /etc/init.d/folding stop [Ubuntu / Debian]

service folding stop [RHEL/FC]

sudo rm /etc/init.d/folding

sudo update-rc.d folding remove [Ubuntu / Debian]

service folding off [RHEL/FC]

sudo userdel -r folding

sudo rm -rf /var/folding

done.

sources: Folding @ Home, Ubuntu F@H Community Docs, Finstall Script, FAH Wiki.

26 thoughts on “Folding @ Home : Installation – Configuration – Automation : Ubuntu / Debian | RHEL / FC

  1. Warbo

    Nice in-depth instructions, I like to see people running this kind of software wherever possible (sadly I can’t do it since I switched to a laptop since the CPUs go up to 100%, the battery drains and the whole thing heats up tremendously and sounds like a shuttle launch :( ).

    For people interested there is also this page: https://help.ubuntu.com/community/WorldCommunityGridTeamUbuntu

    Reply
  2. GoatTuber

    Sweet, I’ve been wanting to get F@H running on my Ubuntu box since I switched over. I used to run it under Windoze when I was disadvantaged and as you said the default Linux installation method made it too messy in your home folder. I’ll have this up and running on the home PCs soon so the wife and I can be a little more useful.

    Reply
  3. Hunding

    Thanks Zelut, very easy with all the work you put into this.
    Anyway to actaully see if it is doing something?

    Reply
  4. Ivoshiee

    > Anyway to actaully see if it is doing something?

    Issue these commands:
    /etc/init.d/folding status dirs
    /etc/init.d/folding status dirs viewlog

    Reply
  5. DFreeze

    Thanks a million! I’ve just yesterday tried to follow an outdated HOWTO on the forums and failed (only tried once). Next day, yours was online and I got it working now.

    A few remarks:
    In the reduced shell, you type
    [code]
    /bin/bash ./finstall
    [/code]

    But the finstall is not found in the home folder of $root. I had to type /home/username/finstall explicitly to install it.

    The same goes for this line:
    [code]
    sudo cp foldingathome/folding /etc/init.d/
    [/code]
    this file is not in my own home account, but in the ‘folding’ homedirectory, so the user has copy the file from /var/folding/foldingathome.

    Maybe this is obvious for most, but since I’m not very keen with the commandline they made me scratch my head a while.

    Anyway, I just wanted to give you some feedback on how my following your HOWTO went. Apart from these small hiccups, the walkthrough was straightforward and simple.

    Thanks again!

    Reply
  6. Ubuntu Tutorials

    DFreeze – the tutorials suggests changing into the proper directory prior to running those commands so my guess is you missed one little step and that threw the rest of the tutorial off.

    If you go through and read very carefully (not *just* the commands) you’ll see where it suggests changing directories and you should be just fine.

    Thanks for the great feedback guys.

    Reply
  7. DFreeze

    @Ubuntu Tutorials

    …oops, you’re right, I’ve overlooked that part… My bad.

    Reply
  8. Ritesh

    Great article. I put a link to this one on my website under tips/tricks. Hope thats ok :)

    Reply
  9. PCD

    Everything has been going fin until I got to the part with the “/bin/bash ./finstall”. It says “No such file or directory”.

    Can some one help me?

    Reply
  10. Pingback: tsuehpsyde.com » Blog Archive » Folding Install How-To

  11. NacIK

    I can not setup the startup script. When I type in the command it comes up with:

    jeremiah@jeremiah-desktop:~$ sudo cp foldingathome/folding /etc/init.d/
    cp: cannot stat `foldingathome/folding’: No such file or directory

    Reply
  12. NacIK

    Why am i getting this?

    Creating /var/folding/foldingathome/folding…
    …/var/folding/foldingathome/folding created.
    /var/folding/foldingathome/folding: line 1611: ./qd: No such file or directory
    /var/folding/foldingathome/folding: line 1614: ./qd: No such file or directory
    /var/folding/foldingathome/folding: line 1611: ./qd: No such file or directory
    /var/folding/foldingathome/folding: line 1614: ./qd: No such file or directory

    ***!!! NO client.cfg FOUND !!!*****************************************************
    Before using ./folding script, You must run the FAH client and configure it!
    Example:
    cd /var/folding/foldingathome/CPU1
    ./FaH -configonly
    Or run ./finstall again, without ‘norun’ or ‘auto’ option.
    ***********************************************************************************

    Reply
  13. Phalse

    I tried using the shanghai release and everything works fine until I try this command:
    user@box:/var/folding/foldingathome/CPU1$ sudo /etc/init.d/folding start

    When I run it I get the following output. Any idea what the problem could be?
    ['folding' ver. 5.7]

    Starting up FAH client(s) on 2 processor(s):
    Starting FAH client at CPU1…
    FAH client #1 startup: OK
    Starting FAH client at CPU2…
    FAH client #2 startup: OK

    Starting of FAH client(s): FAILURE

    Reply
  14. Ubuntu Tutorials

    Phalse – could you please check your logs for any additional output and report that back via https://launchpad.net/folding ? Also, the installer should auto-start the folding client. Can you check the output for /etc/init.d/folding status prior to start? The installer tries to automate as much as possible so it may already be going. Also, 0.5 “delta” has been released with some improvements. That may be worth trying as well.

    Reply
  15. Alan

    I run 64 bit Gutsy Gibbon,

    Is there anyway this could be revised to install the 64 bit version of Folding@Home?

    Thanks.

    Reply
  16. john

    WOW EXCELLENT GUIDE! I ran through it with no problems at all.

    Like a few others pointed out, you need to mention that when you change users, you need to CD to the /var/folding dir. Other than that, no problems on my side.

    Reply
  17. Sicktronic

    $ /bin/bash ./finstall
    /bin/bash: ./finstall: No such file or directory

    Thank you for your nice tutorial, but something is wrong here or not explained completely.

    Reply
  18. Mark

    I keep getting this when I try and run the service:

    Starting up FAH client(s) on 4 processor(s):
    Starting FAH client at CPU1…
    FAH client #1 startup: OK
    Starting FAH client at CPU2…
    FAH client #2 startup: OK
    Starting FAH client at CPU3…
    FAH client #3 startup: OK
    Starting FAH client at CPU4…
    FAH client #4 startup: OK

    Starting of FAH client(s): FAILURE

    Could this have something to do with the client.cfg file? I tried running the client manually to generate the .cfg file (-configonly), but it did said it “cannot execute binary file”

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *