Kernel panic with virt-builder etc.
by Oliver Frommel
Hi there,
I am trying to write an article on virt-builder and managed to compile
version 1.24.1 of libguestfs on Ubuntu 13.10 (I had mixed success with
the git version and 1.25.x). When I am running virt-builder I am getting
an error message:
virt-builder: error: virt-resize failed
Upon further investigation it turns out that there's a kernel panic when
booting the freshly created image. Running the test-tool gives the
following output:
--------------------------------------------------------------------
LIBGUESTFS_PATH=/home/ofrommel/libguestfs-1.24.1/appliance
LIBGUESTFS_CACHEDIR=/home/ofrommel/libguestfs-1.24.1/tmp
LD_LIBRARY_PATH=/home/ofrommel/libguestfs-1.24.1/ruby/ext/guestfs:/home/ofrommel/libguestfs-1.24.1/src/.libs:/home/ofrommel/libguestfs-1.24.1/gobject/.libs
LIBGUESTFS_TMPDIR=/home/ofrommel/libguestfs-1.24.1/tmp
PATH=/home/ofrommel/libguestfs-1.24.1/align:/home/ofrommel/libguestfs-1.24.1/builder:/home/ofrommel/libguestfs-1.24.1/cat:/home/ofrommel/libguestfs-1.24.1/df:/home/ofrommel/libguestfs-1.24.1/edit:/home/ofrommel/libguestfs-1.24.1/erlang:/home/ofrommel/libguestfs-1.24.1/fish:/home/ofrommel/libguestfs-1.24.1/format:/home/ofrommel/libguestfs-1.24.1/fuse:/home/ofrommel/libguestfs-1.24.1/rescue:/home/ofrommel/libguestfs-1.24.1/resize:/home/ofrommel/libguestfs-1.24.1/sparsify:/home/ofrommel/libguestfs-1.24.1/sysprep:/home/ofrommel/libguestfs-1.24.1/test-tool:/home/ofrommel/libguestfs-1.24.1/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
SELinux: sh: 1: getenforce: not found
library version: 1.24.1
guestfs_get_append: (null)
guestfs_get_backend: direct
guestfs_get_autosync: 1
guestfs_get_cachedir: /home/ofrommel/libguestfs-1.24.1/tmp
guestfs_get_direct: 0
guestfs_get_hv: /usr/bin/kvm
guestfs_get_memsize: 500
guestfs_get_network: 0
guestfs_get_path: /home/ofrommel/libguestfs-1.24.1/appliance
guestfs_get_pgroup: 0
guestfs_get_program: libguestfs-test-tool
guestfs_get_recovery_proc: 1
guestfs_get_selinux: 0
guestfs_get_smp: 1
guestfs_get_tmpdir: /home/ofrommel/libguestfs-1.24.1/tmp
guestfs_get_trace: 0
guestfs_get_verbose: 1
host_cpu: x86_64
Launching appliance, timeout set to 600 seconds.
libguestfs: launch: backend registered: unix
libguestfs: launch: backend registered: uml
libguestfs: launch: backend registered: libvirt
libguestfs: launch: backend registered: direct
libguestfs: launch: backend=direct
libguestfs: launch:
tmpdir=/home/ofrommel/libguestfs-1.24.1/tmp/libguestfsC8azDe
libguestfs: launch: umask=0002
libguestfs: launch: euid=1001
libguestfs: command: run: /usr/bin/supermin-helper
libguestfs: command: run: \ --verbose
libguestfs: command: run: \ -f checksum
libguestfs: command: run: \
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d
libguestfs: command: run: \ x86_64
supermin helper [00000ms] whitelist = (not specified), host_cpu =
x86_64, kernel = (null), initrd = (null), appliance = (null)
supermin helper [00000ms] inputs[0] =
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d
checking modpath /lib/modules/3.11.0-12-generic is a directory
picked vmlinuz-3.11.0-12-generic because modpath
/lib/modules/3.11.0-12-generic exists
checking modpath /lib/modules/3.8.0-31-generic is a directory
picked vmlinuz-3.8.0-31-generic because modpath
/lib/modules/3.8.0-31-generic exists
supermin helper [00000ms] finished creating kernel
supermin helper [00000ms] visiting
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d
supermin helper [00000ms] visiting
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d/base.img
supermin helper [00000ms] visiting
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d/daemon.img
supermin helper [00000ms] visiting
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d/hostfiles
supermin helper [00040ms] visiting
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d/init.img
supermin helper [00040ms] visiting
/home/ofrommel/libguestfs-1.24.1/appliance/supermin.d/udev-rules.img
supermin helper [00040ms] adding kernel modules
supermin helper [00112ms] finished creating appliance
libguestfs: checksum of existing appliance:
82bc0831de24ca2bd6a023ee99ee9d9351f4ea2cbc00a96791e7060658ed7a64
libguestfs: [00115ms] begin testing qemu features
libguestfs: command: run: /usr/bin/kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -help
W: kvm binary is deprecated, please use qemu-system-x86_64 instead
libguestfs: command: run: /usr/bin/kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -version
W: kvm binary is deprecated, please use qemu-system-x86_64 instead
libguestfs: qemu version 1.5
libguestfs: command: run: /usr/bin/kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -machine accel=kvm:tcg
libguestfs: command: run: \ -device ?
libguestfs: [00251ms] finished testing qemu features
[00252ms] /usr/bin/kvm \
-global virtio-blk-pci.scsi=off \
-nodefconfig \
-nodefaults \
-nographic \
-machine accel=kvm:tcg \
-cpu host,+kvmclock \
-m 500 \
-no-reboot \
-no-hpet \
-kernel
/home/ofrommel/libguestfs-1.24.1/tmp/.guestfs-1001/kernel.23882 \
-initrd
/home/ofrommel/libguestfs-1.24.1/tmp/.guestfs-1001/initrd.23882 \
-device virtio-scsi-pci,id=scsi \
-drive
file=/home/ofrommel/libguestfs-1.24.1/tmp/libguestfsC8azDe/scratch.1,cache=unsafe,format=raw,id=hd0,if=none
\
-device scsi-hd,drive=hd0 \
-drive
file=/home/ofrommel/libguestfs-1.24.1/tmp/.guestfs-1001/root.23882,snapshot=on,id=appliance,cache=unsafe,if=none
\
-device scsi-hd,drive=appliance \
-device virtio-serial-pci \
-serial stdio \
-device sga \
-chardev
socket,path=/home/ofrommel/libguestfs-1.24.1/tmp/libguestfsC8azDe/guestfsd.sock,id=channel0
\
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check
acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0
guestfs_verbose=1 TERM=xterm'
W: kvm binary is deprecated, please use qemu-system-x86_64 instead
Could not open option rom 'sgabios.bin': No such file or directory
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.11.0-12-generic (buildd@allspice) (gcc
version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu7) ) #19-Ubuntu SMP Wed Oct 9
16:20:46 UTC 2013 (Ubuntu 3.11.0-12.19-generic 3.11.3)
[ 0.000000] Command line: panic=1 console=ttyS0 udevtimeout=600
no_timer_check acpi=off printk.time=1 cgroup_disable=memory
root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff]
reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff]
reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001f3fdfff] usable
[ 0.000000] BIOS-e820: [mem 0x000000001f3fe000-0x000000001f3fffff]
reserved
[ 0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff]
reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff]
reserved
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] SMBIOS 2.4 present.
[ 0.000000] Hypervisor detected: KVM
[ 0.000000] No AGP bridge found
[ 0.000000] e820: last_pfn = 0x1f3fe max_arch_pfn = 0x400000000
[ 0.000000] x86 PAT enabled: cpu 0, old 0x70406, new 0x7010600070106
[ 0.000000] found SMP MP-table at [mem 0x000f17f0-0x000f17ff] mapped
at [ffff8800000f17f0]
[ 0.000000] Scanning 1 areas for low memory corruption
[ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[ 0.000000] init_memory_mapping: [mem 0x1f000000-0x1f1fffff]
[ 0.000000] init_memory_mapping: [mem 0x1c000000-0x1effffff]
[ 0.000000] init_memory_mapping: [mem 0x00100000-0x1bffffff]
[ 0.000000] init_memory_mapping: [mem 0x1f200000-0x1f3fdfff]
[ 0.000000] RAMDISK: [mem 0x1f2b5000-0x1f3eefff]
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000001f3fdfff]
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x1f3fdfff]
[ 0.000000] NODE_DATA [mem 0x1f3f9000-0x1f3fdfff]
[ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[ 0.000000] kvm-clock: cpu 0, msr 0:1f3f5001, boot clock
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x00001000-0x00ffffff]
[ 0.000000] DMA32 [mem 0x01000000-0xffffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00001000-0x0009efff]
[ 0.000000] node 0: [mem 0x00100000-0x1f3fdfff]
[ 0.000000] SFI: Simple Firmware Interface v0.81
http://simplefirmware.org
[ 0.000000] Intel MultiProcessor Specification v1.4
[ 0.000000] MPTABLE: OEM ID: BOCHSCPU
[ 0.000000] MPTABLE: Product ID: 0.1
[ 0.000000] MPTABLE: APIC at: 0xFEE00000
[ 0.000000] Processor #0 (Bootup-CPU)
[ 0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI
0-23
[ 0.000000] Processors: 1
[ 0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[ 0.000000] e820: [mem 0x1f400000-0xfeffbfff] available for PCI devices
[ 0.000000] Booting paravirtualized kernel on KVM
[ 0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256
nr_cpu_ids:1 nr_node_ids:1
[ 0.000000] PERCPU: Embedded 29 pages/cpu @ffff88001f000000 s86720
r8192 d23872 u2097152
[ 0.000000] kvm-clock: cpu 0, msr 0:1f3f5001, primary cpu clock
[ 0.000000] KVM setup async PF for cpu 0
[ 0.000000] kvm-stealtime: cpu 0, msr 1f00df80
[ 0.000000] Built 1 zonelists in Node order, mobility grouping on.
Total pages: 125879
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: panic=1 console=ttyS0
udevtimeout=600 no_timer_check acpi=off printk.time=1
cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=xterm
[ 0.000000] Disabling memory control group subsystem
[ 0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.000000] Checking aperture...
[ 0.000000] No AGP bridge found
[ 0.000000] Memory: 485468K/511600K available (7141K kernel code,
1082K rwdata, 3260K rodata, 1364K init, 1420K bss, 26132K reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] \tRCU dyntick-idle grace-period acceleration is enabled.
[ 0.000000] \tRCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.
[ 0.000000] \tOffload RCU callbacks from all CPUs
[ 0.000000] \tOffload RCU callbacks from CPUs: 0-255.
[ 0.000000] NR_IRQS:16640 nr_irqs:256 16
[ 0.000000] Console: colour *CGA 80x25
[ 0.000000] console [ttyS0] enabled
[ 0.000000] tsc: Detected 2925.980 MHz processor
[ 0.008000] Calibrating delay loop (skipped) preset value.. 5851.96
BogoMIPS (lpj=11703920)
[ 0.008000] pid_max: default: 32768 minimum: 301
[ 0.008000] Security Framework initialized
[ 0.008000] AppArmor: AppArmor initialized
[ 0.008000] Yama: becoming mindful.
[ 0.008000] Dentry cache hash table entries: 65536 (order: 7, 524288
bytes)
[ 0.008000] Inode-cache hash table entries: 32768 (order: 6, 262144
bytes)
[ 0.008048] Mount-cache hash table entries: 256
[ 0.008676] Initializing cgroup subsys memory
[ 0.009130] Initializing cgroup subsys devices
[ 0.009535] Initializing cgroup subsys freezer
[ 0.009968] Initializing cgroup subsys blkio
[ 0.010357] Initializing cgroup subsys perf_event
[ 0.010780] Initializing cgroup subsys hugetlb
[ 0.011277] mce: CPU supports 10 MCE banks
[ 0.011693] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.011693] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.011693] tlb_flushall_shift: 6
[ 0.023389] Freeing SMP alternatives memory: 28K (ffffffff81e65000 -
ffffffff81e6c000)
[ 0.029947] ftrace: allocating 27796 entries in 109 pages
[ 0.044307] Enabling x2apic
[ 0.044680] Enabled x2apic
[ 0.048005] Switched APIC routing to physical x2apic.
[ 0.049493] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.050050] smpboot: CPU0: Intel(R) Core(TM) i3 CPU 530 @
2.93GHz (fam: 06, model: 25, stepping: 02)
[ 0.156031] Performance Events: 16-deep LBR, Westmere events, Intel
PMU driver.
[ 0.157079] perf_event_intel: CPUID marked event: 'bus cycles'
unavailable
[ 0.157703] ... version: 2
[ 0.158055] ... bit width: 48
[ 0.158421] ... generic registers: 4
[ 0.158795] ... value mask: 0000ffffffffffff
[ 0.159252] ... max period: 000000007fffffff
[ 0.159779] ... fixed-purpose events: 3
[ 0.160002] ... event mask: 000000070000000f
[ 0.165221] Brought up 1 CPUs
[ 0.165555] smpboot: Total of 1 processors activated (5851.96 BogoMIPS)
[ 0.166391] NMI watchdog: enabled on all CPUs, permanently consumes
one hw-PMU counter.
[ 0.167374] devtmpfs: initialized
[ 0.168714] EVM: security.selinux
[ 0.169053] EVM: security.SMACK64
[ 0.169358] EVM: security.capability
[ 0.170548] regulator-dummy: no parameters
[ 0.171022] RTC time: 7:03:25, date: 11/07/13
[ 0.171484] NET: Registered protocol family 16
[ 0.172250] PCI: Using configuration type 1 for base access
[ 0.173410] bio: create slab <bio-0> at 0
[ 0.173914] ACPI: Interpreter disabled.
[ 0.174324] vgaarb: loaded
[ 0.174714] SCSI subsystem initialized
[ 0.175138] usbcore: registered new interface driver usbfs
[ 0.175656] usbcore: registered new interface driver hub
[ 0.176018] usbcore: registered new device driver usb
[ 0.176550] PCI: Probing PCI hardware
[ 0.176912] PCI host bridge to bus 0000:00
[ 0.177321] pci_bus 0000:00: root bus resource [io 0x0000-0xffff]
[ 0.177885] pci_bus 0000:00: root bus resource [mem
0x00000000-0xffffffffff]
[ 0.178511] pci_bus 0000:00: No busn resource found for root bus,
will use [bus 00-ff]
[ 0.184240] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by
PIIX4 ACPI
[ 0.184932] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by
PIIX4 SMB
[ 0.200355] pci 0000:00:01.0: PIIX/ICH IRQ router [8086:7000]
[ 0.201073] NetLabel: Initializing
[ 0.201390] NetLabel: domain hash size = 128
[ 0.201782] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.202235] NetLabel: unlabeled traffic allowed by default
[ 0.202805] Switched to clocksource kvm-clock
[ 0.207935] AppArmor: AppArmor Filesystem Enabled
[ 0.208514] pnp: PnP ACPI: disabled
[ 0.209881] NET: Registered protocol family 2
[ 0.210462] TCP established hash table entries: 4096 (order: 4, 65536
bytes)
[ 0.211122] TCP bind hash table entries: 4096 (order: 4, 65536 bytes)
[ 0.211723] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.212329] TCP: reno registered
[ 0.212637] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.213159] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.213756] NET: Registered protocol family 1
[ 0.214156] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 0.214695] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[ 0.215220] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 0.215859] Trying to unpack rootfs image as initramfs...
[ 0.217675] Freeing initrd memory: 1256K (ffff88001f2b5000 -
ffff88001f3ef000)
[ 0.218484] platform rtc_cmos: registered platform RTC device (no PNP
device found)
[ 0.219205] Scanning for low memory corruption every 60 seconds
[ 0.219969] Initialise module verification
[ 0.220437] audit: initializing netlink socket (disabled)
[ 0.220944] type=2000 audit(1383807805.519:1): initialized
[ 0.242056] bounce pool size: 64 pages
[ 0.242480] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[ 0.244045] zbud: loaded
[ 0.244448] VFS: Disk quotas dquot_6.5.2
[ 0.244848] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.245918] fuse init (API version 7.22)
[ 0.246366] msgmni has been set to 950
[ 0.247103] Key type asymmetric registered
[ 0.247481] Asymmetric key parser 'x509' registered
[ 0.247948] Block layer SCSI generic (bsg) driver version 0.4 loaded
(major 252)
[ 0.248667] io scheduler noop registered
[ 0.249027] io scheduler deadline registered (default)
[ 0.249512] io scheduler cfq registered
[ 0.249930] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.250448] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[ 0.251236] virtio-pci 0000:00:02.0: PCI->APIC IRQ transform: INT A
-> IRQ 34
[ 0.253633] virtio-pci 0000:00:03.0: PCI->APIC IRQ transform: INT A
-> IRQ 35
[ 0.254954] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[ 0.276810] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.278411] Linux agpgart interface v0.103
[ 0.279988] brd: module loaded
[ 0.280934] loop: module loaded
[ 0.282394] scsi0 : ata_piix
[ 0.282763] scsi1 : ata_piix
[ 0.283061] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc060 irq 14
[ 0.283666] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc068 irq 15
[ 0.284704] libphy: Fixed MDIO Bus: probed
[ 0.285156] tun: Universal TUN/TAP device driver, 1.6
[ 0.285614] tun: (C) 1999-2004 Max Krasnyansky <maxk(a)qualcomm.com>
[ 0.286210] PPP generic driver version 2.4.2
[ 0.286647] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.287232] ehci-pci: EHCI PCI platform driver
[ 0.287645] ehci-platform: EHCI generic platform driver
[ 0.288306] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.288899] ohci-platform: OHCI generic platform driver
[ 0.289374] uhci_hcd: USB Universal Host Controller Interface driver
[ 0.289978] i8042: PNP: No PS/2 controller found. Probing ports directly.
[ 0.291158] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 0.291631] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 0.292188] mousedev: PS/2 mouse device common for all mice
[ 0.292925] input: AT Translated Set 2 keyboard as
/devices/platform/i8042/serio0/input/input0
[ 0.294082] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[ 0.294715] rtc_cmos rtc_cmos: alarms up to one day, 114 bytes nvram
[ 0.295333] device-mapper: uevent: version 1.0.3
[ 0.295806] device-mapper: ioctl: 4.25.0-ioctl (2013-06-26)
initialised: dm-devel(a)redhat.com
[ 0.296604] cpuidle: using governor ladder
[ 0.296973] cpuidle: using governor menu
[ 0.297335] ledtrig-cpu: registered to indicate activity on CPUs
[ 0.297971] TCP: cubic registered
[ 0.298381] NET: Registered protocol family 10
[ 0.298971] NET: Registered protocol family 17
[ 0.299381] Key type dns_resolver registered
[ 0.299950] Loading module verification certificates
[ 0.301270] MODSIGN: Loaded cert 'Magrathea: Glacier signing key:
fddf6943d8ac4f5b6eb0919a7a3ee3d9088b1bfa'
[ 0.302199] registered taskstats version 1
[ 0.302769] Key type trusted registered
[ 0.303281] Key type encrypted registered
[ 0.303810] AppArmor: AppArmor sha1 policy hashing enabled
[ 0.304501] Magic number: 5:808:65
[ 0.304927] rtc_cmos rtc_cmos: setting system clock to 2013-11-07
07:03:25 UTC (1383807805)
[ 0.305708] BIOS EDD facility v0.16 2004-Jun-25, 0 devices found
[ 0.306250] EDD information not available.
[ 0.445036] Freeing unused kernel memory: 1364K (ffffffff81d10000 -
ffffffff81e65000)
[ 0.445844] Write protecting the kernel read-only data: 12288k
[ 0.448284] Freeing unused kernel memory: 1040K (ffff8800016fc000 -
ffff880001800000)
[ 0.450464] Freeing unused kernel memory: 836K (ffff880001b2f000 -
ffff880001c00000)
supermin: mounting /proc
supermin: uptime: 0.45 0.18
supermin: ext2 mini initrd starting up: 4.1.1
supermin: cmdline: panic=1 console=ttyS0 udevtimeout=600 no_timer_check
acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0
guestfs_verbose=1 TERM=xterm
supermin: mounting /sys
supermin: internal insmod libcrc32c.ko
[ 0.453725] libcrc32c: module verification failed: signature and/or
required key missing - tainting kernel
supermin: internal insmod crc32-pclmul.ko
[ 0.455033] PCLMULQDQ-NI instructions are not detected.
insmod: init_module: crc32-pclmul.ko: No such device
supermin: internal insmod crct10dif-pclmul.ko
insmod: init_module: crct10dif-pclmul.ko: No such device
supermin: internal insmod crc-itu-t.ko
supermin: internal insmod crc32.ko
supermin: internal insmod crc-ccitt.ko
supermin: internal insmod crc7.ko
supermin: internal insmod crc8.ko
supermin: internal insmod sym53c8xx.ko
supermin: internal insmod sparse-keymap.ko
supermin: internal insmod ideapad-laptop.ko
insmod: init_module: ideapad-laptop.ko: No such device
supermin: internal insmod virtio_mmio.ko
supermin: internal insmod virtio_balloon.ko
supermin: internal insmod virtio-rng.ko
supermin: internal insmod virtio_console.ko
supermin: internal insmod virtio_scsi.ko
[ 0.515226] scsi2 : Virtio SCSI HBA
[ 0.517909] scsi 2:0:0:0: Direct-Access QEMU QEMU HARDDISK
1.5. PQ: 0 ANSI: 5
[ 0.518883] scsi 2:0:1:0: Direct-Access QEMU QEMU HARDDISK
1.5. PQ: 0 ANSI: 5
[ 0.537501] sd 2:0:0:0: Attached scsi generic sg0 type 0
[ 0.538043] sd 2:0:0:0: [sda] 204800 512-byte logical blocks: (104
MB/100 MiB)
[ 0.538958] sd 2:0:0:0: [sda] Write Protect is off
[ 0.539496] sd 2:0:1:0: [sdb] 8388608 512-byte logical blocks: (4.29
GB/4.00 GiB)
[ 0.540278] sd 2:0:0:0: [sda] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
[ 0.541163] sd 2:0:1:0: Attached scsi generic sg1 type 0
[ 0.541873] sd 2:0:1:0: [sdb] Write Protect is off
[ 0.542401] sd 2:0:1:0: [sdb] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
[ 0.544680] sda: unknown partition table
[ 0.545413] sdb: unknown partition table
[ 0.546278] sd 2:0:0:0: [sda] Attached SCSI disk
[ 0.546761] sd 2:0:1:0: [sdb] Attached SCSI disk
supermin: internal insmod ext2.ko
supermin: picked /sys/block/sdb/dev as root device
supermin: creating /dev/root as block special 8:16
supermin: mounting new root on /root
supermin: chroot
execl: /init: No such file or directory
supermin: debug: listing directory /
2 d . 040755 4096 0:0
2 d .. 040755 4096 0:0
11 d lost+found 040700 16384 0:0
12 d bin 040755 4096 1001:1001
13 d boot 040755 4096 1001:1001
14 d dev 040755 4096 1001:1001
15 d etc 040755 4096 1001:1001
371 d home 040755 4096 1001:1001
372 d lib 040755 4096 1001:1001
404 d lib64 040755 4096 1001:1001
405 d mnt 040755 4096 1001:1001
406 d proc 040755 4096 1001:1001
407 d root 040700 4096 1001:1001
408 d run 040755 4096 1001:1001
409 d sbin 040755 4096 1001:1001
410 d sys 040755 4096 1001:1001
411 d tmp 040777 4096 1001:1001
412 d usr 040755 4096 1001:1001
1124 d var 040755 4096 1001:1001
6442 - init 100775 4207 1001:1001
supermin: debug: listing directory /bin
12 d . 040755 4096 1001:1001
2 d .. 040755 4096 0:0
1157 - bash 100755 959168 0:0
1158 - bunzip2 100755 31152 0:0
1159 - bzcat 100755 31152 0:0
1160 l bzcmp 120777 6 0:0 -> bzdiff
1161 - bzdiff 100755 2140 0:0
1162 l bzegrep 120777 6 0:0 -> bzgrep
1163 - bzexe 100755 4877 0:0
1164 l bzfgrep 120777 6 0:0 -> bzgrep
1165 - bzgrep 100755 3642 0:0
1166 - bzip2 100755 31152 0:0
1167 - bzip2recover 100755 10376 0:0
1168 l bzless 120777 6 0:0 -> bzmore
1169 - bzmore 100755 1297 0:0
1170 - cat 100755 47912 0:0
1171 - chacl 100755 14688 0:0
1172 - chgrp 100755 60176 0:0
1173 - chmod 100755 56048 0:0
1174 - chown 100755 60176 0:0
1175 - chvt 100755 10480 0:0
1176 - cp 100755 130312 0:0
1177 - cpio 100755 137272 0:0
1178 - dash 100755 105712 0:0
1179 - date 100755 64272 0:0
1180 - dd 100755 56144 0:0
1181 - df 100755 93208 0:0
1182 - dir 100755 110088 0:0
1183 - dmesg 100755 22896 0:0
1184 - dumpkeys 100755 82256 0:0
1185 - echo 100755 31312 0:0
1186 - egrep 100755 179568 0:0
1187 - false 100755 27184 0:0
1188 - fgconsole 100755 10488 0:0
1189 - fgrep 100755 134256 0:0
1190 - findmnt 100755 36144 0:0
1191 - fuser 100755 31864 0:0
1192 - fusermount 104755 30800 0:0
1193 - getfacl 100755 23688 0:0
1194 - grep 100755 187792 0:0
1195 - gunzip 100755 2303 0:0
1196 - gzexe 100755 5937 0:0
1197 - gzip 100755 94048 0:0
1198 - ip 100755 294912 0:0
1199 - kbd_mode 100755 10480 0:0
1200 - kill 100755 23056 0:0
1201 - kmod 100755 85208 0:0
1202 - less 100755 153664 0:0
1203 - lessecho 100755 10440 0:0
1204 l lessfile 120777 8 0:0 -> lesspipe
1205 - lesskey 100755 15912 0:0
1206 - lesspipe 100755 7758 0:0
1207 - ln 100755 51984 0:0
1208 - loadkeys 100755 111432 0:0
1209 - lowntfs-3g 100755 63912 0:0
1210 - ls 100755 110088 0:0
1211 - lsblk 100755 44688 0:0
1212 l lsmod 120777 4 0:0 -> kmod
1213 - mkdir 100755 51952 0:0
1214 - mknod 100755 35472 0:0
1215 - mktemp 100755 39664 0:0
1216 - more 100755 39600 0:0
1217 - mount 104755 94792 0:0
1218 - mountpoint 100755 10456 0:0
1219 - mt-gnu 100755 68760 0:0
1220 - mv 100755 122096 0:0
1221 - ntfs-3g 100755 59848 0:0
1222 - ntfs-3g.probe 100755 10312 0:0
1223 - ntfs-3g.secaudit 100755 71704 0:0
1224 - ntfs-3g.usermap 100755 18432 0:0
1225 - ntfscat 100755 26728 0:0
1226 - ntfsck 100755 30752 0:0
1227 - ntfscluster 100755 30824 0:0
1228 - ntfscmp 100755 34920 0:0
1229 - ntfsdump_logfile 100755 22528 0:0
1230 - ntfsfix 100755 39024 0:0
1231 - ntfsinfo 100755 55416 0:0
1232 - ntfsls 100755 31928 0:0
1233 - ntfsmftalloc 100755 26672 0:0
1234 - ntfsmove 100755 30824 0:0
1235 - ntfstruncate 100755 38952 0:0
1236 - ntfswipe 100755 43632 0:0
1237 l open 120777 6 0:0 -> openvt
1238 - openvt 100755 18912 0:0
1239 l pidof 120777 14 0:0 -> /sbin/killall5
1240 - ps 100755 89136 0:0
1241 - pwd 100755 31400 0:0
1242 l rbash 120777 4 0:0 -> bash
1243 - readlink 100755 39536 0:0
1244 - rm 100755 60168 0:0
1245 - rmdir 100755 43664 0:0
1246 - run-parts 100755 19248 0:0
1247 - running-in-container 100755 254 0:0
1248 - sed 100755 73352 0:0
1249 - setfacl 100755 36232 0:0
1250 - setfont 100755 39896 0:0
1251 - setupcon 100755 12052 0:0
1252 l sh 120777 4 0:0 -> dash
1253 - sleep 100755 31312 0:0
1254 - ss 100755 76624 0:0
1255 - stty 100755 68272 0:0
1256 - sync 100755 27216 0:0
1257 - tailf 100755 14720 0:0
1258 - tar 100755 307808 0:0
1259 - tempfile 100755 10344 0:0
1260 - touch 100755 60240 0:0
1261 - true 100755 27184 0:0
1262 - udevadm 100755 248040 0:0
1263 - ulockmgr_server 100755 14336 0:0
1264 - umount 104755 69120 0:0
1265 - uname 100755 31376 0:0
1266 - uncompress 100755 2303 0:0
1267 - unicode_start 100755 2762 0:0
1268 - vdir 100755 110096 0:0
1269 - which 100755 946 0:0
1270 - zcat 100755 1939 0:0
1271 - zcmp 100755 1779 0:0
1272 - zdiff 100755 5766 0:0
1273 - zegrep 100755 142 0:0
1274 - zfgrep 100755 142 0:0
1275 - zforce 100755 2133 0:0
1276 - zgrep 100755 5940 0:0
1277 - zless 100755 2039 0:0
1278 - zmore 100755 1912 0:0
1279 - znew 100755 5049 0:0
supermin: debug: listing directory /lib
372 d . 040755 4096 1001:1001
2 d .. 040755 4096 0:0
373 d crda 040755 4096 1001:1001
375 d cryptsetup 040755 4096 1001:1001
378 d firmware 040755 4096 1001:1001
389 d init 040755 4096 1001:1001
390 d lsb 040755 4096 1001:1001
392 d modprobe.d 040755 4096 1001:1001
393 d modules 040755 4096 1001:1001
394 d modules-load.d 040755 4096 1001:1001
395 d systemd 040755 4096 1001:1001
399 d udev 040755 4096 1001:1001
402 d x86_64-linux-gnu 040755 4096 1001:1001
1337 - klibc-dv6iJxsMLkI8yu6xMVSFDIuVsJk.so 100755 71528 0:0
1338 l libcryptsetup.so.4 120777 22 0:0 -> libcryptsetup.so.4.2.0
1339 - libcryptsetup.so.4.2.0 100644 101232 0:0
supermin: debug: listing directory /lib64
404 d . 040755 4096 1001:1001
2 d .. 040755 4096 0:0
1608 l ld-linux-x86-64.so.2 120777 10 0:0 -> ld-2.17.so
[ 0.611872] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000100
[ 0.611872]
[ 0.612905] Rebooting in 1 seconds..libguestfs: error: appliance
closed the connection unexpectedly, see earlier error messages
libguestfs: child_cleanup: 0x8c68d0: child process died
libguestfs: sending SIGTERM to process 23946
libguestfs: error: guestfs_launch failed, see earlier error messages
libguestfs-test-tool: failed to launch appliance
libguestfs: closing guestfs handle 0x8c68d0 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf
/home/ofrommel/libguestfs-1.24.1/tmp/libguestfsC8azDe
--------------------------------------------------------------------
It looks like "init" is missing, but I wouldn't know as the image gets
deleted after creation. Is there a way to stop libguestfs tools from
doing that?
BTW: the tools *do* require root access when running on Ubuntu because
it (the distro) has the kernel images readable only for root. I
understand that this is not libguestfs's fault, just sayin'...
Thanks for any help.
Best
Oliver
11 years
virt-resize problem for Windows 2003
by Xinglong Wu
Hi,
I'm using virt-resize to expand the primary partition (C:) in a
Windows 2003 image. The command works fine but after expanding, when I boot
into Windows 2003, all the other partitions (D:, E:, and F:) are lost.
After using the disk management tool within Windows 2003, I can re-label
the above three partitions and all the files are still there. But it is
really annoying because every time you have to do some work by hand after
expanding the disk size. As below is the details:
Host OS: RHEL6.3
libguestfs: libguestfs-1.16.19-1.el6.x86_64
libguestfs-tools-c-1.16.19-1.el6.x86_64
libguestfs-winsupport-1.0-7.el6.x86_64
Guest OS partitions:
C: /dev/sda1 primary
D: /dev/sda5 logical
E: /dev/sda6 logical
F: /dev/sda7 logical
Also, if I use virt-resize on logical partitions (i.e., D: E: or F:), the
command runs fine but logical partitions don't actually expand. Exactly the
same problem as descripted above shows up, and now, these logical
partitions don't even change their sizes. Any suggestions?
Xinglong
11 years
[libguestfs] Problem using virt-sysprep with RBD images
by Jon
Hello,
I'm having a problem when trying to use virt-sysprep against vms that have
rbd disk images. When I run virt-sysprep I get the following error:
>> root@kitt:~/libguestfs-1.22.4# virt-sysprep -d server-clone-test
--firstboot firstboot.sh
>> Examining the guest ...
>> Fatal error: exception Guestfs.Error("rbd: image name must begin with a
'/'")
My Disk definition is as follows:
>> <disk type='network' device='disk'>
>> <driver name='qemu'/>
>> <source protocol='rbd' name='libvirt-pool/server-clone-test'>
>> <host name='192.168.0.40' port='6789'/>
>> <host name='192.168.0.35' port='6789'/>
>> <host name='192.168.0.2' port='6789'/>
>> </source>
>> <target dev='hdb' bus='ide'/>
>> <address type='drive' controller='0' bus='0' target='0' unit='1'/>
>> </disk>
I can resolve this error by changing the name of the libvirt-pool:
>> <source protocol='rbd' name='/libvirt-pool/server-clone-test'>
But this causes an error when attempting to boot the vm:
>> root@kitt:~/libguestfs-1.22.4# virsh start server-clone-test
>> error: Failed to start domain server-clone-test
>> error: internal error: process exited while connecting to monitor: W:
kvm binary is deprecated, please use qemu-system-x86_64 instead
>> char device redirected to /dev/pts/5 (label charserial0)
>> qemu-system-x86_64: -drive
file=rbd:/libvirt-pool/server-clone-test:auth_supported=none:mon_host=192.168.0.40\:6789\;192.168.0.35\:6789\;192.168.0.2\:6789,if=none,id=drive-ide0-0-1:
pool name too short
>> qemu-system-x86_64: -drive
file=rbd:/libvirt-pool/server-clone-test:auth_supported=none:mon_host=192.168.0.40\:6789\;192.168.0.35\:6789\;192.168.0.2\:6789,if=none,id=drive-ide0-0-1:
could not open disk image
rbd:/libvirt-pool/server-clone-test:auth_supported=none:mon_host=192.168.0.40\:6789\;192.168.0.35\:6789\;192.168.0.2\:6789:
Invalid argument
I'm currently using libguestfs-1.22.4 and I did run into a known bug [1]
that I was able to patch, but I don't think that's related to the issues
with disk naming.
Is there a way to give virt-sysprep a rbd with the -a flag, or is there a
better way to sysprep vms? I would like to avoid having to edit the vm
config if possible.
Thanks,
Jon A
[1] https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1243190
11 years
[PATCH 0/4] virt-v2v: Convert RedHat.pm to Linux.pm
by Mike Latimer
In preparation for an upcoming patch which adds support for SUSE guest
conversions, it makes sense to have an intermediate steps that changes the
RedHat.pm converter into a more generic Linux converter. The SUSE changes
will then be limited in scope to only what is required for SUSE support.
This series of patches accomplishes the following:
- Renames RedHat.pm to Linux.pm
- Modifies Linux.pm to be more generic, and ready for additional distribution
support (such as SUSE)
- Adds functionality to _remap_block_devices, to ensure root and resume
devices are updated in both grub legacy and grub2 environments
- Allows for qxl or cirrus settings in LibVirtTarget.pm (based on passing
guestcaps->{display} from the conversion.
I'll submit the SUSE-specific changes after we work through any issues raised
here.
Mike Latimer (4):
Rename RedHat.pm to Linux.pm
Make Linux.pm more generic
Handle block remaps in grub and grub2 files
Support multiple display types through guestcaps
MANIFEST | 2 +-
lib/Sys/VirtConvert/Connection/LibVirtTarget.pm | 14 +-
.../VirtConvert/Converter/{RedHat.pm => Linux.pm} | 225 ++++++++++++++++-----
po/POTFILES.in | 2 +-
4 files changed, 185 insertions(+), 58 deletions(-)
rename lib/Sys/VirtConvert/Converter/{RedHat.pm => Linux.pm} (92%)
--
1.8.1.4
11 years
Request to relicense hash gnulib module to LGPLv2+
by Richard W.M. Jones
libguestfs (an LGPLv2+ library) uses the 'hash' module, which turns
out to be "GPL".
Actually this happened because we started to use it in a separate
GPL'd utility program, but later on included this functionality in the
core library, copying the same code from the utility but not checking
the license of 'hash'.
We'd therefore like to request that 'hash' is relicensed as LGPLv2+.
If this is not possible, we will have to rewrite the code, probably
implementing our own hash table, which would be a shame because hash
works well for our needs.
Notes:
- the code doesn't appear to call exit (it does call abort), and so
seems to be suitable for a library
- hash-pjw which we also use is already licensed as LGPLv2+
- it looks like the original author was Jim Meyering (CC'd)
- the dependencies are all LGPLv2+
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
11 years
[PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
by Nikos Skalkotos
The device name prefix for IDE hard drives used to be `ad' but now
is `ada' (http://www.freebsd.org/doc/handbook/disks-naming.html).
For virtio hard drives it is `vtbd'.
Under an MBR partition table a slice will be used, so the name of
the first partitions will be either `ada0s1a' or `vtbd0s1a'. Under a
GPT partition table, where no slice is needed, the name of the first
partition will be either `ada0p1' or `vtbd0p1'.
Signed-off-by: Nikos Skalkotos <skalkoto(a)grnet.gr>
---
src/guestfs-internal.h | 2 ++
src/inspect-fs-unix.c | 27 +++++++++++++++++++++++----
src/match.c | 25 +++++++++++++++++++++++++
3 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 9936c84..5356920 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -630,12 +630,14 @@ extern int guestfs___match (guestfs_h *g, const char *str, const pcre *re);
extern char *guestfs___match1 (guestfs_h *g, const char *str, const pcre *re);
extern int guestfs___match2 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2);
extern int guestfs___match3 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3);
+extern int guestfs___match4 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3, char **ret4);
extern int guestfs___match6 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3, char **ret4, char **ret5, char **ret6);
#define match guestfs___match
#define match1 guestfs___match1
#define match2 guestfs___match2
#define match3 guestfs___match3
+#define match4 guestfs___match4
#define match6 guestfs___match6
/* stringsbuf.c */
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 60b081d..8e0f135 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -64,7 +64,8 @@ static pcre *re_major_minor;
static pcre *re_xdev;
static pcre *re_cciss;
static pcre *re_mdN;
-static pcre *re_freebsd;
+static pcre *re_freebsd_mbr;
+static pcre *re_freebsd_gpt;
static pcre *re_diskbyid;
static pcre *re_netbsd;
static pcre *re_opensuse;
@@ -115,7 +116,8 @@ compile_regexps (void)
COMPILE (re_xdev, "^/dev/(h|s|v|xv)d([a-z]+)(\\d*)$", 0);
COMPILE (re_cciss, "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$", 0);
COMPILE (re_mdN, "^(/dev/md\\d+)$", 0);
- COMPILE (re_freebsd, "^/dev/ad(\\d+)s(\\d+)([a-z])$", 0);
+ COMPILE (re_freebsd_mbr, "^/dev/(ada{0,1}|vtbd)(\\d+)s(\\d+)([a-z])$", 0);
+ COMPILE (re_freebsd_gpt, "^/dev/(ada{0,1}|vtbd)(\\d+)p(\\d+)$", 0);
COMPILE (re_diskbyid, "^/dev/disk/by-id/.*-part(\\d+)$", 0);
COMPILE (re_netbsd, "^NetBSD (\\d+)\\.(\\d+)", 0);
COMPILE (re_opensuse, "^(openSUSE|SuSE Linux|SUSE LINUX) ", 0);
@@ -143,7 +145,8 @@ free_regexps (void)
pcre_free (re_xdev);
pcre_free (re_cciss);
pcre_free (re_mdN);
- pcre_free (re_freebsd);
+ pcre_free (re_freebsd_mbr);
+ pcre_free (re_freebsd_gpt);
pcre_free (re_diskbyid);
pcre_free (re_netbsd);
pcre_free (re_opensuse);
@@ -1464,7 +1467,22 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
free (disk);
}
- else if (match3 (g, spec, re_freebsd, &disk, &slice, &part)) {
+ else if (match3 (g, spec, re_freebsd_gpt, &type, &disk, &part)) {
+ /* If the FreeBSD disk contains GPT partitions, the translation to Linux
+ * device names is straight forward. Partitions on a virtio disk are
+ * prefixed with vtbd. IDE hard drives used to be prefixed with ad and now
+ * are with ada.
+ */
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ int part_i = guestfs___parse_unsigned_int (g, part);
+ free (type);
+ free (disk);
+ free (part);
+
+ if (disk_i != -1 && disk_i <= 26 && part_i > 0 && part_i <= 128)
+ device = safe_asprintf (g, "/dev/sd%c%d", disk_i + 'a', part_i);
+ }
+ else if (match4 (g, spec, re_freebsd_mbr, &type, &disk, &slice, &part)) {
/* FreeBSD disks are organized quite differently. See:
* http://www.freebsd.org/doc/handbook/disk-organization.html
* FreeBSD "partitions" are exposed as quasi-extended partitions
@@ -1474,6 +1492,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
int disk_i = guestfs___parse_unsigned_int (g, disk);
int slice_i = guestfs___parse_unsigned_int (g, slice);
int part_i = part[0] - 'a' /* counting from 0 */;
+ free (type);
free (disk);
free (slice);
free (part);
diff --git a/src/match.c b/src/match.c
index 86c0a31..2a3e5a9 100644
--- a/src/match.c
+++ b/src/match.c
@@ -104,6 +104,31 @@ guestfs___match3 (guestfs_h *g, const char *str, const pcre *re,
return 1;
}
+/* Match a regular expression which contains exactly four captures. */
+int
+guestfs___match4 (guestfs_h *g, const char *str, const pcre *re,
+ char **ret1, char **ret2, char **ret3, char **ret4)
+{
+ size_t len = strlen (str);
+ int vec[30], r;
+
+ r = pcre_exec (re, NULL, str, len, 0, 0, vec, 30);
+ if (r == PCRE_ERROR_NOMATCH)
+ return 0;
+
+ *ret1 = NULL;
+ *ret2 = NULL;
+ *ret3 = NULL;
+ *ret4 = NULL;
+
+ if (r > 1) *ret1 = safe_strndup (g, &str[vec[2]], vec[3]-vec[2]);
+ if (r > 2) *ret2 = safe_strndup (g, &str[vec[4]], vec[5]-vec[4]);
+ if (r > 3) *ret3 = safe_strndup (g, &str[vec[6]], vec[7]-vec[6]);
+ if (r > 4) *ret4 = safe_strndup (g, &str[vec[8]], vec[9]-vec[8]);
+
+ return 1;
+}
+
/* Match a regular expression which contains exactly six captures. */
int
guestfs___match6 (guestfs_h *g, const char *str, const pcre *re,
--
1.8.4.2
11 years
[PATCH stable-1.24] Fix fstab block device resolution for FreeBSD
by Nikos Skalkotos
The device name prefix for IDE hard drives used to be `ad' but now
is `ada' (http://www.freebsd.org/doc/handbook/disks-naming.html).
For virtio hard drives it is `vtbd'.
Under an mbr partition table a slice will be used, so the name of
the first partitions will be either ada0s1a or vtbd0s1a. Under a
GPT partition table, where no slice is needed, the name of the first
partition will be either ada0p1 or vtbd0p1.
Signed-off-by: Nikos Skalkotos <skalkoto(a)grnet.gr>
---
src/guestfs-internal.h | 2 ++
src/inspect-fs-unix.c | 30 +++++++++++++++++++++++++-----
src/match.c | 25 +++++++++++++++++++++++++
3 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 9936c84..5356920 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -630,12 +630,14 @@ extern int guestfs___match (guestfs_h *g, const char *str, const pcre *re);
extern char *guestfs___match1 (guestfs_h *g, const char *str, const pcre *re);
extern int guestfs___match2 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2);
extern int guestfs___match3 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3);
+extern int guestfs___match4 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3, char **ret4);
extern int guestfs___match6 (guestfs_h *g, const char *str, const pcre *re, char **ret1, char **ret2, char **ret3, char **ret4, char **ret5, char **ret6);
#define match guestfs___match
#define match1 guestfs___match1
#define match2 guestfs___match2
#define match3 guestfs___match3
+#define match4 guestfs___match4
#define match6 guestfs___match6
/* stringsbuf.c */
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 60b081d..6addb43 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -64,7 +64,8 @@ static pcre *re_major_minor;
static pcre *re_xdev;
static pcre *re_cciss;
static pcre *re_mdN;
-static pcre *re_freebsd;
+static pcre *re_freebsd_mbr;
+static pcre *re_freebsd_gpt;
static pcre *re_diskbyid;
static pcre *re_netbsd;
static pcre *re_opensuse;
@@ -115,7 +116,8 @@ compile_regexps (void)
COMPILE (re_xdev, "^/dev/(h|s|v|xv)d([a-z]+)(\\d*)$", 0);
COMPILE (re_cciss, "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$", 0);
COMPILE (re_mdN, "^(/dev/md\\d+)$", 0);
- COMPILE (re_freebsd, "^/dev/ad(\\d+)s(\\d+)([a-z])$", 0);
+ COMPILE (re_freebsd_mbr, "^/dev/(ada{0,1}|vtbd)(\\d+)s(\\d+)([a-z])$", 0);
+ COMPILE (re_freebsd_gpt, "^/dev/(ada{0,1}|vtbd)(\\d+)p(\\d+)$", 0);
COMPILE (re_diskbyid, "^/dev/disk/by-id/.*-part(\\d+)$", 0);
COMPILE (re_netbsd, "^NetBSD (\\d+)\\.(\\d+)", 0);
COMPILE (re_opensuse, "^(openSUSE|SuSE Linux|SUSE LINUX) ", 0);
@@ -143,7 +145,8 @@ free_regexps (void)
pcre_free (re_xdev);
pcre_free (re_cciss);
pcre_free (re_mdN);
- pcre_free (re_freebsd);
+ pcre_free (re_freebsd_mbr);
+ pcre_free (re_freebsd_gpt);
pcre_free (re_diskbyid);
pcre_free (re_netbsd);
pcre_free (re_opensuse);
@@ -1464,13 +1467,30 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
free (disk);
}
- else if (match3 (g, spec, re_freebsd, &disk, &slice, &part)) {
+ else if (match3 (g, spec, re_freebsd_gpt, &type, &disk, &part)) {
+ /* If the FreeBSD disk contains GPT partitions, the translation to Linux
+ * device names is straight forward. Partitions on a virtio disk are
+ * prefixed with vtbd. IDE hard drives used to be prefixed with ad and now
+ * are with ada.
+ */
+ char type_c = (strcmp (type, "vtbd") == 0) ? 'v' : 's';
+ int disk_i = guestfs___parse_unsigned_int (g, disk);
+ int part_i = guestfs___parse_unsigned_int (g, part);
+ free (type);
+ free (disk);
+ free (part);
+
+ if (disk_i != -1 && disk_i <= 26 && part_i > 0 && part_i <= 128)
+ device = safe_asprintf (g, "/dev/%cd%c%d", type_c, disk_i + 'a', part_i);
+ }
+ else if (match4 (g, spec, re_freebsd_mbr, &type, &disk, &slice, &part)) {
/* FreeBSD disks are organized quite differently. See:
* http://www.freebsd.org/doc/handbook/disk-organization.html
* FreeBSD "partitions" are exposed as quasi-extended partitions
* numbered from 5 in Linux. I have no idea what happens when you
* have multiple "slices" (the FreeBSD term for MBR partitions).
*/
+ char type_c = (strcmp (type, "vtbd") == 0) ? 'v' : 's';
int disk_i = guestfs___parse_unsigned_int (g, disk);
int slice_i = guestfs___parse_unsigned_int (g, slice);
int part_i = part[0] - 'a' /* counting from 0 */;
@@ -1481,7 +1501,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
if (disk_i != -1 && disk_i <= 26 &&
slice_i > 0 && slice_i <= 1 /* > 4 .. see comment above */ &&
part_i >= 0 && part_i < 26) {
- device = safe_asprintf (g, "/dev/sd%c%d", disk_i + 'a', part_i + 5);
+ device = safe_asprintf (g, "/dev/%cd%c%d", type_c, disk_i + 'a', part_i + 5);
}
}
else if ((part = match1 (g, spec, re_diskbyid)) != NULL) {
diff --git a/src/match.c b/src/match.c
index 86c0a31..2a3e5a9 100644
--- a/src/match.c
+++ b/src/match.c
@@ -104,6 +104,31 @@ guestfs___match3 (guestfs_h *g, const char *str, const pcre *re,
return 1;
}
+/* Match a regular expression which contains exactly four captures. */
+int
+guestfs___match4 (guestfs_h *g, const char *str, const pcre *re,
+ char **ret1, char **ret2, char **ret3, char **ret4)
+{
+ size_t len = strlen (str);
+ int vec[30], r;
+
+ r = pcre_exec (re, NULL, str, len, 0, 0, vec, 30);
+ if (r == PCRE_ERROR_NOMATCH)
+ return 0;
+
+ *ret1 = NULL;
+ *ret2 = NULL;
+ *ret3 = NULL;
+ *ret4 = NULL;
+
+ if (r > 1) *ret1 = safe_strndup (g, &str[vec[2]], vec[3]-vec[2]);
+ if (r > 2) *ret2 = safe_strndup (g, &str[vec[4]], vec[5]-vec[4]);
+ if (r > 3) *ret3 = safe_strndup (g, &str[vec[6]], vec[7]-vec[6]);
+ if (r > 4) *ret4 = safe_strndup (g, &str[vec[8]], vec[9]-vec[8]);
+
+ return 1;
+}
+
/* Match a regular expression which contains exactly six captures. */
int
guestfs___match6 (guestfs_h *g, const char *str, const pcre *re,
--
1.8.4.2
11 years