RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Ubuntu Eye for the Debian Guy: Running Linux on Linux : Page 4

Take a journey around the world of Ubuntu 7.10 without exiting from Debian. Along the way, you'll learn how to run multiple Linux-in-Linux instances for development and study.

Compiling and Booting the Linux Executable
Just by installing the Debian package user-mode-linux, I already had a compiled UML kernel ready to boot in user space. (I suggest compiling the kernel by yourself to better understand some concepts of UML.) However, I had to install the uml-utilities packages for UML administration and configuration. Under the home directory of a normal user, I got and extracted the last available kernel as follows:

wget –c http://kernel.org/pub/linux/kernel/v2.6/linux-
tar –xvjf linux-

If you are familiar with Linux kernel compiling, you will recognize all the commands in the remainder of the article, with the exception of the variable setting ARCH=um. This is an important setting that tells the compiler how to build the kernel for the special user-mode architecture. In other words, instead of compiling the kernel for the x86 or ARM CPU architecture, I obtained a kernel running for the user-mode virtual architecture (Jeff Dike, the UML creator, defines it as a port of Linux to Linux) with this command:

make ARCH=um defconfig

I then had a standard configuration of UML that I changed only a little with this command :

make ARCH=um menuconfig

At that point, I completed the following steps to create my Linux executable file:

  1. Have no modules (otherwise I would have to install the compiled modules in the right place under UML root filesystem):
    [ ] Enable loadable module support  --->
  2. Set the right processor in:
    Host processor type and features  --->
  3. Don't include all other network support except TUN/TAP:
    UML Network Devices  --->
    [*] Virtual network device
    [ ]   Ethertap transport 
    [*]   TUN/TAP transport
    [ ]   SLIP transport
    [ ]   Daemon transport
    [ ]   VDE transport
    [ ]   Multicast transport
    [ ]   pcap transport
    [ ]   SLiRP transport
  4. Disable the support for PPP:
    [*] Network device support  --->
    [ ]   PPP (point-to-point protocol) support
  5. Check whatever option under section:
    Kernel hacking  --->

    Author's Note: For the sake of completeness, I'll mention the SKAS (Separate Kernel Address Space) kernel patch, which solves some security and performance issues of UML. The standard way is called TT (Tracing Thread) mode.

  6. Then finally:
    make ARCH=um linux

At the end of the compilation, I had a file called linux that was the executable file to run.

As I already explained, in the command line I can configure the hardware platform upon which I want to run UML. For the first UML, I set these switch variables:

  • ubd0=/path/to/file/uml1-root—This sets the block device from which the system mounts the root filesystem.
  • con=pty con0=null,fd:2 con1=fd:0,fd:1—These settings deal with the configuration of console terminals.
  • eth0=tuntap,the_uml_conn1—This is the association of the UML eth0 network interface with the host TAP network interface. A random and fictitious MAC address will be assigned to eth0.
  • mem=512M—With this variable you can set the physical RAM memory that the UML will have, regardless to the actual existing one in the host machine.
  • umid=uml1-umid—This is a unique identification label for the first UML machine used by some host UML utilities and also by the debugger.

There are a lot of other variables to set; you can read about them on the man pages.

Now I was ready to boot, launching the command:

linux- \
     ubd0=/path/to/file/uml1-root \
     con=pty con0=null,fd:2 \
     con1=fd:0,fd:1 \
     eth0=tuntap,the_uml_conn1 \
     mem=512M \

See Listing 1 for the complete boot log of first UML.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date