An unique feature of UML is that you can run it on a powerful Linux server as a regular user. You do not need any sort of root permission to run it. In fact, this is the only feasible solution for a non-root user (other than QEMU running in emulation mode which is much much slower). UML in fast.
To get UML running, you need two things: the kernel and the file system. UML provides the kernel and the compilation is straightforward.
To get file system, you need to have root access on a Linux machine (does not have to be your final HOST machine) and do the following:
(root@host)# apt-get install debootstrap
(root@host)# cd /tmp (root@host)# dd if=/dev/zero of=debian.bin bs=1M count=1 seek=4096 (root@host)# mkfs.ext3 debian.bin(root@host)# mkdir -p /mnt; mount -o loop debian.bin /mnt (root@host)# debootstrap squeeze /mntIf you are in the year after 2012, Replace "squeeze" with whatever the latest debian stable version name is.(root@host)# chroot /mnt(chroot@host)# mkdir /dev/ubd (chroot@host)# cd /dev/ubd (chroot@host)# for i in 0 1 2 3 4 5 6 7; do mknod $i b 98 $[ $i * 16 ]; done(chroot@host)# cat > /etc/fstab << EOF /dev/ubd/0 / xfs defaults 0 0 /dev/ubd/1 none swap defaults 0 0 none /proc proc defaults 0 0 sys /sys sysfs defaults 0 0 none /dev/pts devpts defaults 0 0 EOF(chroot@host)# echo uml0 > /etc/hostname(chroot@host)# exit (root@host)# rm -f /mnt/root/.bash_history (root@host)# umount /mntNow the file debian.bin has the latest debian base installation. This is your File System.Now you need to download and compile Slirp from http://slirp.sourceforge.net/. Slirp is a cool hack that allows UML limited access to the network bytunneling it over regular UDP and TCP connections. This is really the key to making UML useful as a regular user. The other (better) methods for accessing the network need root access. Be sure to apply the latest patch, as otherwise it does not work. It is critical to editconfig.h
and uncomment the line that says#define FULL_BOLT
. This will make Slirp go as fast as it can. Otherwise, slirp will only go 115kbps. Trying to do "apt-get" over that is painful.Copy the slirp program you build to /home/YOU/bin/./linux ubd0=debian6.bin con=pts con0=fd:0,fd:1 eth0=slirp,,/home/user/bin/slirpI also add "single rw" to get linux boot into single mode and get me started. Once everything is running, I take out "single rw" so that all the daemons are started correctly.I also have a file ~/.slirprc to direct TCP connections so that I can ssh into the UML.#cat ~/.slirprc redir 2200 22
No comments:
Post a Comment