User-Mode Linux

The setup of UML on my Dell 610d Notebook took the following steps:

Host Kernel Configuration

The host kernel must have the tun network device enabled (CONFIG_TUN).

The following commands must be performed to enable masquerading and forwarding on the host, to enable network access on the UML machine.

$ iptables -t nat -A POSTROUTING -s 192.168.0.2 -o eth0 -j MASQUERADE
$ echo 1 > /proc/sys/net/ipv4/ip_forward

Prerequisites

Install the packages uml-utilities and rootstrap

Configuration

User Accounts

Put the user who will run the UML server into the group uml-net.

/etc/network/interfaces

auto tap0
iface tap0 inet static
        address 192.168.0.1
        netmask 255.255.255.0
        tunctl_user uml-net

/etc/default/uml-utilities

# Options to pass to uml_switch.
# For preconfigured tap setup, see
# /usr/share/doc/uml-utilities/examples/interfaces.example
UML_SWITCH_OPTIONS="-tap tap0"

# User as which to run uml_switch
UML_SWITCH_USER="uml-net"

/etc/rootstrap/rootstrap.conf

[...]
interface=eth0
transport=daemon
uml=192.168.0.2
netmask=255.255.255.0
control=/var/run/uml-utilities/uml_switch.ctl
data=/var/run/uml-utilities/uml_switch.data
[...]
gateway=192.168.0.1
[...]
domain=mydomain.com
nameserver=DNS-IP
[...]
[debian]
dist=sarge
[...]
install=ssh
[...]

Create the UML image

The image can be created by running

$ rootstrap -s 1024 sarge.img

where -s specifies the size of the image in Megabyte.

Somehow UML does not startup with any terminal on my machine and the root password seems not to be set. To fix this, start the machine by

$ linux eth0=daemon init=/bin/bash

and execute these commands:

$ mount -o remount,rw /
$ dpkg-reconfigure -a
$ sync

After another boot with

$ linux eth0=daemon

the new sarge image should run nicely.

Moreover, it is useful to disable the getty consoles in /etc/inittab, so only one login shell remains open.

To login this way at all, I manually had to copy the /dev/tty* devices into the image. The procedure for this is:

$ mount -t ext3 -o loop sarge.img /mnt
$ cp -a /dev/tty* /mnt/dev
$ umount /mnt

Compile the UML kernel

To compile the 2.6 UML kernel, the following steps are necessary:

$ make menuconfig ARCH=um
$ make ARCH=um
$ make modules ARCH=um
$ mount -t ext3 -o loop root_fs /mnt
$ make modules_install INSTALL_MOD_PATH=/mnt ARCH=um

NOTE: Don't forget to install the package module-init-tools before upgrading from 2.4 to 2.6, otherwise you won't have any module support available.

Start the UML kernel

Use the generated linux binary and start the UML like:

$ ./linux eth0=daemon,,,/var/run/uml-utilities/uml_switch.ctl mem=128M root=/dev/ubda
 
harry/uml.txt · Last modified: 2005/10/19 17:30 (external edit)
Locations of visitors to this page

 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki