HOWTO Use User Mode Linux as a Normal User

about | archive

[ 2007-October-19 21:17 ]

User Mode Linux (UML) is a great hack. It runs the Linux kernel as a normal process. This is a form of virtualization, with the benefit that it can be used by regular users on any Linux machine. Recently, I needed to experiment with some software that required root access, without the root password. Here is a brief step-by-step guide to help me remember how to get it working:

  1. Download the latest kernel. Configure and build it with:
    make menuconfig ARCH=um
    make -j3 linux ARCH=um
  2. Grab a root file system. I used an ancient Debian image from the UML site. I then used debootstrap to create a clean modern "base" image.
  3. Configure networking by using Slirp. Slirp is a cool hack that allows UML limited access to the network by tunneling it over regular UDP and TCP connections. This is really the key to making UML useful as a regular user. The other (better) methods for accessing the network need root access. Be sure to apply the latest patch, as otherwise it does not work. It also helps to edit config.h and uncomment the line that says #define FULL_BOLT. This will make Slirp go as fast as it can.
  4. Start your virtual machine. I use something like the following command:
    ./linux ubd0=disk.img mem=256M eth0=slirp,,slirp hostfs=${HOME}

For more detailed directions, see Installing UML with Fuse or How to Make a UML Image on Debian.