|
Alyz Solutions
|
|
User-Mode Linux
|
|
Table of Contents
User-Mode Linux is a version of the Linux kernel that can be run as a user executable process. This means that entire virtual machines can be run as normal programs by normal non-root users. Like any other normal program, a user can start many simultaneous instances of it in the background, effectively creating a network of virtual machines, all on a single physical box.
This page contains a collection of notes and experiences from installing and using User-Mode Linux. This information is most relevant when using User-Mode Linux on a Debian unstable Linux host, but may be general enough to be useful for other Linux hosts as well. We intend to update this web site often to try to keep up to date with meaningful developments in the User-Mode Linux community.
A typical User-Mode Linux system consists of several main components:
Although User-Mode Linux can be run as a user process under any host Linux kernel, there are several patches that can be made to the host kernel to improve the efficiency and throughput of the UML guest systems. Two important patches provide for the SKAS and SYSEMU enhancements. In fact, these two are so important that they have been combined into a single patch by Blaisorblade. The latest patch is the skas-*-v9-pre9 patch.
How the host kernel is patched, compiled and installed depends on the Linux distro. For Debian, we use the kernel-package system. A Precompiled 2.6.17 kernel with the skas3-2.6.17-rc5-v9-pre9 patch already applied can be found in our Debian repository. Also available are older precompiled 2.6.7 through 2.6.12 kernels with the host-skas3-v8 patch already applied.
Common problems:
The guest kernel is the executable program that can be run by a normal user to start up a virtual Linux machine. To build a guest kernel, one typically needs the Linux kernel sources, the main UML patch, and incremental patches, along with these instructions. However, starting with version 2.6.9, the main UML code is already part of the Linux kernel source code, so in theory, no patches are necessary. However, UML is in continuous development at this point, so practically, one still needs the latest incremental patches in order to build a solid kernel that has all the updated features and bug fixes.
For Debian, we have precompiled the latest 2.6.17 guest kernel with NTPL support and the CONFIG_2G2G option turned on to work around the configuration of the default Debian kernels. We also have an archive of older kernels, including a 2.6.9 guest kernel using the uml-2.6.9-bs7 and uml-pretend-to-be-i586 patches, as well as the 2.6.12, 2.6.13, and 2.6.14 guest kernels with only the uml-pretend-to-be-i586 patch. These can be found in our Debian repository. These kernels are also available unpackaged (2.6.9-bs7, 2.6.12, 2.6.13, 2.6.14, 2.6.17).
Common problems:
There are many documents around the net on creating guest file systems for User-Mode Linux:
There are also many prebuilt guest file systems available for download. Some example sites are the official UML download site, Matt Zimmerman's Debian stable filesystems, and Henrique Moreira's Debian, Slackware, and RH9 filesystems. However, due to the problems described below, many available file systems fail to boot under the latest uml kernels. Some individual file systems that we've downloaded (or created) that we were able to boot up sucessfully with our 2.6.9 guest kernel along with the command lines we used include:
- Debian 3.0r2 (42.4Mb, Matt Zimmerman)
- linux-2.6.9 mem=64M ubd0=Debian-3.0r2.ext2 con=null con0=null,fd:2 con1=fd:0,fd:1 devfs=nomount
- Debian Sid (26.3Mb)
- linux-2.6.9 mem=64M ubd0=debian-sid.ext3 con=null con0=null,fd:2 con1=fd:0,fd:1 devfs=nomount eth0=daemon,,unix,/var/run/uml-utilities/uml_switch.ctl
Common problems:
Any reasonable networking setup in User-Mode Linux requires the latest version of uml-utilities to be installed. In Debian, this is part of the standard packages, so a simple "apt-get install uml-utilities" will suffice. Alternatively, one can download the source code from the official UML download site and then compile and install it manually.
UML networking is documented well on the main UML site. Besides the general information, the most important sections are the TUN/TAP with the uml_net helper, TUN/TAP with a preconfigured tap device, and the switch daemon sections. A reasonably current UML networking setup should be using one of these three methods.
On Debian, the switch daemon is the simplest setup. Follow the instructions from the readme file at /usr/share/doc/uml-utilities/README.Debian after installing the uml-utilities package. However, note that the debian package initializes the socket at /var/run/uml-utilities/uml_switch.ctl instead of the UML default of /tmp/uml.ctl. This means that command line argument for the guest kernel in order to use the switch daemon must be "eth0=daemon,,unix,/var/run/uml-utilities/uml_switch.ctl", not simply "eth0=daemon" as described in the readme.
Additionally, in order for the UML guests to connect to the Internet, it is necessary to either set up routing on the UML host or add a network bridge to connect the UML guests directly to the outside network. This is described briefly under the TUN/TAP with a preconfigured tap device section in the documentation. Keep in mind that the setup described there is equally applicable to the other two configurations as well. Another write-up on setting up a network bridge can be found in this article.
There are many primary sources of information on User-Mode Linux development.
The best way to stay updated on User-Mode Linux is to subscribe to one or both of the mailing lists: user-mode-linux-user and user-mode-linux-devel.
Several sites of primary developers contain the most recent patches and information for User-Mode Linux.