mkdir dm510 cd dm510
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 18.04.1 (Bionic Beaver) and we strongly recommend to use such a system. You can of course login to these machines via the ssh command.
You can alternatively create a virtuel machine where you can work on your local machine - a guide can be found here:
Login at any IMADA machine (not the jumphost, but a real machine in the terminalroom) and write
mkdir dm510 cd dm510
Next, get the source code for the Linux kernel 4.19.15 and unpack it
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.19.15.tar.gz gunzip linux-4.19.15.tar.gz tar -xvf linux-4.19.15.tar rm linux-4.19.15.tar
Enter the directory containing the kernel source files:
cd linux-4.19.15
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 9 (Stretch) Note, that the root filesystem has a size of approx. 500MB, and that the uncompressed compiled kernel use approx.
wget https://imada.sdu.dk/~jamik/DM510-Filesystem-UML/root_fs
You are now ready to start compiling the kernel and using UML.
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 (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.
User mode linux is started with
./linux
or
./linux con1=xterm con2=xterm
(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. After starting UML you two new windows will appear, your desktop should approx. look like the following:
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
.
The User-mode Linux Kernel Home Page can be found at http://user-mode-linux.sourceforge.net/
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 make_root_fs.sh
UML supports two virtual consoles that you can login (in addition to the main console).
First you need to find out the device names at your host machine for these two UML virtual consoles.
To do that you can login to UML as root and run dmesg. Find the strings like Virtual console N assigned device '/dev/pts/X'.
Then, in your host machine, run screen /dev/pts/X
to be connected to the virtual console. You can also do that with a new xterm as: xterm -e screen /dev/pts/X
Alternatively you can add a command line option when you boot the linux kernel: ./linux con1=xterm con2=xterm
will open two windows where you can find a console in.
In case you messed up the attached file system, this might just happen.
It is always good to have a copy of that, i.e., the file root_fs.
Furthermore, sometimes it helps to kill all hanging kernels with killall -9 linux
and/or to remove the directory where
UML stores temporary data with rm -Rf ~/.uml/
.
Very often it also a memory issue, and your virtual linux does not have enough main memory.
You can for example assign 128M main memory to your virtual system by starting the kernel with ./linux mem=128M
Your home directory on the IMADA terminal room machines is "mounted", i.e., the hard disk where the data is stored is not the machine that you are working with. However, if you work in a subdirectory of the directory /tmp, then the data IS stored on the local hard disk. This makes things much faster (compilation of the kernel, unpacking the kernel, running UML, …). However, please note, that a reboot of the machine will remove any data in /tmp. Therefore, do not forget to copy anything you did, and remove it, as /tmp is shared with all users.