https://wiki.archlinux.org/api.php?action=feedcontributions&user=Agumonkey&feedformat=atomArchWiki - User contributions [en]2024-03-29T06:12:43ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=User-mode_Linux&diff=171027User-mode Linux2011-11-24T15:51:28Z<p>Agumonkey: updated the link for the 'uml howto' that was flagged as rotten, but have been republished.</p>
<hr />
<div>{{i18n|User-mode Linux}}<br />
{{out of date}}<br />
[[Category:Virtualization]]<br />
==== What is user-mode-linux?====<br />
User-mode-linux (UML) is a method to run linux inside linux as a normal process. Please check [http://user-mode-linux.sourceforge.net/] for in detail information what uml is and how it works.<br><br />
This wiki article is a summary of [http://bbs.archlinux.org/viewtopic.php?t=12553 this posting]. If you have any ideas or suggestions please post them there.<br><br />
<br />
==== Why use UML?====<br />
Running UML is a safe way to run multiple instances of (arch-)linux at the same time. The single processes are seperated from each other, which makes it secure to run for example a testing instance and a productive one on the same machine. If something goes wrong inside the testing instance, it does not interfere with the host linux or the productive instance.<br />
<br />
==== HOWTO====<br />
==== Prerequisites:====<br />
<br />
* User-mode-linux kernel ([http://aur.archlinux.org/packages.php?ID=26916 user-mode-linux])<br />
* uml_utilities, especially the tunctl programm (installed automatically with the uml kernel)<br />
<br />
==== Let's start====<br />
1.) First you have to create a single, big file into which you will install arch. This command creates a single 1GB file, only containing zeros - should be enough for a basic arch installation.<br />
<pre><br />
dd if=/dev/zero of=rootfs bs=1MB count=1000<br />
</pre><br />
<br><br />
2.) After the build process you have to format the root filesystem image:<br />
<pre><br />
mke2fs -F rootfs<br />
</pre><br />
<br><br />
3.) After formatting the file you have to mount it. Executing the following command as root does the job (you have also to load the loop module with modprobe):<br />
<pre><br />
mount -o loop rootfs /mnt<br />
</pre><br />
<br><br />
4.) Now the installation of the basic system may start:<br />
<pre><br />
mkdir -p /mnt/var/lib/pacman<br />
pacman -S base -r /mnt<br />
</pre><br />
<br><br />
5.) Before the system can be booted with user-mode-linux, some files inside the arch basic system have to be customised. Add this line to ''/mnt/etc/fstab'':<br />
<pre><br />
/dev/ubd0 / ext2 defaults 0 0<br />
</pre><br />
To avoid long boot time you are advised to disabled hotplugin in ''/mnt/etc/rc.conf'':<br />
<pre><br />
DAEMONS=(syslog-ng !hotplug !pcmcia network netfs crond)<br />
</pre><br />
<br><br />
6.) Now unmount the filesystem. <b>NOTE:</b> If you change ''anything'' inside your mounted filesystem (e.g. /mnt) while it is ''running'' it may lead to significant fs corruption inside your virtual machine and ''kill'' it!<br />
<pre><br />
umount /mnt<br />
</pre><br />
<br><br />
7.) Next step is to setup networking. Therefore you create a so called tun device (Please visit the [http://user-mode-linux.sourceforge.net/old/UserModeLinux-HOWTO.html uml howto] for further information about tun/tap), and give it an IP address. The following lines load the necessary tun module, create a tun/tap device that is readable by the users group and set it up with the given ip address. For security you should consider to create a certain uml group with read permissions for the network device.<br />
<pre><br />
modprobe tun<br />
tunctl -u users<br />
chown root.users /dev/net/tun<br />
ip addr add 192.168.0.100/24 dev tun0<br />
</pre><br />
<br><br />
8.) Now you can boot the image. To use the network you have to announce the proper device to the uml kernel. (Mind that the user running the uml command needs enough rights to access the tun device!)<br />
<pre><br />
linux ubd0=rootfs eth0=tuntap,,,192.168.0.100<br />
</pre><br />
The ",,," mean:<br />
<pre><br />
eth0=transport,tuntap device,MAC address,ip<br />
</pre><br />
Example:<br />
<pre><br />
eth0=tuntap,tap0,3f:2a:bb:00:00:00,192.168.3.23<br />
</pre><br />
<br />
Have fun playing with uml.</div>Agumonkey