fernand0Hello.
fernand0Our next speaker is Ismael Briones.
fernand0He works as a system administrator in
fernand0one of the most important journals in Spain.
fernand0He also is a fellow member of UniNET and part of the success in the
fernand0organizations of this conference is due to him, among others.
fernand0His talk is about 'User Mode Linux'.
fernand0Ismael ...
ismakHello...
ismakGood night ;-)
ismakok This is an introduction to User Mode Linux
ismakBasically is a mix of the documentation of the project,
ismakthat you can find in the project's web (http:/user-mode-linux.sourceforge.net).
ismakI am going to explain what is UML, some descriptions of how people are using
ismakUser-Mode Linux, its capabilities and how you can install and run UML.
ismakFirst, What is UML?
ismak1.1 - Run Linux inside itself
ismakWe can read a brief description of what is UML in the web of the project (http://user-mode-linux.sourceforge.net):
ismak"User-Mode Linux is a safe, secure way of running Linux versions inside itself. It gives you a virtual machine that may have more hardware and software virtual resources than your actual, physical computer.
ismakDisk storage for the virtual machine is entirely contained in a single file on your physical machine. You can provide to the virtual machine only the hardware access you want it to have an with properly limited access, nothing you can do on the virtual machine can damage your real computer, or its software."
ismakThat sound fun. We can have a running linux inside our linux, and we can do what we
ismakwant on it, because it's like another system. UML allows you to run a Linux kernel as a
ismakuser process under a normal Linux kernel.
ismakBasically, uml is the port of the Linux kernel to Linux system call interface rather than to a hardware interface. What does it mean?
ismak It treat Linux as a platform to which the kernel can be ported, like platforms such as Intel, Alpha, Mips, etc...
ismakAll of the devices accesibles inside the virtual machine are virtual and  UML support the full range of devices suported by a Linux box, like:
ismak- Console and serial lines.
ismak- Block devices.
ismak- Network devices.
ismakNormaly, the Linux Kernel talks straight to the hardware (network card, video card, sound card....) and any program that run in the system ask the kernel to operate the hardware.
ismak+-----------+-----------+----+
ismak   | Process 1 | Process 2 | ...|
ismak  +-----------+-----------+----+
ismak   |        Linux Kernel         |
ismak  +------------------------------+
ismak   |        Hardware            |
ismak  +------------------------------+
ismak
ismak
ismakThe UML kernel doesn't talk to the hardware, it talks to a 'real' Linux Kernel (the kernel of the system where we are running our UML) like any other program. That means that programns can run inside UML as if they were running in a normal kernel, like so:
ismak +-----------------+
ismak          | Process 2 | ...|
ismak  +-----------+--------------------+
ismak   |Process 1 | User-Mode Linux |
ismak  +---------------------------------+
ismak   |      Linux Kernel              |
ismak  +---------------------------------+
ismak   |        Hardware               |
ismak  +---------------------------------+
ismak
ismak
ismak
ismakSome of the benefits of UML are:
ismak- If the user mode linux crash, the system running uml is still fine and this system can't be damage by an uml crash.
ismak- The user mode linux can run as non-root user
ismak- uml run like another process, so you can debug it
ismak- you can use it for testing new aplications, new kernels, new distributions (run different distributions simultaneously)
ismakII - What are people using it for?   (wait for the translator)
ismakvirtual hosting
ismak
ismakWe can use uml for Virtual hosting. UML provides us with a complet Linux System, so we can run anything than can be run in our host.
ismakAn example of a virtual hosting is  usermodelinux.org, administrated by David Coulson, which is running in a user mode linux system.
ismakKernel development and debugging
ismak
ismakIt is a very good method of kernel debugging. If our uml system crash, the system running uml is still fine, our system will not be damaged.
ismakWe can use some debug programs like gdb, gprof and gcov. The development of drivers is more efficient, because we haven't to reboot the machine, wich decrease the development time.
ismak
ismakProcess debugging
ismak
ismakUML can be used to debug user-level processes. If we want to debug some process, we can launch UML, set a breakpoint on the system call, and run the program.
ismakSafely playing with the latest kernels
ismak
ismakWe can use UML to safely probe the latest kernel, so if the kernel contains any bugs, like file corruption bugs, it can't hurt any important data outside of the UML
ismak
ismakTrying out new distributions
ismak
ismakThe filesystem of the UML is completely contained inside a file, so we don't need to use an entire disk partition for it.
ismakWe can find a number of ready-to-go root filesystems loaded with various distributions in the web of UML (http://sourceforge.net/project/showfiles.php?group_id=429) or we can make our filesystem from the scratch. Later we will see an example with the debian distribution.
ismak
ismakEducation
ismak
ismakIt's usefull for student than need a dedicated machine, to teach OS development, network administration, and more general system administration.
ismak
ismakExperimental development
ismak
ismakOur virtual machine can run with more devices than the physical system running UML, so we can have a virtual system with more memory, mode devices and with more processors.
ismakWe can development and testing of hardware capabilities even when we don't have the relevant hardware
ismak
ismakPoking around inside a running system
ismak
ismakWe have a complete OS running outside UML, so we can use it to "look inside" this kernel, that are impossible for a native kernel.
ismak
ismakAs a secure sandbox or jail
ismak
ismakProcesses running inside uml have no access to the system running uml, so some malicious programs running inside uml can not damage our real system.
ismak
ismakVirtual networking
ismak
ismakWe can use the network in a running uml. We can setup a virtual network if we want to test experimental services. Later I will explain how to setup a uml with network support.
ismak
ismakAs a test environment
ismak
ismakTesting some software requires booting the machine, so with uml we can avoid this loss of time. We can automate this testing. There is a a small perl module implementing a UML object which provides methods to boot a virtual machine, log in to it, run commands, and shut it down. We can find it in the download page (http://sourceforge.net/project/showfiles.php?group_id=429)
ismak
ismakDisaster recovery practice
ismak
ismakIf you want to know what happen whe you execute rm -rf /  ;-) , or you want to practice recovering from a disaster, we can use uml as a practice box. It can be fun :-)
ismak
ismakA Linux environment for other operating systems
ismak
ismakUML only runs on Linux right now, but there are some projects to port uml to other OS, so we can have an entire linux environment in other OS
ismak
ismak
ismakNow that we know what is user mode linux and how i can use it, i am going to explain some practical examples of uml. How to install, from scratch, a running uml based on Debian
ismak
ismakIII - A Practical Example
ismak
ismakWe need a UML kernel and a root filesystem to boot it on. We can get the kernel installing the .rpm or .deb package, or patching the kernel and compiling our UML kernel.
ismakThe .rpm and .deb packages also provide a set of userspace tools, kernel modules, and documentation.
ismak
ismakSource Installation
ismak
ismakIf you want to build UML from source, you have to download the patch an apply it to the appropiate Linux source kernel:
ismakcd linux-2.4.19
ismakpatch -p1 < uml-patch-2.4.19-37
ismak
ismakCompiling the user mode kernel is just like compiling any other kernel. This is the process. After patching the kernel we have to compile it:
ismakmake menuconfig ARCH=um (you can use make xconfig and make config)
ismak
ismakThe default kernel configuration works as well, so you don't have to change anything. If you can change something. Its probably nothing will be damaged. Now we have to compile our new kernel:
ismakmake linux ARCH=um
ismak
ismakAfter compilation you have the user mode kernel, named linux, in the top directory of your source tree.
ismak
ismakNow we are going to compile and install the kernel modules. We compile the modules in the same way as a native kernel with the exception of the 'ARCH=um':
ismakmake modules ARCH=um    
ismak
ismakYou can install them by using ftp, uploading these to our UML, or we can mount our root filesystem and copy them in the appropiate directory:
ismakmount root_fs_file mount_point -o loop
ismakmake modules_install INSTALL_MOD_PATH=`pwd`/mnt ARCH=um
ismakumount mnt
ismakthis will use the kernel build process to install our modules in our uml root filesystem.  
ismakIf we want to use the uml utilities, we have to get the source code and compie it.
ismak
ismakDebian installation
ismak
ismakOk, now i am going to explain the easy way of getting a running uml, with debian of course ;-)
ismakFirst, the woody version of debian has the next uml packages:
ismakuser-mode-linux
ismakuser-mode-linux-doc
ismakuml-utilities
ismak
ismakWe have to install the user-mode-linux package:
ismakapt-get install user-mode-linux (the uml-utilities package will be installed automatically
ismakby package dependencies)
ismakWe said that the root uml filesystem will be a file, so we are going to create the appropriate file:
ismak
ismakdd if=/dev/zero of=root_fs_woody bs=1M count=100
ismak
ismakBy this way we are creating a file of 100 megas size. We can put the size we want.
ismakThis file may have an ext2 filesystem. We use mke2fs to create the ext2 filesystem:
ismak /sbin/mke2fs -Fq root_fs_woody
ismakOk, we have our root filesystem file, now we are going to mount it and create our filesystem structure:
ismakmkdir /mnt/uml
ismakmount  root_fs_woody /mnt/uml -o loop
ismak
ismakWe get the base system package of our Debian version (i have use the latest Debian version: woody):
ismakwget ftp://ftp.debian.org/debian/dists/woody/main/disks-i386/base-images-current/basedebs.tar
ismakInstall the base system in our file:
ismakdebootstrap --unpack-tarball /PATH/basedebs.tar woody /mnt/uml/
ismak
ismakok a question
ismak<Arador> can't you use a partition as root fs UML?
ismakno, The disk storage of UML is a file
ismak
ismakor more files if you want to simulate more Hard Drives
ismak
ismakNow we have to configure some files of our uml system:
ismakcd /mnt/debinst
ismakvi etc/fstab
ismak# /etc/fstab: static file system information.
ismak
ismak
ismak# /etc/fstab: static file system information.
ismak#
ismak# file system    mount point   type    options                  dump pass
ismak /dev/ubd0        /             ext2    defaults                 0    0
ismakproc             /proc         proc    defaults                 0    0
ismakanother file:
ismak
ismakvi etc/inittab
ismakwe comment the above lines, so only an xterm will be launched when the system boot.
ismak1:2345:respawn:/sbin/getty 38400 tty1
ismak#2:23:respawn:/sbin/getty 38400 tty2
ismak#3:23:respawn:/sbin/getty 38400 tty3
ismak#4:23:respawn:/sbin/getty 38400 tty4
ismak#5:23:respawn:/sbin/getty 38400 tty5
ismak#6:23:respawn:/sbin/getty 38400 tty6
ismak
ismakWe create an empty source list:
ismak
ismaktouch etc/apt/sources.list
ismak
ismakOK, now we can launch our uml kernel:
ismak
ismaklinux ubd0=root_fs_woody devfs=nomount rw
ismak
ismakIf we want with cdrom support:
ismak
ismaklinux ubd0=root_fs_woody ubd2r=/dev/cdrom devfs=nomount rw
ismak
ismakWhat happen with the network support?. It is the last part of the conference.
ismakUser Mode Linux Networking
ismak
ismakWe need the TUN/TAP device module, sou we need to recompile the kernel (not the uml kernel) with this module supported.
ismakWhen we have TUN/TAP device as module, we insert this in the kernel:
ismakinsmod tun
ismakCreate the TUN/TAP interface:
ismaktunctl -u uiduser
ismak
ismakwhere uiduser is the uid of the user running the uml.
ismakThe user that is going to use the TUN/TAP device
ismakConfigure the interface:
ismak
ismakifconfig tap0 ip_system netmask netmask_system broadcast broadcast_system
ismak
ismakwhere ip_system, netmask_system and broadcast_system are the network parameters of our real system (the system running uml)
ismak
ismakNow we configure the routing table. We have to allow forwarding and manually  create  an  ARP address mapping entry for the uml host:
ismak
ismakbash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
ismakroute add -host uml_ip dev tap0
ismakbash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'
ismakarp -Ds uml_ip eth0 pub
ismak
ismakuml_ip must be the ip of the uml network interface.
ismak /dev/net/tun device must have write permissions for the user running uml:
ismakchgrp gid /dev/net/tun
ismakchgrp gid /dev/net/tun
ismakchmod 660 /dev/net/tun
ismakOur system is ready to run uml with network support:
ismaklinux ubd0=root_fs_woody devfs=nomount rw eth0=tuntap,tap0
ismakNow you have  to configure your network parameters in the uml system (ip, gateway, dns,...) and you will have a running uml with network support.
ismak
ismakThe only thing to do now is to enjoy with it  ;-).
ismakThats all....
ismakThanks and congratulations to all the translators
ismakthx: Jacobo, Raul, raciel, Mjesus
fernand0plas plas plas plas plas plas plas plas plas plas plas
ismakArador
fernand0plas plas plas plas plas plas plas plas plas plas plas
fernand0plas plas plas plas plas plas plas plas plas plas plas
ismakThanks
fernand0plas plas plas plas plas plas plas plas plas plas plas
Ricardoplas plas plas plas plas plas plas plas plas plas plas
fernand0plas plas plas plas plas plas plas plas plas plas plas
fernand0plas plas plas plas plas plas plas plas plas plas plas
Aradorplas clap plas clap plas clap plas clap plas clap plas clap plas clap
Aradorplas clap plas clap plas clap plas clap plas clap plas clap plas clap
Aradorplas clap plas clap plas clap plas clap plas clap plas clap plas clap
> clap clap clap clap clap clap clap clap clap clap
> clap clap clap clap clap clap clap clap clap clap
> clap clap clap clap clap clap clap clap clap clap
> clap clap clap clap clap clap clap clap clap clap
jacoboplas plas
catfishThere's an IRC channel for UML support if you have questions at irc.usermodelinux.org, channel #uml
jacobo:)
MiToismak podrias dar un ejemplo con los files COW ?
sarnoldismak: thanks :)
ismakok, if you want the conference in pdf:
jacoboclas plac clas plac clas plac
> clap clap clap clap clap clap clap clap clap clap
ismakMiTo, yes its not very dificult
> clap clap clap clap clap clap clap clap clap clap
> clap clap clap clap clap clap clap clap clap clap
> clap clap clap clap clap clap clap clap clap clap
MiTopls, example
ismakbut, first the URL of the conference:
catfishMiTo: ./linux ubd0=cow_file,base_file
angelLuisgood!!
MiTook catfish
ismakhttp://www.inkatel.int/new/textos/umeet/2002/umeet2002.pdf
catfishMiTo: where base_file is a read only root filesystem.  Make sure you never modify base_file from now on.
slackclap clap clap clap clap clap clap
ismakok, catfish, thanks for your help :-)
MiTooks catfish
Aradorismak: in UNIX everything is a file, why you couldn't use a partition as root fs?
catfishArador: You can use a partition as a root filesystem, but you're not required to.
ismak:-)
Aradori see
Aradori tried uml once, but i couldn't run it in my root partition :(
sergioismak: isn't it inkatel.com instead of .int?
ismaksorry
ismaki have make copy/paste :-)
ismaks/.int/.com/  ;-)
catfishArador: You should _never_ try to share a root partition between the host OS and a UML, or between two UML's.,
Aradorcatfish: i mean, a copy of the root partition ;)
ismakyes, you can damage the root filesystem
catfishArador: OK, sorry.
Aradorbah reiserfs already damaged it :)
ismakjeje
catfishArador: if you can find the error message, bring it over to irc.usermodelinux.org, #linux and we can troubleshoot there.
Aradorcatfish:  ok
dgyou mean #uml surely? :)
DrBeckyeah!
AradorAs UML is a linux system, can you access the hardware if you want?
DrBeckin time today :D
catfishSorry, channel #uml, not #linux.  Thanks dg!
catfishArador: generally no.  The UML kernel can be rescheduled, and that's bad for talking to physical chips.
ismaki think you cant access the hardware
catfishArador: that's why most of the "devices" you use are virtual ones, and only the host kernel talks to physical chips.
Aradori see, nothing real in UML :)
catfishArador: there are exceptions, however; a uml kernel can talk to some host usb devices and a few other specific things.
catfishArador: it's all fake.  ;-)
ismakcatfish: and what kind of hardware the UML cant speak to?
garoedaMJesus: and another fine dutch translation finished :-)
catfishismak: the uml kernel can't talk directly to most devices.
ismakbut it can talk to some usb devices ok?. I think that it cant talk to any Hardware devices. I have to probe this USB support.... :-)
ismakits really fun to get a kernel panic.... :-)
MiToque pasa si hago un : mkdir /mnt/uml/; mount root_fs -o loop /mnt/uml/; cd /source/uml/kernel/; make modules_install INSTALL_MOD_PATH=/mnt/ ARCH=um , and run uml ? this is correct ?
catfishismak: yes, there's a kernel menu option for talking to a usb device.  Check the kernel configuration help next time you compile a uml kernel.
ismakMiTo: what is the problem?
Aradorbut.....if it can access the hardware...how it's possible that you can test kernels, and they can crash? For example, i hac a sound driver that does full access to the sound card, i compile the uml kernel and i run it as a non-root user; does UML has access to hardware....or have i to change my midn to understand uml? ;)
catfishMiTo: It's generally easier to compile a UML kernel that has all the support you need set to "yes" instead of "module".  You can use modules if you want
catfishArador: UML generally does _not_ get direct access to the hardware; that's why the uml kernel can crash and your host system stays stable.
catfishArador: To use sound, for example, you use UML's virtual sound card, which takes sound requests and hands them off to the host kernel to feed to the real sound card.
Aradorcatfish: that's why i though, i need to change my mind o_O
catfishArador: it's confusing at first.
ismakall the devices that you can use are virtual devices ok?
catfishismak: ypu.
catfishyup
ismakand the uml kernel "speak" to the "host kernel" running the uml instead to the hardware
Aradorcatfish: but the host kernel (the real one yes?) shouldnt allow you to do it if you aren't root¿?
catfishArador: that's not correct.
catfishArador: A normal application can talk to the sound card even if it's not running as root, right?
Aradoryes, through /dev/dsp for example
catfishArador: as far as the host (=real) kernel is concerned, the uml kernel is an application running as a non-root user.
Aradorbut that doesn't allow you to change register in the chip, etc
catfishArador: exactly!  So the UML kernel opens /dev/dsp.
MiTocatfish pero no hay problema si esta montado /mnt/uml/ y corro el uml y luego compilo los modulos y hago make modules_install y su PATH?, pls, translate
catfishArador: the UML kernel doesn't want to twiddle bits in the sound card, it just wants to play sound through the established devices.
MiTomy english is bad
ShawnXismak: I love UML :) it's helped me and will be helping me blow up the IDE layer tonight ;-)
catfishMito: My espanol is worse.  :-)
ShawnXclap clap clap clap clap clap for ismak
MiTohaha catfish oks
MiTono problem
angelLuisclap clap clap clap :))
* ShawnX scrolls up to read the lecture
catfishMito: You can copy compiled modules into the root filesystem that way if you'd like.
ShawnXok now im caught up :)
Aradorcatfish: but what if the uml kernel needs to change that because a module hack requires it?
ShawnXismak: UML 2.5.50 patch broke 2.5.51 ;-(
ShawnXa function changed which affects some platforms.
catfishArador: Such as?
ismakShawnX: oh... What happen with 2.5.51?
MiTook, this understand, my question is other
ShawnXismak: function:
garoedaismak: i don't know whether you have already a dutch install guide on the usermodelinux website but you can add my translation if you want to
catfishIf hardware needs to have special treatment, the host kernel needs to do it.
Aradorcatfish: nah, i need to read more UML docs ;)
garoedaismak: it will appear on the umeet website
ShawnXsec getting function
catfishgaroeda: you might want to get in touch with Jeff Dike, the UML kernel developer, and see if he would like a dutch translation of the UML howto.
ismakgaroeda: i am not a user mode linux develop, but i think catfish can help with this
ismakor send directly to Jeff Dike
catfishJeff Dike <jdike@karaya.com>
garoedaok, i'll put it on my todo list
jacobo<MiTo> catfish, but isn't it troublesome if /mnt/uml/ is mounted and I launch uml and then I build the modules and make modules_install ad its PATH?
catfishjacobo: thanks
ShawnX-unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
ShawnX-unsigned long len, unsigned long prot,
ShawnX-unsigned long flags, unsigned long pgoff)
ShawnX+unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file,
ShawnX+    unsigned long addr, unsigned long len,
ShawnX+    unsigned long prot, unsigned long flags,
ShawnX+    unsigned long pgoff)
MiTogracias jacobo
ShawnXismak: this broke alot of platforms
ShawnXdue to the extra argument 'struct mm_strict'
catfishMiTo: You should unmount the root filesystem before you start the uml, yes.
MiToohh, thanks catfish
ismakok ShawnX, i wil to probe it
catfishShawnX : Jeff would love patches if you're willing to provide them.
ShawnXismak :-)
ShawnXcatfish: well i could fix but im still learning the kernel
ShawnX:(
catfishismak: I hope to see more of you one the mailing lists.
catfishismak: you, and everyone else, are welcome to take part.
ismakcatfish: the next time i invited you, or Jeff Dike to speak about UML
ShawnXtime go to ;)
fernand0Thanks for the conference and thank you to all for comming
fernand0the conversation can follow here
fernand0and later there is another talk
catfishismak: You did a nice job - neither of us would have done better!
ismak:-) thank you
fernand0see you

Generated by irclog2html.pl by Jeff Waugh - find it at freshmeat.net!