User-mode Linux

From LQWiki
Jump to: navigation, search

User-Mode Linux allows you to run Linux on top of Linux. You get a file called "linux" that you can execute just like a normal (user-mode) program. It will act as the kernel for your Linux guest system (the system running on top of your Linux). In other words, it provides pseudo-virtualization.

User-mode Linux can be very useful when learning Linux as it allows a student to destroy his Linux install and replace it quickly with a fresh one (take a backup before playing with the install of course).

How to start

This tutorial uses the SuSE Linux distribution as an example, however other distributions may work same or similar.

yast2 -i uml-utilities
wget ftp.gwdg.de/pub/opensuse/distribution/SL-10.1/inst-source/suse/i586/kernel-um-2.6.16.13-4.i586.rpm
rpm -ivh kernel-um-2.6.16.13-4.i586.rpm
  • Install Linux into a directory
yast2 dirinstall

In this example, we install Linux to /usermodelinux.

  • Start User mode linux
cd /boot
./vmlinux-um
  • Verify that you get an error like
VFS: Cannot open root device "98:0" or unknown-block(98,0)
Please append a correct "root=" boot option

This is because User-mode Linux tries to start from /dev/ubd0 as initial ramdisk and cannot find this.

  • Download an initrd from the project's home:
wget http://switch.dl.sourceforge.net/sourceforge/user-mode-linux/Debian-3.0r0.ext2.bz2
bunzip2 Debian-3.0r0.ext2.bz2
  • Start your User-mode linux
./vmlinux-um ubd0=Debian-3.0r0.ext2
  • Your User-mode Linux now starts

See also