The MLN Project

Complex virtual machine management made easy










SourceForge.net Logo

Compiling a UML kernel for MLN

What UML kernel you choose to use seems not a trivial question. Erlier versions have bugs and ohters will only run on certain host kernels. There is no updated Debian package either. A standard UML 2.6.* (lower thatn 2.6.12) kernel will sadly not work because of a limit in the number of command line characters allowed. This setup shows you how to circumvent this limit until the patch is accepted in the mainstream kernel.
UPDATE: As of the 2.6.12 kernel, no extra patch is needed to get UML to work optimally with MLN. You may now download a precompiled kernel here:
http://mln.sourceforge.net/files/uml-2.6.12-rc2-mm3.tar.gz

In order to help the MLN users, I have written a walk-through on how to compile a user-mode-linux kernel that will work with MLN. This setup will use linux-2.6.9-bs6 as our kernel. You may follow the steps from this page or you may simply download the finished result here:

http://mln.sourceforge.net/files/uml-2.6.9-bs6.tar.gz
You still need to install the packages uml-utilities, sudo, screen.

For the following sections we assume that you have the software to compile a regular kernel installed on your machine.

1. uml_utilities

There is a Debian package called uml-utilities which is needed in order to run UML properly. Install it like this:

apt-get install uml-utilities


Note: Other packages, like screen, sudo and bridge-utils are not essential, but are needed in order to use MLN properly.

2. Getting the kernel and patches

Dowload the mainstream 2.6.9 kernel:

wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.9.tar.bz2


Next, you need some patches. The first is from
blaisorblade. He is one of the active developers of the community and has a patchset which fixes some issues with the kernels. We are currently interested in his -bs6 patch:

wget http://www.user-mode-linux.org/~blaisorblade/patches/guest/uml-2.6.9-bs6/uml-2.6.9-bs6.patch.bz2


The following patch is needed to extend the number of characters read from the command line when uml boots. It is basically almost the single reason why we need yet another "UML howto". This pacth will hopefully make it into mainstream soon. It is a just tiny patch:

wget http://kernel.umbrella.ro/kpatches/uml-extend-cmd-line-limits.patch


There now we have what we need in order to compile.

Applying the patches and configuring the kernel

Not much to say about this, really, other than "do this:"

tar xjf linux-2.6.9.tar.bz2

cd linux-2.6.9

bzcat ../uml-2.6.9-bs6.patch.bz2 | patch -p1

cat ../uml-extend-cmd-line-limits.patch | patch -p1


If you are familiar with kernel configuration, then you can go ahead and configure it yourself. The important thing is to remember ARCH=um at the end of each make-command. We recommend you start of with our config. You may modify it as much as you want. In case you have pointers on how our config should look like, we would be happy to hear them.

Fetch the configuration file from our site:

wget http://mln.sourceforge.net/files/config-2.6.9-bs6-V2


Change the name of the configuration file and update the kernel source:

cp config-2.6.9-bs6-V2 .config

make oldconfig ARCH=um


3. Compile the kernel and modules

The compilation is straight forward and may take some minutes to complete:

make linux ARCH=um

make modules ARCH=um


Wrap it up and test the kernel

Now. The kernel and modules are ready. What you need to do is to put it somwhere in an organized way. Other guides might tell you to simply copying it into /usr/local. We think that is a bad idea because the kernel might need to be updated with a newer version but running projects may be dependant on /usr/local/linux to be a specific version. So we propose putting it into a folder and have one folder for each new version. MLN does not need to have "linux" somwhere in your path.

I assume you are still in the soruce tree. Lets create the folder and copy kernel and modules:

# create the directory and strip the binary:

mkdir ../uml-2.6.9-bs6

strip linux



# copy the kernel, modules and config for later reference:

cp linux ../uml-2.6.9-bs6

make modules_install INSTALL_MOD_PATH=../uml-2.6.9-bs6 ARCH=um

cp .config ../uml-2.6.9-bs6/config-2.6.9-bs6



# go to the new directory and clean up:

cd ../uml-2.6.9-bs6

mv lib/modules/2.6.9-bs6 .

rm -r lib


If someone knows how to make the last lines a bit smoother, let us know. The new folder should now contain the following:
  1. A binary called "linux"
  2. A folder with the same name as the kernel version (2.6.9-bs6 in our case)
  3. A config file which you may use in case you want to compile newer kernels afterwards.

Test the kernel before you move on to using MLN. The abstraction that MLN offers may make it harder to track down problems with the uml kernel so knowing that it works right away is a Good Thing. The way you test it, is simply to boot one of the templates manually and to check that you get a boot prompt and are able to shut down. If that works, using MLN should be a breeze.

Download the latest basic template (Debian-3.0r0-V0.8.ext2.tar.gz) from the sourceforge download site.

Once you got it, uncompress it like this:

tar xzf Debian-3.0r0-V0.8.ext2.tar.gz


Next you just start the new uml kernel and append the filesystem to it with some memory also. That should be sufficient:

./uml-2.6.9-bs6/linux ubd0=Debian-3.0r0-V0.8.ext2 mem=32M


If you (after a load of boot messages) get the following result:

Debian GNU/Linux 3.0 (none) tty0



(none) login:

... then things are looking really good. Log in as root and type halt. The virtual machine should shut down and return you the prompt of the shell. If that is what happens, then you can safely conclude that the kernel is ready for MLN.

The next step is to set up MLN properly. We have a guide for that too here. What all is well, you should have a look at the performance tips we have gathered here.