The setup of UML on my Dell 610d Notebook took the following steps:
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
Install the packages uml-utilities and rootstrap
Put the user who will run the UML server into the group uml-net.
auto tap0
iface tap0 inet static
address 192.168.0.1
netmask 255.255.255.0
tunctl_user uml-net
# 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"
[...] 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 [...]
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
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.
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