FreeBoo: an Open Architecture for Network Dual Boot

Using FreeBoo, you can restore and boot different operating systems across a network and replace proprietary solutions such as Rembo.
Full Image Restoring

For full image restoration, we use partimage. partimage is much simpler than rsync, because it is not filesystem-dependent. You simply need to create a directory on the server to store the partimage chunk files. Chunks are just data that can be stored in any ext3 filesystem. Because the client gives the full path to the image chunks, you don't need any special configuration for partimaged. The flags to add are -f3 (quit when finished), -b (batch mode) and, for performance issues, -z# (level of compression). Below is the code that restores full images (the restoreLinux.sh and restoreWindows.sh scripts):

#!/bin/sh
# /scripts/restoreLinux.sh and /scripts/restoreWindows.sh
# FreeBoo scripts for full image restoring
#
# INSERT the correct partimage command
#   partimage -f3 -b -s SERVER_IP restore DEST_DEVICE IMAGE
partimage -f3 -b -s 192.168.1.1 \
          restore /dev/hda2 /root/fileImage/linux

# ...continues with kexec commands ...

Hot Boot Phase

The third, and most challenging, FreeBoo phase is the image hot boot. When we started working on FreeBoo, our first idea was to enter into the Linux kernel code to write the hot boot function. But while examining the code, we discovered the kexec system call and its related shell commands. The following two scripts are able to hot boot an OS image installed on a local drive.

Linux hot boot script:

#!/bin/sh
# /scripts/startLinux.sh
# FreeBoo script for Linux hot boot
#
mount /dev/hda2 /mnt/images/linux
kexec -l /mnt/images/linux/vmlinuz \
      --append="root=/dev/hda2 ro quiet splash" \
      --initrd="/mnt/images/linux/boot/initrd.img-2.6.15-23-386"

kexec -e

MS Windows hot boot script:

#!/bin/sh
# /scripts/startWindows.sh
# FreeBoo script for Windows hot boot
#
ntfs-3g /dev/hda1 /mnt/images/windows -o nonempty
kexec -l /mnt/images/windows/grub.exe
kexec -e

Both scripts first mount the partition of the OS image, then they execute kexec -l, and finally, they execute the new OS kernel with kexec -e. The OS kernel must be an ELF executable. For Linux, this is the kernel file directly, but for MS Windows, we use the GRUB bootloader (you should replace the NTLR default bootloader with the GRUB bootloader before saving the client MS Windows image on the server). Finally, you need a GRUB bootloader, such as Grub4dos, with built-in BIOS disk emulation and an ATAPI CD-ROM driver. This is needed because the thin-client execution overwrites the BIOS and most MS Windows versions still rely on some BIOS interrupts for video, timers and disk-related hardware I/O.

Script Execution

The final consideration to get FreeBoo working is in respect to the execution of the script files. We have one script file for each of the six alternatives in the user's menu. These files are located on the server, but we need them to execute on the client. In the menu's HTML code, the links to the scripts are localhost references—for example, <a href="http://localhost/scritps/startLinux.sh">, so the Web browser will try to connect to a local Web server. But, we have not installed any Web server on the client image, because we wanted a light and fast kernel. Instead, we have included two additional scripts in FreeBoo to provide a local Web server. Both scripts are initiated by /etc/init.d/freeboo. Below are the complete freeboostart.sh and the new mini_webapp_s.sh scripts.

Initial freeboostart.sh script:


#!/bin/sh
# /scripts/freeboostart.sh
# FreeBoo script that starts a very simple http
# server with script execution capacity
# in parallel with a web browser
#
mini_webapp_s.sh &
links2 -g YOUR_SERVER_IP

The mini_webapp_s.sh script:

#!/bin/sh
# /scripts/mini_webapp_s.sh
# FreeBoo script that parsers the incoming browser 
# request, gets the script path name and 
# executes it locally
#
torun=`nc -l -p 80 -s 127.0.0.1 | \
         awk '/HTTP/{print $2; exit}' | \
         urldecoder.sh`
($torun)

The first script starts the links2 Web browser mentioned previously. But, it also starts the mini_webapp_s.sh script in parallel to act as a very simple Web server with application execution capacities. This second script executes the output of a pipeline command composed of netcat, awk and urldecoder, which extracts the filename of the script to execute.

Netcat (nc) is a very simple command. Like the traditional cat command, netcat simply copies data from an input stream to an output stream; the only difference is that these streams can be network data. The -l flag (listen mode) specifies that netcat's input comes from the network. The -p 80 and -s 127.0.0.1 options indicate that the input will come on port 80 (the HTTP default port) from IP address 127.0.0.1 (localhost). Netcat's function is to redirect any HTTP request, like the one below, to the awk filter:

GET /scripts/syncroWindows.sh HTTP/1.1
Host: localhost
User-Agent: ...etc...

The awk command extracts the script filename found on the HTTP GET line and passes it to the urldecoder.sh script through a second pipe. urldecoder.sh is a well-known script used to convert a URL with special characters, such as blank spaces, to a valid filename. The parser pipeline finishes when the HTTP of the GET line is found. Then, the variable $torun is set with its output and immediately executed. In the example above, the user has selected the MS Windows fast restore, and the HTTP request contains the /scripts/syncroWindows.sh filename. The pipeline extracts this name, and the next line executes it on the client.

The links2 browser, which is executing in parallel, is waiting for the HTTP response from our local Web server. Because we don't need any more interaction with the user, instead of sending back a response, we have included a line to kill the links2 process in each of the six menu scripts:

# first line of {start | syncro | restore}{Linux | Windows}.sh scripts
killall links2

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

configure a small embedded Gentoo Linux with generic drivers ???

Anonymous's picture

but where to install ???

/dev/hda1 is Window$
/dev/hda2 is linux

Gentoon must be somwhere else.

/dev/hda3 -> swap
/dev/hda4 -> Gentoon ???

And how to make partitions.
Any tips to gparted ?

AH

where to install

mjp5060's picture

If you are referring to the Gentoo Linux that the client downloads to act as the boot-loader and provide the foundation for the client side of the OS deployment/section then it does not go into a partition, but runs in memory as a diskless client. This way it can manipulate the hdd for the OS's you want to deploy.

On that note if anyone has a pre-compiled image of Gentoo already configured for the network boot with all the client side applications please let me know or post a link.

Another note to the authors, this is a great system. Your focus is to make things easy, might I recommend providing a build of the whole system that can be executed on the server and provide a basic/sample setup that can then be easy modified by people who would like to deploy your system.

Images not visible

Lucas Vieites's picture

Hi, the images in this article are not visible. I see they are PS files in an <img> tag. Is this OK for other browsers (Firefox 3 does not show them)
Cheers,

setup directions

mjp5060's picture

Is there a more detailed set of documentation for setting-up/configuring a system like this?

More information

Anonymous's picture

thank you

mjp5060's picture

I had given up on this project because of a lack of information, but today I felt like looking into it again and saw your reply. Thank you so much, and will look that pdf over this week.

configuration/user guide

mjp5060's picture

This pdf was very informative about the technology, but it fails to provide a systematic set of instructions/guide of how to configure a system. Do you guys not have a guide for your projects that lists/demos the minimum requirements of what needs to be setup/configured. You guys have done a great job designing and implementing this architecture, but it is hard to replicate do to lack of instructions.

DRBL and Sources

C.Barrado's picture

I do not agree about the similarity of DRBL with FreeBoo. In DRBL you can boot a Linux net image over a computer with a MS WIndows already installed. BUT, as far as I read, you can not download the MS Windows in the same way you do with Linux!!

For George: FreeBoo source code is really short. Just a bunch of scripts that you can find in the paper. But if someone (lazzy) needs them, you can download from http://icarus.upc.es/docs/FreeBoo_scripts.zip

DRBL (Diskless Remote Boot in Linux) is quite similar...

Anonymous's picture

Check http://drbl.sf.net
It includes Clonezilla SE (Server Edition).
The following is from drbl.sf.net and clonezilla.org:
Diskless Remote Boot in Linux (DRBL) provides a diskless or systemless environment for client machines. It works on Debian, Ubuntu, Mandriva, Red Hat, Fedora, CentOS and SuSE. DRBL uses distributed hardware resources and makes it possible for clients to fully access local hardware. It also includes Clonezilla, a partitioning and disk cloning utility similar to Symantec Ghost®.

Clonezilla, based on DRBL, Partition Image, ntfsclone, partclone, and udpcast, allows you to do bare metal backup and recovery. Two types of Clonezilla are available, Clonezilla live and Clonezilla SE (server edition). Clonezilla live is suitable for single machine backup and restore. While Clonezilla SE is for massive deployment, it can clone many (40 plus!) computers simultaneously. Clonezilla saves and restores only used blocks in the harddisk. This increases the clone efficiency. At the NCHC's Classroom C, Clonezilla SE was used to clone 41 computers simultaneously. It took only about 10 minutes to clone a 5.6 GBytes system image to all 41 computers via multicasting!

Join forces to build a Rembo/Mokafive replica

HenrikBach's picture

If there are some guys out there interested in joining forces for building a Rembo/Mokafive replica, count me in. We could setup a site on one of those floss sites...

Thoughts?

Hi I'm Sebastian Galiano

sebbasman's picture

Hi

I'm Sebastian Galiano (One of Freeboo's authors), If you need any help you can count on me. About the tar.gz you are requesting, maybe I can help on that too. Do you need any specific file?

FreeBoo project

HenrikBach's picture

Hi Sebastian!

That sounds great, that I can count on you. First, Now I'm able to download the tar.gz. I'll return back later, or you can write to me at bach.henrik at gmail dot com.

I cannot download the files related to this article

HenrikBach's picture

I cannot download the files related to this article: ftp.linuxjournal.com/pub/lj/listings/issue180/10203.tgz.

It seems that the folder containing the compressed archive doesn't exists.

Can you have a look at that?

ftp site

georgecorondan's picture

liked your system admin issue 180 but when i tried to get the code for:
FreeBoo: an Open Architecture for Network Dual Boot
there was nothing on your ftp site! do you guys need a sys admin :-) ?

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix