[ILUG] Handy Tip - UML

From: Mel (mel at domain csn.ul.ie)
Date: Tue 09 Jul 2002 - 14:38:32 IST


In an attempt to have a non-flame posting on this list today, this is a
quick overview of user-mode linux
(http://user-mode-linux.sourceforge.net/). It's objective is to have Linux
running in userland where it can be safely debugged or services run. It
comes as a patch to the latest stable kernel, 2.4.18 at the moment. Unpack
your source and apply the patch. Copy a working .config from a previous
kernel install and run

make oldconfig ARCH=um

and it'll ask you the specific UML questions. If you want to change things
later, use make menuconfig ARCH=um . Compiling it then is a simple case of

make linux ARCH=um

and it'll create a binary called linux. Now, next you need a root
filesystem. I found the debian one the handiest available from the
downloads page at http://user-mode-linux.sourceforge.net/dl-sf.html . It's
called root_fs_debian2.2_small.bz2 . Unpack that as root_fs and run
./linux and it'll boot up. If you want to make changes before booting,
it's a simple case of

mount root_fs ./mnt -o loop

Why would you want this? First, you can run isolated services in there in
honeypots and there is a number of root filesystems provided that do
things like DNS out of the box, mail out of the box or whatever. This is
great for isolating services within the one machine. If security and
honeypots are your thing, UML can log all keystrokes sent to a tty so
sessions could be played back

Second, it's really safe kernel hacking. If you blow the whole lot apart,
you just copy in a new filesystem and keep going. This makes it great for
testing, especially if you're messing with core internals and want to test
it out a bit before putting it on a real box. It's great kernel debugging
stuff because you can do a lot more debugging wise than is generally
possible with a "real" kernel. You can run almost all of the examples in
the Linux Device Drivers book in UML. This would be great for students
interested in kernel hacking but don't have root or don't havea a spare
computer

For simulation purposes, you can pretend you have an SMP machine when you
really don't and see how Linux behaves with it. Obviously it will be
slower but Linux in UML will behave as it would with a real SMP machine.
The amount of memory can also be varied.

Lastly, it's a lot cheaper to try things out on UML first before setting
up a dedicated test box which not everyone can afford to do

Anyway, my 2c. Check the homepages for more info. There is debian packages
available to get it running.

-- 
Mel Gorman
MSc Student, University of Limerick
http://www.csn.ul.ie/~mel


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:45 GMT