|Revision 0.5||22 Jan 2006|
This article will show you how to do a basic installation of usermode linux on a 184.108.40.206 kernel.
Table of Contents
Comments on this tutorial may be directed to Michael McCabe
Comments on this tutorial may be directed to Demetrios Dimatos
This document, Installing User Mode Linux is copyright (c) 2006 by the Clarkson Open Source Institute. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html.
No liability for the contents of this document can be accepted. Use the concepts, examples and information at your own risk. There may be errors and inaccuracies, that could be damaging to your system. Proceed with caution, and although this is highly unlikely, the author(s) do not take any responsibility.
All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements.
There are several tools and utilities that you will need to have installed in order to successfully build and run user-mode linux. Some of these tools are optional though, such as the ones that are required to have networking for your guests and some other ones are required for you to proceed. Here is a list of the tools that you must have installed.
GCC-This tutorial was completed with gcc4. The mileage that you may get with other versions of gcc may vary.
libstdc++ - in some distributions libstdc++ is GCC, but with Ubuntu it was needed to perform, sudo apt-get install libstdc++6-dev to obtain the needed stdc libs.
tar and bzip-Required for extracting the kernel source.
make-Used for the kernel build system.
ncurses-Ncurses and the development file is used to run the kernel configuration program menuconfig. To install on Ubuntu, sudo apt-get install libncurses5-dev
Here is a listing of some of the optional tools that you may need.
telnet-Can be used to connect to guests over there serial lines
uml-utilities-Is used to setup serial ports and setup networking on the various parts of the system.
debootstrap-Used to create debian or other debian based filesystem images.
yum-Can be used to create images of rpm based linux distributions.
Before we begin we will need to download the kernel source tree. There are several mirrors that have the kernel source code available for download. For this tutorial we are going with the 220.127.116.11 version of the Linux kernel.
Example 1. Downloading the Kernel
#wget http://mirror.clarkson.edu/pub/linux/kernel/v2.6/linux-18.104.22.168.tar.bz2 Alternatevely www.kernel.org
If you download a version of the kernel that is earlier than 2.6.9 you will also need to download a seperate patch for the uml architecture.
At this point we can now extract the kernel source code. In this example we will be extracting it in the current user's home directory.
We are now ready to configure our kernel for building it. There are many different kernel options that you will need to select in order to build a fully functional kernel. We will also turn on kernel debugging support and debug symbols. The following command will launch the kernel configuration program menuconfig
Here is a listing of options that you may need to disable or change in order to build a fully functioning kernel .
Loadable module support ->Enable loadable module support - Not Required Note:We can't debug these so having this option enabled would be a waste
UML Specific Options -> Host Processor type features -> Generic x86 support - Disable this -> Processor family (386) -> Choose your proccessor , I chose PIII that coresponded to my laptop.
Networking -> Amateur Radio - Not Required -> IRDA (infrared) Subsystem Support - Not Required -> Blue tooth Subsytem Support - Not Required
Character devices -> stderr console - Enable -> virtual serial line - Enable -> port channel support - Enable -> pty channel support - Enable -> tty channel support - Enable -> xterm channel support - Enable
Block Devices -> Virtual block devices - Enable
UML Network Devices - You may or may not want to turn on the different network options under these settings. Consult the uml websitefor more information on these devices.
File systems - To make my kernel build faster I only enabled the couple of filesystems that I knew that I would need (ext3 was one of them)
SCSI support -> SCSI support - Disable
Multi-device support (RAID and LVM) -> Multiple devices driver support (RAID and LVM) - Disable
Memory Technology Devices (MID) -> Memory Technology Device (MID) support - Disable
Kernel Hacking -> Show timing information on printks - Enable -> Kernel debugging - Enable -> Compile the Kernel with Debug Info - Enable
Debian is suprisingly simple to install inside of user mode linux. To begin you must initialize the files using dd. This example assumes that your image files are /opt/uml/debian-root.
Now we will initialize the filesystems inside of each of these files. We will be using ext3 as our root filesystem.
Now we will need to mount the root filesystem before we run debootstrap.
Now we will install debootstrap and bootstrap a base Debian installation. This is a barebones installation that is less than 200 megs.
Example 8. Debian Installation
#apt-get install debootstrap
#debootstrap --arch i386 sarge /mnt/debian http://ftp.us.debian.org/debian or you may want to use the breezy installation.
#debootstrap --arch i386 breezy /mnt/debian http://archive.ubuntulinux.org/ubuntu
At this point your system is an unconfigured base system. You will need to edit the following files in order to have your system in a valid configuration.
Example 10. Host configuration
You will need to make sure that /etc/hostname contains the following line or your nameing preference.
You will need to make sure that /etc/hosts contains the following line.
At this point you will need to setup your network interface configuration. This is done by editing the file /etc/network/interfaces. This guest will have a loopback network device. More information on configuring network devices under Debian can be found in the Debian Reference.
The above should be in the file /etc/network/interfaces. You'll also need to add a mirror or cdrom image to /etc/apt/sources.list
Example 12. /etc/securetty Configuration
#echo "tty0" >> /etc/securetty
#echo "ttys/0" >> /etc/securetty
Example 13. /mnt/debian/dev
In the breezy debootstrap example no node was created for me to mount the file system too, you can check this by,
#ls ubd* If this does not return ubd0 then,
#mknod --mode=660 ubd0 b 98 0
#chown root:disk ubd0
Example 14. Edit /etc/inittab
This will allow you to login immediately after the boot messages
Comment out the following lines: 2:23:respawn:/sbin/getty 38400 tty2 3:23:respawn:/sbin/getty 38400 tty3 4:23:respawn:/sbin/getty 38400 tty4 5:23:respawn:/sbin/getty 38400 tty5 6:23:respawn:/sbin/getty 38400 tty6 Now modify tty1 to say tty0, the result should look like this: 1:2345:respawn:/sbin/getty 38400 tty0 #2:23:respawn:/sbin/getty 38400 tty2 #3:23:respawn:/sbin/getty 38400 tty3 #4:23:respawn:/sbin/getty 38400 tty4 #5:23:respawn:/sbin/getty 38400 tty5 #6:23:respawn:/sbin/getty 38400 tty6
Example 15. Add user to the file system
Before you can log into the file system you must add a user to be ablet logi in with.
#adduser uml Aswer the following questions about the new user or press enter followed by a yes at the end