For a while now, I’ve been trying to get the Cloonix open-source network simulator working on a computer running the Knoppix Linux distribution. I wanted to run everything on a USB Flash stick that could be attached to any computer and to create a portable version of Cloonix. Since I cannot yet run Cloonix in a virtual machine, running it from a USB Flash stick is the next best solution, for my situation.
So far, my efforts to run Cloonix on a Knoppix Live USB stick have not been successful. The Cloonix development team has been very helpful and they made some changes to the Cloonix code to enable it to compile in Knoppix. With their help, I will probably be able to get Cloonix running on Knoppix, soon.
As part of my investigation, I wanted to see if some of the issues were caused by trying to run Cloonix in a Live USB version of Linux. A live USB Linux installation has some differences to the way memory and filesystems work, compared to Linux installed on a partition on a hard drive. Since I had successfully used Cloonix in a normal installation of Ubuntu Linux 12.04, I set up a LiveUSB version of Ubuntu on a USB Flash drive and installed Cloonix on it.
I ran into one small issue that I was able to resolve. After that, everything worked well. For my own reference, I recorded the process, below:
NOTE (updated February 26, 2013): The Cloonix development team updates Cloonix every few months and, eventually, they remove links to old releases from their web site. Use the latest version of Cloonix found on the Cloonix web site.
Install Ubuntu on a USB stick
I installed Ubuntu 12.04 as a live install with a 4GB persistent filesystem on a USB flash drive.
I booted from the Ubuntu DVD and ran the Desktop version of Ubuntu from the DVD (I clicked on the “Try Ubuntu” button in the startup display). Then, I inserted a 16GB USB stick into a free USB port on my computer and ran the Startup Disk Creator program. I configured the maximum amount of persistent storage (4GB) and then started the install process. This created a FAT32-formatted USB drive with the LiveDVD version of Ubuntu installed on it. The technology used to create the persistent storage is the same as that used by Knoppix and the USB stick was formatted with the same partition type, FAT32, so I think this is a fair test of the general case of running Cloonix on a Live USB installation. The main difference is that, in this case, I am running Ubuntu and not Knoppix.
Next, I booted from the USB stick to run Ubuntu Linux from the Live USB.
Download files
Download the necessary files as described in my previous post. In this case, we will download the Cloonix source files, instead of the pre-compiled package.
Set up the downloaded Cloonix files
I created a new directory, Netsims, and then extracted the Cloonix directory tree from the downloaded archive into that directory.
$ cd ~ $ mkdir Netsims
Then, I extracted the cloonix-19.1 directory to ~/Netsims/ using Archive Manager program
I copied the filesystems we will need to run the demo to the Cloonix bulk directory. I extracted the filesystems bzImage and kvm_wheezy_lab_qcow2 from the downloaded archives to the ~/Netsims/cloonix-19.1/bulk/ directory using Archive Manager program.
Fix problem with kernel update
I ran into the problem when trying to install the build-essential package. This issue is related to updating the kernel when running Ubuntu from a Live USB stick. I found a solution on the Ubuntu forums at the following URL: http://askubuntu.com/questions/87437/kernel-update-on-a-usb-stick-installation-fails-with-grub-probe-error. To avoid this problem, first do the following steps:
Edit the file: /etc/kernel/postinst.d/zz-update-grub (I used gedit)
$ sudo gedit /etc/kernel/postinst.d/zz-update-grub
In the file, comment out line 15
-
Before:
exec update-grub
After:
# exec update-grub
Then, run the command:
$ sudo dpkg --configure -a
Install prerequisite packages
We need to install some libraries and other packages that will be needed to compile Cloonix. First, update the information about the software repositories:
$ sudo apt-get update
Then, open the file, ~/Netsims/cloonix-19.1/README in a text viewer and follow the instructions in the file to compile cloonix.
$ cd ~Netsims/cloonix-19.1 $ more README
In my case, I did the following:
$ sudo modprobe kvm-intel nested=1 $ sudo chmod 666 /dev/kvm $ sudo apt-get update $ sudo apt-get --allow-unauthenticated -y install build-essential $ sudo apt-get --allow-unauthenticated -y install m4 pkg-config $ sudo apt-get --allow-unauthenticated -y install libncurses5-dev $ sudo apt-get --allow-unauthenticated -y install libssl-dev $ sudo apt-get --allow-unauthenticated -y install libgtk2.0-dev $ sudo apt-get --allow-unauthenticated -y install libcap-dev $ sudo apt-get --allow-unauthenticated -y install libevent-dev $ sudo apt-get --allow-unauthenticated -y install libreadline-dev $ sudo apt-get install libspice-server-dev $ sudo apt-get install libspice-protocol-dev $ sudo apt-get install spice-client $ sudo apt-get install spice-client-gtk
Compile Cloonix
NOTE: Do not use “sudo” to run the ./doitall command. You must run doitall as a user, not as root. Otherwise you will encounter file permission problems when trying to use Cloonix. Compile cloonix with the command:
$ cd ~/Netsims/cloonix-19.1 $ ./doitall
(takes about 5 minutes to compile)
Test Cloonix
Next, test cloonix by running the web demo script. I provided a detailed description of the demo in my previous post.
First, edit the start_demo.sh script.
$ cd ~/Netsims/cloonix-19.1/sample_demo_scripts/demo_cloonix_web $ gedit start_demo.sh
Edit the line that starts with “BASE=” to show the path of the cloonix tree
BASE=~/Netsims/cloonix-19.brian
Run the lab:
$ ./start_demo.sh
Conclusion
I am now satisfied that there are no issues with the general case of installing Cloonix on a Live USB stick configured with a persistent filesystem. Now I can go back to testing the Knoppix installation. I am looking forward to getting Cloonix working on Knoppix.