User Mode Linux

In the following we describe how to install and use User-mode Linux (UML) for DM510 at IMADA based on the Linux kernel 6.6.9, released on Jan 1, 2024.

Everything was tested on the virtual IMADA Computer Lab machines that run Ubuntu 20.04 LTS.

The version of the IMADA lab (as of January 13th. 2025)

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

You can login to the Computer Lab machines via the ssh command, see here how to access the Computer Lab machines, please choose randomly one of the four machines (the only directory shared among the machines is the directory /shared/ (which is slower). Note, that your home directory is not shared among the four different machines. You are of course welcome to use any other solution (e.g., running UML on your own Linux system, running it in a virtual environment like VirtualBox or VMWare, using SDU’s ucloud, etc) but we might, in that case, just not be able to help you if you run into technical issues. There are instructions for installing a Virtual Machine in VirtualBox that can be used for the assignment.

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 6.6.9 and unpack it (specifically the tar command will take a while!)

wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.9.tar.xz
unxz linux-6.6.9.tar.xz
tar -xvf linux-6.6.9.tar
rm linux-6.6.9.tar

Enter the directory containing the kernel source files:

cd linux-6.6.9

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 Debian 12. Note, that the root filesystem has a size of approx. 200MB, and that the uncompressed compiled kernel uses approx. 2.1GB.

wget https://github.com/larsrohwedder/larsrohwedder.github.io/raw/refs/heads/master/teaching/dm510-25/root_fs.bz2
bunzip2 -d root_fs.bz2

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

How to compile User-mode Linux

We need a configuration file for compiling 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. 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

Note that the boot process ends with messages similar to

Virtual console 1 assigned device '/dev/pts/2'
Virtual console 2 assigned device '/dev/pts/3'

This allows you to get additional interactive shells using the command

screen /dev/pts/2

(see FAQ below).

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.

UML Frequently asked questions (FAQ)