UMLの起動 失敗編
UMLとは?
環境
実際にやった手順
mkdir uml
でディレクトリを作り,そこに移動- ダウンロードしたファイルを解凍し,そこに置く
sudo apt-get install user-mode-linux
でUMLのパッケージをインストールするsudo dpkg-reconfigure keyboard-configuration
でキーボードを日本語にする- Generic 105-key(Intl)PC -Japanese
- Japanese
- The default for the keyboard layout
- No compose key
- No
chmod +x kernel32-4.3.5
で実行権限を与える./kernel32-4.3.5 ubda=CentOS6.x-x86-root_fs mem=256M
でUMLを起動- rootでloginできる
linux-3.3.8
に移動make defconfig ARCH=um
でUMLのデフォルトコンフィグファイルを作成sudo apt-get install libncurses5-dev
をインストールするmake menuconfig ARCH=um
で必要な機能を設定するが,なにもせずExit
make
してAllEnter- ここ長いよ
make -j2 ARCH=um
でカーネルをコンパイルするここも長いよ
ls
でlinux
ファイルあれば成功!これが実行ファイルになる- いよいよ
./linux ubda=../CentOS6.x-x86-root_fs mem=128M
でUMLを起動する.- はい失敗.
Console initialized on /dev/tty0 console [tty0] enabled console [mc-1] enabled VFS: Cannot open root device "98:0" or unknown-block(98,0) Please append a correct "root=" boot option; here are the available partitions: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(98,0) ... Aborted (core dumped)
たぶんこの辺り.
あとこれが1から15まである
Using a channel type which is configured out of UML parse_chan_pair failed for device 1 : Configuration failed
- 一応
gdb
でfile linux
すればデバッグできるなぁ... - 及第点ってとこですかね.
参考サイト
- User Mode Linuxの設定
- Building from source
- LinuxカーネルHack: GDBとKVMによるカーネルデバッグ
- UserModeLinux
- The User-mode Linux Kernel Home Page
- 仮想OS「User Mode Linux」活用法
- User Mode Linux
- UML(user mode linux)との格闘
今日のまとめ.
- なにをやっても,Aborted(Core dump)になってしまう...
- もうやってらんないっすよ!
追記
6月19日
/usr/bin/linux.uml
を実行したらUML起動できた?
linux.uml ubd0=Cent0S6.x-x86-root_fs
shutdown -h now
でシャットダウンできる
参考:UMLによるはじめてのLinuxカーネルHack
kento@ubuntu:~/uml$ sudo linux-3.3.8 ubda=CentOS6.x-x86-root_fs mem=3G Locating the bottom of the address space ... 0x0 Locating the top of the address space ... 0xc0000000 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...nothing mounted on /dev/shm Checking PROT_EXEC mmap in /tmp/...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 4354048 bytes to physical memory to account for exec-shield gap CONFIG_HIGHMEM not enabled - physical memory shrunk to 3045064704 bytes
- あとちょっとな気がする
- いやいや,メモリ設定が多すぎって怒られてるだけw
linux-3.3.8/init/main.c
の494行目にprintk(KERN_NOTICE "Hello, World!");
を追加しmake -j 3 ARCH=um
の後実行すると,
kento@ubuntu:~/uml$ ./linux-3.3.8/linux ubd0=CentOS6.x-x86-root_fs Locating the bottom of the address space ... 0x10000 Locating the top of the address space ... 0xc0000000 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...nothing mounted on /dev/shm Checking PROT_EXEC mmap in /tmp/...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 11927552 bytes to physical memory to account for exec-shield gap [ 0.000000] Linux version 3.3.8 (kento@ubuntu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #2 Sun Jun 19 11:28:47 PDT 2016 [ 0.000000] Hello, World! [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 11017 [ 0.000000] Kernel command line: ubd0=CentOS6.x-x86-root_fs root=98:0 [ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes) [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Memory: 29148k available [ 0.000000] NR_IRQS:15 [ 0.000000] Calibrating delay loop... 4780.85 BogoMIPS (lpj=23904256) [ 0.040000] pid_max: default: 32768 minimum: 301 [ 0.040000] Mount-cache hash table entries: 512 [ 0.040000] Checking for host processor cmov support...Yes [ 0.040000] Checking that host ptys support output SIGIO...Yes [ 0.040000] Checking that host ptys support SIGIO on close...No, enabling workaround [ 0.040000] Using 2.6 host AIO [ 0.040000] NET: Registered protocol family 16 [ 0.040000] bio: create slab <bio-0> at 0 [ 0.040000] Switching to clocksource itimer [ 0.040000] NET: Registered protocol family 2 [ 0.040000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.040000] TCP established hash table entries: 2048 (order: 2, 16384 bytes) [ 0.040000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes) [ 0.040000] TCP: Hash tables configured (established 2048 bind 2048) [ 0.040000] TCP reno registered [ 0.040000] UDP hash table entries: 256 (order: 0, 4096 bytes) [ 0.040000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) [ 0.040000] NET: Registered protocol family 1 [ 0.040000] mconsole (version 2) initialized on /home/kento/.uml/UKlbEG/mconsole [ 0.040000] Checking host MADV_REMOVE support... [ 0.040000] MADV_REMOVE failed, err = -38 [ 0.040000] Can't release memory to the host - memory hotplug won't be supported [ 0.040000] Host TLS support detected [ 0.040000] Detected host type: i386 (GDT indexes 6 to 9) [ 0.040000] VFS: Disk quotas dquot_6.5.2 [ 0.040000] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 0.040000] msgmni has been set to 56 [ 0.040000] io scheduler noop registered [ 0.040000] io scheduler deadline registered [ 0.040000] io scheduler cfq registered (default) [ 0.040000] TCP cubic registered [ 0.040000] NET: Registered protocol family 17 [ 0.040000] Initialized stdio console driver [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 1 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 2 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 3 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 4 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 5 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 6 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 7 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 8 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 9 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 10 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 11 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 12 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 13 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 14 : Configuration failed [ 0.040000] Using a channel type which is configured out of UML [ 0.040000] parse_chan_pair failed for device 15 : Configuration failed [ 0.040000] Console initialized on /dev/tty0 [ 0.040000] console [tty0] enabled [ 0.040000] console [mc-1] enabled [ 0.040000] VFS: Cannot open root device "98:0" or unknown-block(98,0) [ 0.040000] Please append a correct "root=" boot option; here are the available partitions: [ 0.040000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(98,0) [ 0.040000] 0a45cef4: [<081c1bc3>] dump_stack+0x1c/0x20 [ 0.040000] 0a45cf0c: [<081c1c4a>] panic+0x62/0x14a [ 0.040000] 0a45cf24: [<08049912>] mount_block_root+0x1d8/0x1ee [ 0.040000] 0a45cf7c: [<08049974>] mount_root+0x4c/0x54 [ 0.040000] 0a45cfa0: [<08049a8f>] prepare_namespace+0x113/0x13a [ 0.040000] 0a45cfa8: [<08049674>] kernel_init+0xf9/0xfe [ 0.040000] 0a45cfb8: [<0805fa13>] run_kernel_thread+0x38/0x41 [ 0.040000] 0a45cfe4: [<080583b1>] new_thread_handler+0x8a/0xb6 [ 0.040000] 0a45cffc: [<00000000>] 0x0 [ 0.040000] [ 0.040000] [ 0.040000] EIP: 0073:[<b7744428>] CPU: 0 Not tainted ESP: 007b:bff6fc48 EFLAGS: 00000296 [ 0.040000] Not tainted [ 0.040000] EAX: 00000000 EBX: 000070e5 ECX: 00000013 EDX: 000070e5 [ 0.040000] ESI: 000070e1 EDI: 0000001c EBP: bff6fc74 DS: 007b ES: 007b [ 0.040000] 0a45ce84: [<08064346>] show_regs+0xc5/0xcb [ 0.040000] 0a45ceb0: [<0805a2fb>] panic_exit+0x23/0x39 [ 0.040000] 0a45cec4: [<0807e7b0>] notifier_call_chain+0x25/0x4a [ 0.040000] 0a45ceec: [<0807e803>] atomic_notifier_call_chain+0x15/0x17 [ 0.040000] 0a45cefc: [<081c1c62>] panic+0x7a/0x14a [ 0.040000] 0a45cf24: [<08049912>] mount_block_root+0x1d8/0x1ee [ 0.040000] 0a45cf7c: [<08049974>] mount_root+0x4c/0x54 [ 0.040000] 0a45cfa0: [<08049a8f>] prepare_namespace+0x113/0x13a [ 0.040000] 0a45cfa8: [<08049674>] kernel_init+0xf9/0xfe [ 0.040000] 0a45cfb8: [<0805fa13>] run_kernel_thread+0x38/0x41 [ 0.040000] 0a45cfe4: [<080583b1>] new_thread_handler+0x8a/0xb6 [ 0.040000] 0a45cffc: [<00000000>] 0x0 [ 0.040000] Aborted (core dumped)
HelloWorld
は実行されてるらしいこの形式はなに…?
これ,成功編のブログ書けるのかな…