Wednesday, January 30, 2013

UML (User Mode Linux)

 
1. Build the Kernel

# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.gz

# bunzip2 linux-2.6.39.tar.gz Build the Kernel 

# make ARCH=um defconfig

# make ARCH=um
 
2. Download Root-fs filesystem for Debian 
 
# wget http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-AMD64-root_fs.bz2

# bunzip2 Debian-Squeeze-AMD64-root_fs.bz2
 
3. Run it!!! Voila!! 
 
# ./vmlinux ubda=/root/Debian-Squeeze-AMD64-root_fs mem=128m umid=debian
Core dump limits :
        soft - 0
        hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking for tmpfs mount on /dev/shm...OK
Checking PROT_EXEC mmap in /dev/shm/...OK
Checking for the skas3 patch in the host:
  - /proc/mm...not found: No such file or directory
  - PTRACE_FAULTINFO...not found
  - PTRACE_LDT...not found
UML running in SKAS0 mode
Adding 5627904 bytes to physical memory to account for exec-shield gap
Linux version 2.6.39 (root@instructor.example.com) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 Wed Jan 30 11:49:25 PST 2013
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 33675
Kernel command line: ubda=/root/Debian-Squeeze-AMD64-root_fs mem=128m root=98:0
PID hash table entries: 1024 (order: 1, 8192 bytes)
Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
Inode-cache hash table entries: 16384 (order: 5, 131072 bytes)
Memory: 123904k available
NR_IRQS:15
Calibrating delay loop... 525.92 BogoMIPS (lpj=2629632)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 256
Checking that host ptys support output SIGIO...Yes
Checking that host ptys support SIGIO on close...No, enabling workaround
Using 2.6 host AIO
NET: Registered protocol family 16
bio: create slab  at 0
Switching to clocksource itimer
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 2, 16384 bytes)
TCP established hash table entries: 8192 (order: 5, 131072 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 128 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
NET: Registered protocol family 1
mconsole (version 2) initialized on /root/.uml/debian/mconsole
Checking host MADV_REMOVE support...OK
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
msgmni has been set to 242
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
TCP cubic registered
NET: Registered protocol family 17
Initialized stdio console driver
Console initialized on /dev/tty0
console [tty0] enabled
Initializing software serial port version 1
console [mc-1] enabled
ubda: detected capacity change from 0 to 1073741824
 ubda: unknown partition table
Switched to NOHz mode on CPU #0
EXT3-fs: barriers not enabled
kjournald starting.  Commit interval 5 seconds
EXT3-fs (ubda): mounted filesystem with ordered data mode
VFS: Mounted root (ext3 filesystem) readonly on device 98:0.
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

INIT: version 2.88 booting
Using makefile-style concurrent boot in runlevel S.
.udev/ already exists on the static /dev! ... (warning).
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events...udevd-work[272]: kernel-provided name 'hw_random' and NAME= 'hwrng' disagree, please use SYMLINK+= or change the kernel to provide the proper name

done.
Waiting for /dev to be fully populated...done.
hostname: the specified hostname is invalid
Activating swap...done.
EXT3-fs (ubda): using internal journal
Cleaning up ifupdown....
Setting up networking....
Loading kernel modules...done.
Activating lvm and md swap...done.
Checking file systems...fsck from util-linux-ng 2.17.2
done.
Mounting local filesystems...failed.
Activating swapfile swap...done.
Cleaning up temporary files....
Configuring network interfaces...Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

SIOCSIFADDR: No such device
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

eth0: ERROR while getting interface flags: No such device
modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

modprobe: FATAL: Could not load /lib/modules/2.6.39/modules.dep: No such file or directory

eth0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth0.
done.
Cleaning up temporary files....
Setting kernel variables ...done.
startpar: service(s) returned failure: hostname.sh ... failed!
INIT: Entering runlevel: 2
Using makefile-style concurrent boot in runlevel 2.
Starting enhanced syslogd: rsyslogd.
Starting periodic command scheduler: cron.
Serial line 0 assigned device '/dev/pts/0'

Debian GNU/Linux 6.0 (none) tty0

(none) login: root
Last login: Wed Jan 30 19:57:33 UTC 2013 on tty0
Linux (none) 2.6.39 #1 Wed Jan 30 11:49:25 PST 2013 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@(none):~# whoami
root
  

No comments:

Post a Comment