Operating Systems

DM510, Spring 2013

Daniel Merkle

User-mode Linux at IMADA

In the following we describe how to install and use User-mode Linux (UML) for DM510 at IMADA.

Everything was tested on the IMADA pool machines that run Ubuntu 12.04 (Precise Pangolin) and we strongly recommend to use such a system. You can of course login to these machines via the ssh command.

Please note that the Weekly notes for week 08 give additional infomation on how to run UML on the IMADA terminal room machines.

How to install User-mode Linux at IMADA

Login at any IMADA machine and write

mkdir dm510
cd dm510

Next, get the source code for the Linux kernel 3.7.8 and unpack it

wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.7.8.tar.bz2 
bunzip2 linux-3.7.8.tar.bz2
tar -xvf linux-3.7.8.tar
rm linux-3.7.8.tar

Enter the directory containing the kernel source files:

cd linux-3.7.8

To make this a working copy of UML you also need a root filesystem, that you can copy to your directory. The filesystem is based on a Debian 6.0 system. Note, that the root filesystem has a size of approx. 300MB, and that the uncompressed compiled kernel use approx.

cp /home/daniel/dm510/root_fs  . 

You are now ready to start compling the kernel and using UML.

How to compile User-mode Linux

We need a configuration file fore compling the linux kernel. Create it with

make defconfig ARCH=um 

Now we're ready to compile the kernel. Do it with

 make ARCH=um linux

and have a cup of coffee or tea, because this will take a while (if you want to use several cores for compilation you can add the option "-j 4"). When the compilation is finished, you will find a file called linux in your directory. Everything is set to start UML.

How to run User-mode Linux

User mode linux is started with

./linux

When running UML, you can login using the user name root with no password. If you want to access data from your home directory inside UML, you have to mount the corresponding directory. This is done with

mkdir /mnt/tmp
mount none /mnt/tmp -t hostfs -o /home/your_imada_login/dm510

Of course your_imada_login has to be replaced by your IMADA login. The corresponding directory will be mounted as a subdirectory of /mnt/tmp inside UML. To stop the UML system you can run the command halt. After starting UML you two new windows will appear, your desktop should approx. look like the following:

The UML virtual console

UML Frequently asked questions (FAQ)

  • My kernel panics, if I start User Mode Linux. What is the reason?
  • There can be many reasons for that. But if you stopped UML by just closing the window where UML was running in, there will be still two processes named linux left, and UML will start with a kernel panic next time. You have to kill these processes, for example with killall -9 linux. After that, UML should start again. It is a good idea to stop UML always with the command halt.

  • Where can I get more information on UML?
  • The User-mode Linux Kernel Home Page can be found here.

  • How was the root file system created?
  • The root file system was created with a small script, you usually need to have root access to a machine to be able to create a root filesystem. If you are really interested take a look here.

  • I want to run UML at IMADA using Putty from my Windows machine without X at home.
  • To do this /etc/inittab in the root file system needs to be changed slightly. You need a running user mode linux - comment out the last two lines in /etc/inittab, and restart user mode linux.

    # Launch 2 xterms
    # 1:2345:respawn:/sbin/getty 38400 tty1
    # 2:23:respawn:/sbin/getty 38400 tty2
    

Design by 1234.info | Modified by Daniel Merkle | CSS 2.0