首页 文章

Qemu x86和Linux 3.12.17启动时出现内核恐慌

提问于
浏览
1

我有一个关于在Qemu 2.0.0中使用Linux 3.12.17执行自定义Openwrt系统的问题 . 在启动过程中,我有一条消息告诉我引导程序无法找到我的根分区设备,即/ dev / sda,如下图所示:

Shell:~$ sudo fdisk -l
[sudo] password for : 

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f25bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *       16065     1028159      506047+  83  Linux
/dev/sda2         1028160    41592284    20282062+  83  Linux
/dev/sda3        41592285   976773167   467590441+   f  W95 Ext'd (LBA)
/dev/sda5        41608350    45608534     2000092+  82  Linux swap / Solaris
/dev/sda6        45620266   976773167   465576451   83  Linux

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdb: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1   500118191   250059095+  ee  GPT

这是我用来启动Qemu模拟器的命令:

qemu-system-x86_64 -m 512 \
          -kernel bin/x86/openwrt-x86-sgc_qemu-vmlinuz \
          --append "root=/dev/sda rw" \
          -nographic -usb \
          -hda bin/x86/openwrt-x86-sgc_qemu-rootfs-ext4.img

这是完整的启动日志:

Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.12.17 (g602882@rmm-p1303101) (gcc version 4.5.2 (GCC) ) #4 SMP PREEMPT Wed Mar 8 15:47:13 CET 2017
e820: BIOS-provided physical RAM map:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
BIOS-e820: [mem 0x0000000000100000-0x000000001fffdfff] usable
BIOS-e820: [mem 0x000000001fffe000-0x000000001fffffff] reserved
BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
Notice: NX (Execute Disable) protection cannot be enabled: non-PAE kernel!
SMBIOS 2.4 present.
e820: last_pfn = 0x1fffe max_arch_pfn = 0x100000
PAT not supported by CPU.
found SMP MP-table at [mem 0x000f0b30-0x000f0b3f] mapped at [c00f0b30]
init_memory_mapping: [mem 0x00000000-0x000fffff]
init_memory_mapping: [mem 0x1f800000-0x1fbfffff]
init_memory_mapping: [mem 0x18000000-0x1f7fffff]
init_memory_mapping: [mem 0x00100000-0x17ffffff]
init_memory_mapping: [mem 0x1fc00000-0x1fffdfff]
ACPI: RSDP 000f09a0 00014 (v00 BOCHS )
ACPI: RSDT 1ffffbc1 00034 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
ACPI: FACP 1ffff1c0 00074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
ACPI: DSDT 1fffe040 01180 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
ACPI: FACS 1fffe000 00040
ACPI: SSDT 1ffff234 008DD (v01 BOCHS  BXPCSSDT 00000001 BXPC 00000001)
ACPI: APIC 1ffffb11 00078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
ACPI: HPET 1ffffb89 00038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
511MB LOWMEM available.
  mapped low ram: 0 - 1fffe000
  low ram: 0 - 1fffe000
Zone ranges:
  DMA      [mem 0x00001000-0x00ffffff]
  Normal   [mem 0x01000000-0x1fffdfff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x00001000-0x0009efff]
  node   0: [mem 0x00100000-0x1fffdfff]
Using APIC driver default
ACPI: PM-Timer IO Port: 0xb008
ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
Using ACPI (MADT) for SMP configuration information
ACPI: HPET id: 0x8086a201 base: 0xfed00000
smpboot: Allowing 1 CPUs, 0 hotplug CPUs
e820: [mem 0x20000000-0xfeffbfff] available for PCI devices
setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 nr_node_ids:1
PERCPU: Embedded 13 pages/cpu @dfbed000 s30592 r0 d22656 u53248
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129948
Kernel command line: root=/dev/sda rw
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Initializing CPU#0
allocated 1048552 bytes of page_cgroup
please try 'cgroup_disable=memory' option if you don't want memory cgroups
Memory: 509692K/523888K available (4990K kernel code, 415K rwdata, 1928K rodata, 576K init, 452K bss, 14196K reserved)
virtual kernel memory layout:
    fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
    vmalloc : 0xe07fe000 - 0xfff14000   ( 503 MB)
    lowmem  : 0xc0000000 - 0xdfffe000   ( 511 MB)
      .init : 0xc172b000 - 0xc17bb000   ( 576 kB)
      .data : 0xc14dfc22 - 0xc172ae00   (2348 kB)
      .text : 0xc1000000 - 0xc14dfc22   (4991 kB)
Checking if this processor honours the WP bit even in supervisor mode...Ok.
Preemptible hierarchical RCU implementation.
    RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
NR_IRQS:2304 nr_irqs:256 16
console [ttyS0] enabled
tsc: Fast TSC calibration using PIT
tsc: Detected 3092.840 MHz processor
Calibrating delay loop (skipped), value calculated using timer frequency.. 6185.68 BogoMIPS (lpj=12371360)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys memory
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys blkio
Initializing cgroup subsys perf_event
mce: CPU supports 10 MCE banks
Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0
tlb_flushall_shift: 6
Freeing SMP alternatives memory: 24K (c17bb000 - c17c1000)
ACPI: Core revision 20130725
ACPI: All ACPI Tables successfully acquired
ftrace: allocating 25039 entries in 49 pages
Enabling APIC mode:  Flat.  Using 1 I/O APICs
..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
smpboot: CPU0: Intel QEMU Virtual CPU version 2.0.0 (fam: 06, model: 06, stepping: 03)
Performance Events: Broken PMU hardware detected, using software events only.
Failed to access perfctr msr (MSR c1 is 0)
Brought up 1 CPUs
smpboot: Total of 1 processors activated (6185.68 BogoMIPS)
devtmpfs: initialized
NET: Registered protocol family 16
cpuidle: using governor ladder
cpuidle: using governor menu
ACPI: bus type PCI registered
PCI: PCI BIOS revision 2.10 entry at 0xfd3c2, last bus=0
PCI: Using configuration type 1 for base access
pcimode=0x0
bio: create slab <bio-0> at 0
ACPI: Added _OSI(Module Device)
ACPI: Added _OSI(Processor Device)
ACPI: Added _OSI(3.0 _SCP Extensions)
ACPI: Added _OSI(Processor Aggregator Device)
ACPI: Interpreter enabled
ACPI: (supports S0 S5)
ACPI: Using IOAPIC for interrupt routing
PCI: Ignoring host bridge windows from ACPI; if necessary, use "pci=use_crs" and report a bug
ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
acpi PNP0A03:00: ACPI _OSC support notification failed, disabling PCIe ASPM
acpi PNP0A03:00: Unable to request _OSC control (_OSC support mask: 0x08)
acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-ff]
pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
pci_bus 0000:00: root bus resource [mem 0x00000000-0xffffffff]
pci 0000:00:01.3: quirk: [io  0xb000-0xb03f] claimed by PIIX4 ACPI
pci 0000:00:01.3: quirk: [io  0xb100-0xb10f] claimed by PIIX4 SMB
ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
ACPI: Enabled 16 GPEs in block 00 to 0F
vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
vgaarb: loaded
vgaarb: bridge control possible 0000:00:02.0
SCSI subsystem initialized
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
PCI: Using ACPI for IRQ routing
NET: Registered protocol family 8
NET: Registered protocol family 20
HPET: 3 timers in total, 0 timers will be used for per-cpu timer
hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
hpet0: 3 comparators, 64-bit 100.000000 MHz counter
Switched to clocksource hpet
pnp: PnP ACPI init
ACPI: bus type PNP registered
pnp: PnP ACPI: found 8 devices
ACPI: bus type PNP unregistered
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
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
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
pci 0000:00:00.0: Limiting direct PCI/PCI transfers
pci 0000:00:01.0: PIIX3: Enabling Passive Release
pci 0000:00:01.0: Activating ISA DMA hang workarounds
ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
NatSemi SCx200 Driver
squashfs: version 4.0 (2009/01/31) Phillip Lougher
Registering unionfs 2.6 (for 3.12.26)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
NTFS driver 2.1.30 [Flags: R/W].
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.22)
msgmni has been set to 995
alg: No test for stdrng (krng)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
isapnp: Scanning for PnP cards...
isapnp: No Plug & Play device found
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 38, base_baud = 921600) is a 16550A
Linux agpgart interface v0.103
[drm] Initialized drm 1.1.0 20060810
SCSI Media Changer driver v0.25 
physmap platform flash device: 08000000 at c0000000
physmap-flash physmap-flash.0: map_probe failed
Intel(R) SPI FLASH CONTROLLER Driver built on Mar  8 2017 @ 15:45:49
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
Intel (R) UDMA Driver - 1.0.0
Copyright (c) 2012 Intel Corperation. 
UDMA Network Device Driver init 
e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
e1000: Copyright (c) 1999-2006 Intel Corporation.
ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 10
GBE working in Real Phy Mode
e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
GBE working in Real Phy Mode
e1000 0000:00:04.0 eth1: (PCI:33MHz:32-bit) 52:54:00:12:34:57
e1000 0000:00:04.0 eth1: Intel(R) PRO/1000 Network Connection
ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 10
GBE working in Real Phy Mode
tsc: Refined TSC clocksource calibration: 3092.828 MHz
Switched to clocksource tsc
e1000 0000:00:05.0 eth2: (PCI:33MHz:32-bit) 52:54:00:12:34:58
e1000 0000:00:05.0 eth2: Intel(R) PRO/1000 Network Connection
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 11
GBE working in Real Phy Mode
e1000 0000:00:06.0 eth3: (PCI:33MHz:32-bit) 52:54:00:12:34:59
e1000 0000:00:06.0 eth3: Intel(R) PRO/1000 Network Connection
GBE working in Real Phy Mode
e1000 0000:00:07.0 eth4: (PCI:33MHz:32-bit) 52:54:00:12:34:5a
e1000 0000:00:07.0 eth4: Intel(R) PRO/1000 Network Connection
GBE working in Real Phy Mode
e1000 0000:00:08.0 eth5: (PCI:33MHz:32-bit) 52:54:00:12:34:5b
e1000 0000:00:08.0 eth5: Intel(R) PRO/1000 Network Connection
GBE working in Real Phy Mode
e1000 0000:00:09.0 eth6: (PCI:33MHz:32-bit) 52:54:00:12:34:5c
e1000 0000:00:09.0 eth6: Intel(R) PRO/1000 Network Connection
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
e1000e: Copyright(c) 1999 - 2013 Intel Corporation.
ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 3.15.1-k
ixgbe: Copyright (c) 1999-2013 Intel Corporation.
ixgb: Intel(R) PRO/10GbE Network Driver - version 1.0.135-k2-NAPI
ixgb: Copyright (c) 1999-2008 Intel Corporation.
PPP generic driver version 2.4.2
NET: Registered protocol family 24
i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mousedev: PS/2 mouse device common for all mice
input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input2
rtc_cmos 00:00: RTC can wake from S4
rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
rtc_cmos 00:00: alarms up to one day, 114 bytes nvram, hpet irqs
softdog: Software Watchdog Timer: 0.08 initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
oprofile: using NMI interrupt.
IPv4 over IPSec tunneling driver
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 10
mip6: Mobile IPv6
sit: IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
8021q: 802.1Q VLAN Support v1.8
sctp: Hash tables configured (established 16384 bind 16384)
lib80211: common routines for IEEE802.11 drivers
Key type dns_resolver registered
Using IPI No-Shortcut mode
registered taskstats version 1
rtc_cmos 00:00: setting system clock to 2017-03-08 14:51:21 UTC (1488984681)
VFS: Cannot open root device "sda" or unknown-block(0,0): error -6
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(0,0)
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.17 #4
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 00000000 00000000 df45beec c14da955 df45bf34 df45bf04 c14da68e 00000000
 df45bf34 fffffffa df75e000 df45bf60 c172bd4e c1605306 df45bf34 c16052b5
 c1605282 c176906d df45bf34 fffffffa c16053a2 dffecbc0 00008000 6e6b6e75
Call Trace:
 [<c14da955>] dump_stack+0x4b/0x7e
 [<c14da68e>] panic+0x88/0x184
 [<c172bd4e>] mount_block_root+0x17f/0x18f
 [<c10e2a19>] ? SyS_mknod+0x1a/0x1c
 [<c172be22>] mount_root+0xc4/0xce
 [<c10e2b31>] ? SyS_unlink+0x15/0x17
 [<c172bf3d>] prepare_namespace+0x111/0x142
 [<c172ba87>] kernel_init_freeable+0x186/0x193
 [<c14d7308>] kernel_init+0xd/0xb9
 [<c14dea3b>] ret_from_kernel_thread+0x1b/0x30
 [<c14d72fb>] ? rest_init+0x77/0x77

非常奇怪的是,我拥有与Linux 2.6.32相同版本的OpenWRT系统,并且运行良好 . 我是否有额外的内核选项来配置linux 3.12.X以使其适用于Qemu 2.0.0?

感谢您的帮助和评论 .

1 回答

  • 1

    您的bin / x86 / openwrt-x86-sgc_qemu-rootfs-ext4.img文件可能有问题 . 你从哪里得到那个文件?

    此外,您're specifying a disk device as the root filesystem for the kernel (root=/dev/sda) . This is wrong. You'重新假设指定分区而不是磁盘设备 . 所以你可能想说 "root=/dev/sda1" . 如果您的根分区实际上不是/ dev / sda1,则指定UUID而不是分区名称(例如 root=UUID=3552064b-7e4d-4e3a-ae48-943b333267d9 )会更安全 .

    您可以通过从磁盘映像创建环回设备来提取虚拟根分区的UUID:

    losetup -P /dev/loop1 bin/x86/openwrt-x86-sgc_qemu-rootfs-ext4.img.
    

    您应该看到创建了名为 /dev/loop1p1/dev/loop1p2 等的新设备 . 您的虚拟分区 /dev/sda1 将创建为 /dev/loop1p1/dev/sda2 将为 /dev/loop1p2 等 . 然后您可以使用parted或gparted确定UUID /dev/loop1

    如果磁盘映像是原始磁盘映像,您可能还需要在qemu命令中指定类似 "format=raw" 的内容,或者您可能需要先将其转换为qcow2映像( qemu-image convert ) .

相关问题