Index  | Recent Threads  | Unanswered Threads  | Who's Active  | Guidelines  | Search
 

Quick Go ยป
No member browsing this thread
Thread Status: Active
Total posts in this thread: 10
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 7303 times and has 9 replies Next Thread
Marc Andre Wyss
Advanced Cruncher
Switzerland
Joined: Jun 4, 2009
Post Count: 57
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Tutorial - Diskless Ubuntu clients for BOINC crunching

Hi all

I played around a little bit with Ubuntu and PXE to learn how diskless linux clients are working. Furthermore I had the idea of having a BOINC cluster with diskless crunching nodes.

I know that Dotsch is already providing a distribution based on Ubuntu. My primary goal was knowledge, the secondary goal was a working solution. You don't have to read my tutorial, nor do you have to use it. I know some things are ugly and you would do them different, especially if you are a linux system developer or a administrator. If you are not interested in my tutorial, but in diskless crunching nodes, please take a look at http://www.dotsch.de/boinc/

---

Introduction

Because I wanted to test everything before buying the real hardware, I decided to simulate everything with VMware Workstation 7.0.0. I took Ubuntu 9.10 Desktop in 32Bit, because my 64Bit Dell Precision 670 Workstation doesn't allow me to activate the VT flag for my Xeon CPU's. Therefore all my virtual machines are doomed to run in 32Bit mode. If you managed to setup everything with 64Bit, please let me know. Even if you find a BIOS hack to enable VT on Dell Precision 670, please let me know. :-)

The first idea was to have a single read-only system for every diskless client, except for /home. This worked very well, until i tried to execute BOINC. Unfortunately BOINC reported all the time that a BOINC instance was already running. Because the filesystem where BOINC was stored (/home) was read- and writable, but the error continued, I decided then to have my diskless linux system read- and writable. I still don't understand where BOINC needs write access to, except for the BOINC (and working) directory , where it was installed.


Step 0

The (virtual) master node uses 1024MB RAM, a 20GB harddisk and two ethernet interfaces. The first interface (eth0) is in bridged mode, the second interface (eth1) is bound to VMnet9, which is not related to bridged, NAT or host-only. Every virtual machine with a ethernet interface on VMnet9 is therefore in a (virtual) private LAN with no direct access to any other LAN or WAN except through the master node. All clients node have 1024MB RAM, no harddisk and one ethernet interface (eth0) bound to VMnet9.


Step 1 - Ubuntu Installation

Install Ubuntu as usual on the master node, but don't run any updates on the system. This is because the clients are using the same kernel as the master node and updating the clients system caused me some problems. Therefore wait with updating the master node until everything is working.

Because the diskless system uses just the main branch of Ubuntu, we want to use the same on the master node. Open a console and type in the following:
sudo su
cp -a /etc/apt/sources.list /etc/apt/sources.list.org
nano /etc/apt/sources.list
Now delete (or comment out) everything in the file. Just the following two lines should be in there:
Now do the following back in the console:
apt-get update
apt-get install dhcp3-server nfs-kernel-server syslinux tftpd-hpa debootstrap


Step 2 - Network configuration

You need to configure both ethernet interfaces. You can do it with the file /etc/network/interfaces or with the Network Manager. To have things simple I did it with the Network Manager.

eth0: DHCP (or if you wish you can use here a static IP)

eth1: 192.168.2.1 (Address)
255.255.255.0 (Netmask)
192.168.2.1 (Gateway)
192.168.2.1 (DNS)

Note: If the network you connect eth0 to already uses the 192.168.2.0/24 network, you have to use a different one for eth1. All the instructions here assume that the network on eth1 is the above one. If this is not the case for you, every later instruction has to be corrected for your case.


Step 3 - DHCP basic configuration

Now we have to tell DHCP server which interface it must use. Back in the console type in the following:
nano /etc/default/dhcp3-server
Change the following line:
INTERFACES=""
to this one:
INTERFACES="eth1"


Step 4 - DHCP detailed configuration

Again within the console:
nano /etc/dhcp3/dhcpd.conf
Delete (or comment out) everything in the file and add the following:
allow booting;
allow bootp;

subnet 192.168.2.0 netmask 255.255.255.0 {
option broadcast-address 192.168.2.255;
option routers 192.168.2.1;
option domain-name-servers 192.168.2.1;
filename "/pxelinux.0";
}

host node-01 {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.2.2;
option host-name node-01;
}
Note: For each new diskless client you have to add a new host entry with different IP address, hostname and MAC address. You have to replace 00:00:00:00:00:00 with the IP address of your diskless client.

Now you can restart the DHCP server with typing in the following command in the console:
/etc/init.d/dhcp3-server restart
Note: Everytime you change the config file, you have to restart the DHCP server.


Step 5 - NFS configuration

Now we make our NFS filesystem up and running. In the console type in:
mkdir -p /diskless/nfsroot
chmod 777 /diskless/nfsroot
To grant clients access to the folder, we have add the location to the config file:
nano /etc/exports
Add the following line:
/diskless/nfsroot 192.168.2.0/24(rw,sync,no_root_squash,no_subtree_check)
After saving the config file, execute the following within the console:
exportfs -ra


Step 6 - TFTP configuration

Within the console type in the following:
nano /etc/default/tftpd-hpa
Change the following line:
RUN_DAEMON="no"
OPTIONS="-l -s /var/lib/tftpboot"
to this one:
RUN_DAEMON="yes"
OPTIONS="-l -s /diskless/tftpboot"
We have to comment out an entry in inetd.conf. Type in
nano /etc/inetd.conf
Change the following line:
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
to this one:
# tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
Back in the console execute the following:
mkdir -p /diskless/tftpboot/pxelinux.cfg
cp -a /usr/lib/syslinux/pxelinux.0 /diskless/tftpboot
Now we can restart the TFTP server:
/etc/init.d/tftpd-hpa restart
Note: It is possible that the (old) TFTP config within /etc/inetd.conf is still active. If you experience any problems here. Just restart the master node.

Step 7 - Kernel configuration

Type in the console:
nano /diskless/tftpboot/pxelinux.cfg/default
Write down the following content in the file:
LABEL linux
KERNEL vmlinuz
APPEND root=/dev/nfs initrd=initrd.img nfsroot=192.168.2.1:/diskless/nfsroot ip=dhcp rw vga=771 quiet
We use the same kernel as on the master node. In the console do the following:
cp -a /boot/vmlinuz-`uname -r` /diskless/tftpboot
cd /diskless/tftpboot
ln -s vmlinuz-`uname -r` vmlinuz
The difference is the initrd.img.
nano /etc/initramfs-tools/initramfs.conf
Change the lines:
BOOT=local
MODULES=most
to:
BOOT=nfs
MODULES=netboot
Back in the console do:
mkinitramfs -o /diskless/tftpboot/initrd.img-`uname -r`
Now do the opposite of the above:
nano /etc/initramfs-tools/initramfs.conf
Change the lines:
BOOT=nfs
MODULES=netboot
back to:
BOOT=local
MODULES=most
finally we do:
cd /diskless/tftpboot
ln -s initrd.img-`uname -r` initrd.img


Step 8 - Client system installation

Execute the following within the console and wait:
debootstrap --include=openssh-server,nfs-common,wget karmic /diskless/nfsroot


Step 9 - Client system configuration

nano /diskless/nfsroot/etc/fstab
Add the following to the file:
proc /proc proc defaults 0 0
/dev/nfs / nfs defaults 1 1
none /tmp tmpfs defaults 0 0
none /var/lock tmpfs defaults 0 0
none /var/log tmpfs defaults 0 0
none /var/tmp tmpfs defaults 0 0
none /var/run tmpfs defaults 0 0
We must configure the ethernet interfaces of the clients:
nano /diskless/nfsroot/etc/network/interfaces
Add the following to the file:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual
To avoid an apparmor error on boot up, we have to do the following:
mkdir -p /diskless/nfsroot/etc/apparmor
nano /diskless/nfsroot/etc/apparmor/initramfs
Add the following to the file:
#!/bin/sh
Now we set the file executable:
chmod 755 /diskless/nfsroot/etc/apparmor/initramfs
To allow the DHCP assigned hostname to be set, we have to empty the following file.
nano /diskless/nfsroot/etc/hostname
Note: If there is an empty line in the file, the hostname is empty. You have to completly remove everything within the file, even spaces and empty lines.


Step 10 - Gateway installation

To allow the clients internet access, we set up the master node as gateway:
nano /etc/sysctl.conf
Replace the following line:
# net.ipv4.ip_forward=1
with this one:
net.ipv4.ip_forward=1
Then do:
sysctl -p /etc/sysctl.conf
Our master node acts now as router, but we want NAT too.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
To have the NAT restored at reboot, we have to do:
nano /etc/network/if-up.d/iptables
Add the following to the file:
#!/bin/sh

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Now we set the file executable:
chmod 755 /etc/network/if-up.d/iptables


Step 11 - User Management

As we don't have a user management like LDAP, we must make sure that the user and group id's of the diskless client are the same as on the master node. First of all, we add a boinc user on the master node, which is called boinc-client.
adduser --disabled-password --disabled-login boinc-client
Then we have to find out the user and group id's of this user.
id boinc-client
This returned me the following:
uid=1001(boinc-client) gid=1001(boinc-client) groups=1001(boinc-client)
Now we know the id's we must use for the clients. Now we can change to the diskless system with:
chroot /diskless/nfsroot
Then we add a group and a user corresponding to the master node setup:
adduser -gid 1001 boinc-client
adduser --uid 1001 --gid 1001 --disabled-password --disabled-login boinc-client
The master node and all clients are using the same user and group id's for the boinc user.

We leave our diskless system with:
exit
As you may noticed. The boinc user on all clients has its home at /diskless/nfsroot/home, in case you are on the master node, and on /home in case you are on the client nodes. But this is the same location differently mounted respectively exported by NFS. The boinc user on the master node has its home in /home, but not in /diskless/nfsroot/home. But we want a system wide home storage for the boinc user, therefore we must linking the home to a different location.
rm -r /home/boinc-client
chmod 777 /home
cd /home
su boinc-client
ln -s /diskless/nfsroot/home/boinc-client boinc-client
exit
chmod 755 /home
Note: Every normal user you are adding to the master node, will have it's home on /home and will not be seen by the diskless clients. You may say that you can specify the home by adding --home to adduser. This is correct. However the startup script for the master node would be different then. You can write a script which will work, but the script must then findout itself, where the home of the boinc user is. My script assumes the home in /home.


Step 12 - BOINC installation

Every node must have its own BOINC installation. If different nodes are using the same (copied) installation, then different nodes would have the same computer id, which confuses the BOINC server somehow. At least that was what I discovered. Therefore every node must have it's custom installation. But we want to do this a little bit automated.

First of all, we download the desired BOINC version:
Then we rename it:
mv boinc_6.10.17_i686-pc-linux-gnu.sh boinc-installer.sh
Note: Another thing you can do is to have multiple boinc installers within /home/boinc-client. You can then add a symlink to the desired version and name it boinc-installer.sh. This is maybe a better way to have an overview of the version. It may be necessary to change my startup script then, because it sets execution rights for boinc-installer.sh. To be fine you can change the rights right after downloading BOINC.

We must add a startup script to all nodes. We do it first for all client nodes, and copy it then for the master node:
nano /diskless/nfsroot/etc/rc.local
Change the following line:
exit 0
To this ones:
BOINCUSER="boinc-client"
BOINCHOME="/home/$BOINCUSER"
BOINCINSTALLER="boinc-installer.sh"

# Sets owner and group of the installer to the BOINC user
chown $BOINCUSER $BOINCHOME/$BOINCINSTALLER
chgrp $BOINCUSER $BOINCHOME/$BOINCINSTALLER
chmod 755 $BOINCHOME/$BOINCINSTALLER

# If the node has a BOINC installation, then start it, else install BOINC.
if [ -d $BOINCHOME/`uname -n` ];
then
cd $BOINCHOME/`uname -n`/BOINC
su $BOINCUSER -c "./boinc --allow_remote_gui_rpc --daemon"
else
mkdir $BOINCHOME/`uname -n`
chown $BOINCUSER $BOINCHOME/`uname -n`
chgrp $BOINCUSER $BOINCHOME/`uname -n`
chmod 755 $BOINCHOME/`uname -n`
cp -a /$BOINCHOME/$BOINCINSTALLER $BOINCHOME/`uname -n`

cd $BOINCHOME/`uname -n`
su $BOINCUSER -c "./$BOINCINSTALLER"
rm $BOINCHOME/`uname -n`/$BOINCINSTALLER
fi

exit 0
As you see, the if part starts an already (configured) installation of BOINC. The else part just installs a clean BOINC to /home/boinc-client/<node>/BOINC. I tried to automate the attach to a new project too. However it failed. Therefore this script is just useful to start already configured installations and to do clean installations on new nodes. If you want to participate into multiple BOINC projects it would be even better to do it manually. Once a node is running you can attach new projects trough the BOINC manager easily.

Now we have to copy the file to the master node as well:
cp -a /diskless/nfsroot/etc/rc.local /etc/rc.local


Step 13 - SSH configuration

To manage the diskless clients, we added a SSH Server during the debootstrap process. Now we have to configure our client nodes to allow remote access (without) password.

We generate a SSH keypair. Don't use a passphrase. You can use one, but then you will be asked all the time unless you are using a key management tool on your master node.
ssh-keygen -t rsa
We copy the public key to the client system.
mkdir -p /diskless/nfsroot/root/.ssh
cp -a /root/.ssh/id_rsa.pub /diskless/nfsroot/root/.ssh/authorized_keys
You should be able to login passwordless to all client machines from the master node.

If you want to login passwordless from every node to every node, you have to copy id_rsa and id_rsa.pub to the client system too:
cp -a /root/.ssh/id_rsa* /diskless/nfsroot/root/.ssh/
Note: This setup allows you to connect passwordless from the master node to any client node, and to connect passwordless from any client node to any other client node. It does not allow a passwordless connection from any client node to the master node. If you want to have that as well, you have to add the authorized_keys file on the master node too.


Step 14 - BOINC configuration

As we now have SSH access to any node, we can start with the (initial) configuration of the BOINC installations. Start every diskless client you want to configure. For every client you started, a new folder with the hostname of the diskless client will be generated within /diskless/nfsroot/home/boinc-client/ respectively /home/boinc-client/. If you see the BOINC folder in there, you can start with configuring the corresponding node. Login to it via SSH:
ssh root@192.168.2.2
su -l boinc-client
cd /home/boinc-client/`uname -n`/BOINC
./boinc --attach_project <url> <key>
This will attach the node to a certain project, downloads the corresponding files, and will start to download work units. After the download of the work units is finished, you can press CTRL-C to quit BOINC. To manage this BOINC installation a password must be set.
echo <password> > gui_rpc_auth.cfg
The node is now ready for crunching. Just restart it and the BOINC crunching will start automatically.
reboot
Note: Repeat this step for every node. If you don't to it, it will idle. The same procedure can be done for the master node, if you wish to do so.


Step 15 - BOINC management

If you installed BOINC on the master node, you can run start the BOINC manager as follows:
cd /home/boinc-client/`uname -n`/BOINC
nohup ./run_manager&
The nohup command allows you to close the console terminal. Otherwise the BOINC manager would get killed if you close the console terminal.


Step 15 - Improvements

If we are managing a node, we always are using their IP addresses to connect to them. This is true for SSH, but also for the BOINC manager. As we don't have a DNS server, we can workaround this by using /etc/hosts.
nano /etc/hosts
Add a line with IP and hostname for every node you want to manage with its hostname.

You can do the very same for the clients.
nano /diskless/nfsroot/etc/hosts
Do the same as above, but add an additional line:
127.0.0.1 localhost


Thanks

The following websites helped me.

----------------------------------------
Schweizerische Muskelgesellschaft
(Swiss Muscular Dystrophy Association)
[Feb 7, 2010 10:43:01 AM]   Link   Report threatening or abusive post: please login first  Go to top 
Sekerob
Ace Cruncher
Joined: Jul 24, 2005
Post Count: 20043
Status: Offline
Reply to this Post  Reply with Quote 
applause Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

Great stuff, I'll add a link to the Start Here FAQ Index (which is due a restructure and needing added sub-sections). The cross-link to Dotch's work makes it a comprehensive resource.

:-]
----------------------------------------
WCG Global & Research > Make Proposal Help: Start Here!
Please help to make the Forums an enjoyable experience for All!
[Feb 7, 2010 11:05:01 AM]   Link   Report threatening or abusive post: please login first  Go to top 
Marc Andre Wyss
Advanced Cruncher
Switzerland
Joined: Jun 4, 2009
Post Count: 57
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

First test it, then add it. ;-)

It works on my (virtual) cluster. As soon as I have the money, I will install a physical cluster. :-)
----------------------------------------
Schweizerische Muskelgesellschaft
(Swiss Muscular Dystrophy Association)
[Feb 7, 2010 11:09:23 AM]   Link   Report threatening or abusive post: please login first  Go to top 
Sekerob
Ace Cruncher
Joined: Jul 24, 2005
Post Count: 20043
Status: Offline
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

Ubuntu is not my thing, and if test reports are coming through in this thread, included without me having to track. You've got 60 days to edit/polish your tutorial post if you wish should items need tweaks and enhancement :)

PS, think there's a guy who runs a rendering farm using PXE and storing the client instances away when he needs the diskless devices and dynamically reloading them without loosing progress.
----------------------------------------
WCG Global & Research > Make Proposal Help: Start Here!
Please help to make the Forums an enjoyable experience for All!
[Feb 7, 2010 11:21:52 AM]   Link   Report threatening or abusive post: please login first  Go to top 
Marc Andre Wyss
Advanced Cruncher
Switzerland
Joined: Jun 4, 2009
Post Count: 57
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

Well my setup does the same. You can reboot all diskless clients as you wish. The data resides on the master node. :-)

Therefore I even recommend a RAID system for the master node. Otherwise if the harddisk of the master node crashes you will loose everything.
----------------------------------------
Schweizerische Muskelgesellschaft
(Swiss Muscular Dystrophy Association)
----------------------------------------
[Edit 1 times, last edit by Marc Andre Wyss at Feb 7, 2010 11:45:08 AM]
[Feb 7, 2010 11:43:01 AM]   Link   Report threatening or abusive post: please login first  Go to top 
Marc Andre Wyss
Advanced Cruncher
Switzerland
Joined: Jun 4, 2009
Post Count: 57
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

@Sekerob: Have you ever added this tutorial to the FAQs?
----------------------------------------
Schweizerische Muskelgesellschaft
(Swiss Muscular Dystrophy Association)
[Apr 30, 2010 5:16:38 PM]   Link   Report threatening or abusive post: please login first  Go to top 
Sekerob
Ace Cruncher
Joined: Jul 24, 2005
Post Count: 20043
Status: Offline
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

Marc Andre,

It's in the FAQ Index under the Client Install/Uninstall sub-section.

cheers
----------------------------------------
WCG Global & Research > Make Proposal Help: Start Here!
Please help to make the Forums an enjoyable experience for All!
[May 1, 2010 5:27:10 PM]   Link   Report threatening or abusive post: please login first  Go to top 
TimAndHedy
Senior Cruncher
Joined: Jan 27, 2009
Post Count: 267
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

Has anyone tried this following tutorial?

I may make a go of this at some time in the future. Unfortunately I don't have time right now.
[May 1, 2010 10:07:51 PM]   Link   Report threatening or abusive post: please login first  Go to top 
Marc Andre Wyss
Advanced Cruncher
Switzerland
Joined: Jun 4, 2009
Post Count: 57
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

If I have time, I will retry it on Ubuntu 10.04 32 Bit. Any maybe with 64 Bit. As my desktop still don't have the VT flag enabled, because of BIOS restrictions (NOT CPU restrictions), a simulation of a 64 Bit cluster is just possible on my notebook.
----------------------------------------
Schweizerische Muskelgesellschaft
(Swiss Muscular Dystrophy Association)
[May 2, 2010 1:45:32 PM]   Link   Report threatening or abusive post: please login first  Go to top 
UNiRAC
Advanced Cruncher
US
Joined: Dec 2, 2004
Post Count: 134
Status: Offline
Project Badges:
Reply to this Post  Reply with Quote 
confused Re: Tutorial - Diskless Ubuntu clients for BOINC crunching

d/l'd WUBI off cnet DOT com and it ruined my brand new laptop's MBR WTF! crying
----------------------------------------
Are You REALLY Computing?
[Feb 16, 2011 4:33:21 AM]   Link   Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Post new Thread