Monthly Archives: May 2015

Linux Virtualization – Without ROOT privilages

Hi.

There are many virtualization solutions available for Linux, such as KVM, VMWare or VirtualBox (ordered by my personal preferences…)
However, all of them require ‘root’ privileges. 

Or maybe not?

Today I stumbled upon a nice solution – User Mode Linux
Sadly, in order to configure it, with networking, I had to collect information from several resources (*). So here’s what I’ve done:

  1. Download and bunzip kernel and filesystem  image. I chose CentOS6, 64 bit. You can see all options at http://uml.devloop.org.uk/index.html . Just beware to choose kernel that matches your OS.  (**)
  2. Let’s see that it’s working: (change the ‘mem’ if needed)  ./kernel64-3.18.12 ubda=CentOS6.x-AMD64-root_fs mem=1G
  3. Log in as ‘root’, no password. Play around. ‘poweroff’ when finished will return you to the host prompt.
  4. You probably noticed that there is no networking!   (try ifconfig, if you don’t believe me 🙂 ) We’ll use external tool – SLIRP – to aid us.  (There might be another option – VDE, but I haven’t tried it) Unfortunately, SLIRP packaging is a little bit messy…
  5. Download both SLIRP latest full version (1.0.16)   and Patch to version 1.0.17
    tar xzf slirp-1.0.*
    cd slirp-1.0.16/src
    patch -p1 < ../../fix17.patch
    ./configure
  6. The configuration has to be manually changed, so we stop before the obvious ‘make‘! Edit config.h, look for "FULL_BOLT". Add   #define FULL_BOLT
  7. make
    cp slirp ../../../
  8. Now we should add slirp tool to our command: ./kernel64-3.18.12 ubda=CentOS6.x-AMD64-root_fs mem=1G eth0=slirp,,slirp
  9. Now ifconfig shows a network device. If you’re lucky, the builtin slirp DHCP server will give you IP address. In my case it didn’t work, so I had to do:
    ip addr add 192.168.0.1/24 dev eth0
    route add default dev eth0
  10. Finally, there is no DNS server configured, so you should edit /etc/resolv.conf
  11. In my case I also had to configure proxy environment variables.

The only downside (so far) is that I have network connectivity from my guest outside, but not from the external word inside. It seems that VDE should solve it, however I don’t have all its dependencies, so I couldn’t validate that.

* Most of the information was collected from http://user-mode-linux.sourceforge.net/old/networking.html and from http://vincent.bernat.im/en/blog/2011-uml-network-lab.html

** The dhcp client (dhclient) failed with ‘Segmentation fault’. I assume that’s because of kernel/OS mismatch. It seems that CentOS need kernel 2.6.32; however when I tried this UML kernel version it just stuck.

That’s it, enjoy your new CentOS machine! Comments are welcomed.

Leave a comment

Filed under Linux