You are not logged in.

#1 2012-05-02 09:19:36

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 265

How to run user mode linux on kernel 3.3.4

Is there any one successful?

I've followed the wiki https://wiki.archlinux.org/index.php/User-mode_Linux.

And try to fixed some commands. But, I can NOT enter user mode linux.

By the way, my requirement is try to use my 8G memory x86_64 machine to simulate a local network environment with 12 machines.

Every mini machine has its own ip address.

If I use 'virtualbox', that will be impossible. (Limited by CPU & memory)
If I use chroot, that can not provide different ip address to simulate a local network.

I can login by init=/bin/sh, but can not do other useful things.

[Temp Solution]
After read  http://vincent.bernat.im/en/blog/2011-u … k-lab.html and try error.
I've modified the original wiki to provide a quick launch script.

There are some tips in this solution:
1. use rootfstype=hostfs (require modify config in user-mode-linux package)
2. use vde instead of tap(require modify config in user-mode-linux package)
3. use python to enable "job control" in UML

[TODO]
To let hostfs workable, it is required aufs compiled in the user-mode-linux. But it is difficult  to me.

Last edited by dlin (2012-05-05 16:34:30)


Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages

Offline

#2 2012-05-03 07:09:01

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 265

Re: How to run user mode linux on kernel 3.3.4

I don't know how to entere the console to type command, it just hangs.

$ vmlinux ubda=rootfs ram=256M

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 4747264 bytes to physical memory to account for exec-shield gap
Linux version 3.3.4-uml (dlin@u40) (gcc version 4.7.0 20120414 (prerelease) (GCC) ) #1 Wed May 2 14:08:20 CST 2012
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 9223
Kernel command line: ubda=rootfs ram=256M root=98:0
PID hash table entries: 256 (order: -1, 2048 bytes)
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode-cache hash table entries: 4096 (order: 3, 32768 bytes)
Memory: 27668k available
NR_IRQS:15
Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
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 <bio-0> at 0
Switching to clocksource itimer
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 3, 32768 bytes)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
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 /home/dlin/.uml/Kdoo9t/mconsole
Checking host MADV_REMOVE support...OK
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
GFS2 installed
msgmni has been set to 54
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: unknown partition table
VFS: Mounted root (ext2 filesystem) readonly on device 98:0.

Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages

Offline

#3 2012-05-03 09:26:03

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 122

Re: How to run user mode linux on kernel 3.3.4

What happens if you add "init=/bin/sh" to the kernel command line?

Offline

#4 2012-05-03 09:36:32

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 265

Re: How to run user mode linux on kernel 3.3.4

It enter the shell. But, I don't know what's the next step to correct it.

I install it  following steps in https://wiki.archlinux.org/index.php/User_Mode_Linux.

(I manual add a ubd0 device on /dev).

$ vmlinux ubd0=rootfs mem=256M init=/bin/sh

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 29188096 bytes to physical memory to account for exec-shield gap
Linux version 3.3.4-uml (dlin@u40) (gcc version 4.7.0 20120414 (prerelease) (GCC) ) #1 Thu May 3 16:00:09 CST 2012
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 71668
Kernel command line: ubd0=rootfs mem=256M init=/bin/sh root=98:0
PID hash table entries: 2048 (order: 2, 16384 bytes)
Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
Memory: 249468k available
NR_IRQS:15
Calibrating delay loop... 1587.60 BogoMIPS (lpj=7938048)
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 <bio-0> at 0
Switching to clocksource itimer
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 3, 32768 bytes)
TCP established hash table entries: 16384 (order: 6, 262144 bytes)
TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP reno registered
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
mconsole (version 2) initialized on /home/dlin/.uml/pjqJIT/mconsole
Checking host MADV_REMOVE support...OK
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
GFS2 installed
msgmni has been set to 487
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: unknown partition table
VFS: Mounted root (ext2 filesystem) readonly on device 98:0.
sh: cannot set terminal process group (-1): Inappropriate ioctl for device
sh: no job control in this shell
sh-4.2# 

Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages

Offline

#5 2012-05-04 01:37:54

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 265

Re: How to run user mode linux on kernel 3.3.4

I rebuild the user-mode-linux with hostfs enabled, and following the instruction of
http://vincent.bernat.im/en/blog/2011-u … k-lab.html

But, I stopped at the step

$ vmlinux init=/bin/sh rootfstype=hostfs

# inside prompt sh-42# 
hostname R1
export TERM=xterm
export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/local/sbin:/usr/sbin
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t tmpfs tmpfs /var/run -o rw,nosuid,nodev
mount -t tmpfs tmpfs /var/log -o rw,nosuid,nodev
mount -o bind /usr/lib/uml/modules /lib/modules
mount -t hostfs hostfs /home/dlin -o /home/dlin

exec agetty -n -l /bin/sh 38400 /dev/tty0   # use agetty instead of getty

The output is

# exec agetty -n -l /bin/sh 38400 /dev/tty0
Kernel panic - not syncing: Attempted to kill init!
Call Trace: 
62c23d28:  [<6022d998>] panic+0xef/0x1da
62c23d58:  [<600ae9c0>] free_fdtable_rcu+0x0/0x100
62c23d88:  [<600274c0>] set_signals+0x30/0x40
62c23da8:  [<60067f74>] call_rcu_sched+0x44/0x50
62c23dc8:  [<6003342a>] put_files_struct+0xda/0xf0
62c23e28:  [<60033ba5>] do_exit+0x705/0x7b0
62c23e48:  [<60017f71>] buffer_op+0x51/0x100
62c23eb8:  [<60033e9e>] do_group_exit+0x3e/0xd0
62c23ec8:  [<6004daff>] sys_nanosleep+0x4f/0x70
62c23ee8:  [<60033f42>] sys_exit_group+0x12/0x20
62c23ef8:  [<60017b87>] handle_syscall+0x57/0x70
62c23f18:  [<6002a669>] userspace+0x389/0x470
62c23f28:  [<60001703>] rootwait_setup+0x0/0x19
62c23fd8:  [<60014974>] new_thread_handler+0xb4/0xc0


Modules linked in:
Pid: 1, comm: agetty Not tainted 3.3.4-uml
RIP: 0033:[<00000000402d9ef9>]
RSP: 0000007fbf871838  EFLAGS: 00000246
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: ffffffffffffffff
RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 00000000405bb820 R08: 000000000000003c R09: 00000000000000e7
R10: ffffffffffffffa8 R11: 0000000000000246 R12: 00000000405bb820
R13: 00000000405c0c80 R14: 0000007fbf875f7f R15: 0000000000000000
Call Trace: 
62c23c90:  [<6005ed1d>] __module_text_address+0xd/0x60
62c23ca8:  [<600174db>] panic_exit+0x2b/0x50
62c23cc8:  [<6004e43d>] notifier_call_chain+0x4d/0x70
62c23d08:  [<6004e469>] __atomic_notifier_call_chain+0x9/0x10
62c23d18:  [<6004e481>] atomic_notifier_call_chain+0x11/0x20
62c23d28:  [<6022d9b0>] panic+0x107/0x1da
62c23d58:  [<600ae9c0>] free_fdtable_rcu+0x0/0x100
62c23d88:  [<600274c0>] set_signals+0x30/0x40
62c23da8:  [<60067f74>] call_rcu_sched+0x44/0x50
62c23dc8:  [<6003342a>] put_files_struct+0xda/0xf0
62c23e28:  [<60033ba5>] do_exit+0x705/0x7b0
62c23e48:  [<60017f71>] buffer_op+0x51/0x100
62c23eb8:  [<60033e9e>] do_group_exit+0x3e/0xd0
62c23ec8:  [<6004daff>] sys_nanosleep+0x4f/0x70
62c23ee8:  [<60033f42>] sys_exit_group+0x12/0x20
62c23ef8:  [<60017b87>] handle_syscall+0x57/0x70
62c23f18:  [<6002a669>] userspace+0x389/0x470
62c23f28:  [<60001703>] rootwait_setup+0x0/0x19
62c23fd8:  [<60014974>] new_thread_handler+0xb4/0xc0

zsh: abort      vmlinux init=/bin/sh rootfstype=hostfs

Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages

Offline

#6 2012-05-05 16:37:22

dlin
Member
From: Taipei,Taiwan
Registered: 2005-09-21
Posts: 265

Re: How to run user mode linux on kernel 3.3.4

I've tried to solve this problem.

I can start up 2 vm, they can ping each other.
But, I can not start sshd on any site.
Because the /etc directory is still read-only.
I must use aufs to overwrite /etc.

It is difficult to me to re-compile user-mode-linux with aufs3 support.

I've install precompiled kernel linux-pf, but it didn't help with the user-mode-linux.


Running 4 ArchLinux including sh4twbox,server,notebook,desktop. my AUR packages

Offline

Board footer

Powered by FluxBB