qemu networking done right (qemu bridging with nfsroot)

Jun 26, 2014 21:14

Well, quick and dirty can't go on forever so here's how to configure the qemu networking.

First of all here's a diagram of my network devices:


When I boot my host the host kernel attaches a driver to my hardware nic and I get enp2s0 (ethernet type, pci bus 2 slot 0) interface looking at router. Later systemd-networkd brings up the br0 bridge, enlaves the enp2s0 to it and gets networkd configuration for br0 via DHCP so the interfaces look like this after successful boot:

host # ip a
2: enp2s0: mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether 00:25:22:df:96:61 brd ff:ff:ff:ff:ff:ff
3: br0: mtu 1500 qdisc noqueue state UP group default
link/ether 00:25:22:df:96:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.10/24 brd 192.168.2.255 scope global br0
valid_lft forever preferred_lft forever
Notice the "master br0" at enp2s0 and ipv4 address at br0.

Now the configuration for systemd-networkd looks like this:
host $ find /etc/systemd/network/ -type f -exec echo '{}:' \; -exec cat {} \;
/etc/systemd/network/bridge.network:
[Match]
Name=br0

[Network]
DHCP=yes

/etc/systemd/network/enp2s0.network:
[Match]
Name=enp2s0

[Network]
Bridge=br0

/etc/systemd/network/bridge.netdev:
[NetDev]
Name=br0
Kind=bridge

Now I need the guest kernel:
~ $ mkdir code/nfs-kernel
~ $ cd code/nfs-kernel/
~/code/nfs-kernel $ make -C ~/code/kernel O=${PWD} menuconfig bzImage
Kernel: arch/x86/boot/bzImage is ready (#5)
Hints for guest kernel configuration:
# CONFIG_MODULES is not set
CONFIG_FHANDLE=y (guest systemd will need it for its getty)

And now I need the rootfs:
~/code/nfs-kernel $ mkdir ../nfs-root
~/code/nfs-kernel $ cd ../nfs-root
~/code/nfs-root $ wget https://galileo.mailstation.de/stages/amd64/exherbo-amd64-current.tar.xz
~/code/nfs-root $ sudo tar xf exherbo-amd64-current.tar.xz
~/code/nfs-root $ cd ../nfs-kernel
And then export it via nfsd:
# cat /etc/exports
/home/ivan/code/nfs-root *(rw,no_root_squash)

# systemctl start nfs-server

Ok now I have a bridge interface, kernel and nfsroot. Qemu is going to use the qemu-bridge-helper program to configure the tap interface. So now I'm allowing the qemu-bridge-helper to configure the br0 to enslave the vm's tap interface.
$ cat /etc/qemu/bridge.conf
allow br0
And then allow it to use TUNSETIFF ioctl request on /dev/net/tun to create a tap interface.
# chmod +s /usr/libexec/qemu-bridge-helper

All ready, let's start now:
~/code/nfs-kernel $ qemu-system-x86_64 -nographic -enable-kvm -device e1000,netdev=inet -netdev bridge,id=inet -kernel arch/x86_64/boot/bzImage -append 'console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=1
92.168.2.10:/home/ivan/code/nfs-root,nfsvers=4.1,tcp rw nfsrootdebug'
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.15.2+ (ivan@wildfire) (gcc version 4.8.2 (exherbo gcc-4.8.2-r2) ) #11 SMP Mon Jun 30 14:13:51 EEST 2014
[ 0.000000] Command line: console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=192.168.2.10:/home/ivan/code/nfs-root,nfsvers=4.1,tcp rw nfsrootdebug
[ 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-0x0000000007ffdfff] usable
[ 0.000000] BIOS-e820: [mem 0x0000000007ffe000-0x0000000007ffffff] 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] e820: last_pfn = 0x7ffe max_arch_pfn = 0x400000000
[ 0.000000] x86 PAT enabled: cpu 0, old 0x70406, new 0x7010600070106
[ 0.000000] found SMP MP-table at [mem 0x000f0b50-0x000f0b5f] mapped at [ffff8800000f0b50]
[ 0.000000] Scanning 1 areas for low memory corruption
[ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[ 0.000000] init_memory_mapping: [mem 0x07c00000-0x07dfffff]
[ 0.000000] init_memory_mapping: [mem 0x04000000-0x07bfffff]
[ 0.000000] init_memory_mapping: [mem 0x00100000-0x03ffffff]
[ 0.000000] init_memory_mapping: [mem 0x07e00000-0x07ffdfff]
[ 0.000000] ACPI: RSDP 0x00000000000F09D0 000014 (v00 BOCHS )
[ 0.000000] ACPI: RSDT 0x0000000007FFFBC1 000034 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACP 0x0000000007FFF1C0 000074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
[ 0.000000] ACPI: DSDT 0x0000000007FFE040 001180 (v01 BOCHS BXPCDSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACS 0x0000000007FFE000 000040
[ 0.000000] ACPI: SSDT 0x0000000007FFF234 0008DD (v01 BOCHS BXPCSSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: APIC 0x0000000007FFFB11 000078 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
[ 0.000000] ACPI: HPET 0x0000000007FFFB89 000038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001)
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at [mem 0x0000000000000000-0x0000000007ffdfff]
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x07ffdfff]
[ 0.000000] NODE_DATA [mem 0x07ffa000-0x07ffdfff]
[ 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-0x07ffdfff]
[ 0.000000] ACPI: PM-Timer IO Port: 0xb008
[ 0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[ 0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[ 0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
[ 0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[ 0.000000] Using ACPI (MADT) for SMP configuration information
[ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[ 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 0x08000000-0xfeffbfff] available for PCI devices
[ 0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1
[ 0.000000] PERCPU: Embedded 25 pages/cpu @ffff880007c00000 s79232 r0 d23168 u2097152
[ 0.000000] Built 1 zonelists in Node order, mobility grouping on. Total pages: 32135
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: console=ttyS0 ip=dhcp root=/dev/nfs nfsroot=192.168.2.10:/home/ivan/code/nfs-root,nfsvers=4.1,tcp rw nfsrootdebug
[ 0.000000] PID hash table entries: 512 (order: 0, 4096 bytes)
[ 0.000000] Memory: 113224K/130672K available (7376K kernel code, 819K rwdata, 2300K rodata, 1028K init, 964K bss, 17448K reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS:4352 nr_irqs:256 16
[ 0.000000] Console: colour VGA+ 80x25
[ 0.000000] console [ttyS0] enabled
[ 0.000000] tsc: Fast TSC calibration using PIT
[ 0.000000] tsc: Detected 2994.369 MHz processor
[ 0.003004] Calibrating delay loop (skipped), value calculated using timer frequency.. 5988.73 BogoMIPS (lpj=2994369)
[ 0.004502] pid_max: default: 32768 minimum: 301
[ 0.005012] ACPI: Core revision 20140214
[ 0.007646] ACPI: All ACPI Tables successfully acquired
[ 0.008090] Security Framework initialized
[ 0.009005] SELinux: Initializing.
[ 0.010028] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.011051] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.012028] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.013008] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.014242] Initializing cgroup subsys freezer
[ 0.015079] mce: CPU supports 10 MCE banks
[ 0.016062] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.016062] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[ 0.016062] tlb_flushall_shift: -1
[ 0.029592] Freeing SMP alternatives memory: 28K (ffffffff81dcf000 - ffffffff81dd6000)
[ 0.031998] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.038069] smpboot: CPU0: AMD QEMU Virtual CPU version 2.0.0 (fam: 06, model: 06, stepping: 03)
[ 0.040000] Performance Events: Broken PMU hardware detected, using software events only.
[ 0.040009] Failed to access perfctr msr (MSR c0010001 is ffffffffffffffff)
[ 0.042040] Huh? What family is it: 0x6?!
[ 0.042736] MCE: In-kernel MCE decoding enabled.
[ 0.043004] x86: Booted up 1 node, 1 CPUs
[ 0.044003] smpboot: Total of 1 processors activated (5988.73 BogoMIPS)
[ 0.045461] devtmpfs: initialized
[ 0.046500] RTC time: 11:14:40, date: 06/30/14
[ 0.047056] NET: Registered protocol family 16
[ 0.048161] cpuidle: using governor ladder
[ 0.049005] cpuidle: using governor menu
[ 0.050079] ACPI: bus type PCI registered
[ 0.050853] PCI: Using configuration type 1 for base access
[ 0.053074] kworker/u2:0 (14) used greatest stack depth: 15032 bytes left
[ 0.056611] kworker/u2:0 (16) used greatest stack depth: 14944 bytes left
[ 0.058117] ACPI: Added _OSI(Module Device)
[ 0.058856] ACPI: Added _OSI(Processor Device)
[ 0.059006] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 0.060002] ACPI: Added _OSI(Processor Aggregator Device)
[ 0.063470] ACPI: Interpreter enabled
[ 0.064035] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140214/hwxface-580)
[ 0.065414] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140214/hwxface-580)
[ 0.067391] ACPI: (supports S0 S3 S4 S5)
[ 0.068005] ACPI: Using IOAPIC for interrupt routing
[ 0.069005] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 0.071594] kworker/u2:0 (28) used greatest stack depth: 14848 bytes left
[ 0.074494] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[ 0.075011] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[ 0.076010] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[ 0.078105] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[ 0.079055] PCI host bridge to bus 0000:00
[ 0.079759] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.080009] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7]
[ 0.081026] pci_bus 0000:00: root bus resource [io 0x0d00-0xadff]
[ 0.083016] pci_bus 0000:00: root bus resource [io 0xae0f-0xaeff]
[ 0.084008] pci_bus 0000:00: root bus resource [io 0xaf20-0xafdf]
[ 0.085025] pci_bus 0000:00: root bus resource [io 0xafe4-0xffff]
[ 0.086040] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[ 0.087006] pci_bus 0000:00: root bus resource [mem 0x08000000-0xfebfffff]
[ 0.093301] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7]
[ 0.094003] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6]
[ 0.095002] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177]
[ 0.096002] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376]
[ 0.097511] pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
[ 0.098017] pci 0000:00:01.3: quirk: [io 0xb100-0xb10f] claimed by PIIX4 SMB
[ 0.108852] kworker/u2:0 (42) used greatest stack depth: 14144 bytes left
[ 0.117671] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[ 0.119142] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[ 0.120305] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[ 0.121347] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[ 0.122361] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[ 0.123497] ACPI: Enabled 16 GPEs in block 00 to 0F
[ 0.124149] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[ 0.125005] vgaarb: loaded
[ 0.125482] vgaarb: bridge control possible 0000:00:02.0
[ 0.126088] SCSI subsystem initialized
[ 0.127117] ACPI: bus type USB registered
[ 0.128047] usbcore: registered new interface driver usbfs
[ 0.129021] usbcore: registered new interface driver hub
[ 0.130071] usbcore: registered new device driver usb
[ 0.131031] pps_core: LinuxPPS API ver. 1 registered
[ 0.132003] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti
[ 0.133013] PTP clock support registered
[ 0.134048] PCI: Using ACPI for IRQ routing
[ 0.135332] NetLabel: Initializing
[ 0.136004] NetLabel: domain hash size = 128
[ 0.136762] NetLabel: protocols = UNLABELED CIPSOv4
[ 0.137016] NetLabel: unlabeled traffic allowed by default
[ 0.138034] cfg80211: Calling CRDA to update world regulatory domain
[ 0.140055] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[ 0.141028] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[ 0.142170] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[ 0.145123] Switched to clocksource hpet
[ 0.152784] pnp: PnP ACPI init
[ 0.153466] ACPI: bus type PNP registered
[ 0.154962] pnp: PnP ACPI: found 7 devices
[ 0.155747] ACPI: bus type PNP unregistered
[ 0.163978] NET: Registered protocol family 2
[ 0.165092] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.166375] TCP bind hash table entries: 1024 (order: 2, 16384 bytes)
[ 0.167540] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.168821] TCP: reno registered
[ 0.169444] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.170501] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.171666] NET: Registered protocol family 1
[ 0.172614] RPC: Registered named UNIX socket transport module.
[ 0.173691] RPC: Registered udp transport module.
[ 0.174562] RPC: Registered tcp transport module.
[ 0.175419] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.176566] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[ 0.177646] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[ 0.178703] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[ 0.180060] microcode: AMD CPU family 0x6 not supported
[ 0.181106] Scanning for low memory corruption every 60 seconds
[ 0.182498] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.183622] audit: initializing netlink subsys (disabled)
[ 0.184672] audit: type=2000 audit(1404126879.184:1): initialized
[ 0.185950] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[ 0.189254] VFS: Disk quotas dquot_6.5.2
[ 0.190058] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.191960] NFS: Registering the id_resolver key type
[ 0.192927] Key type id_resolver registered
[ 0.193712] Key type id_legacy registered
[ 0.194492] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 0.195791] msgmni has been set to 221
[ 0.198477] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.199857] io scheduler noop registered
[ 0.200559] io scheduler deadline registered
[ 0.201384] io scheduler cfq registered (default)
[ 0.202310] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[ 0.203439] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[ 0.204791] ACPI: Power Button [PWRF]
[ 0.205772] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[ 0.235568] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 0.238095] Non-volatile memory driver v1.3
[ 0.238822] Linux agpgart interface v0.103
[ 0.239698] [drm] Initialized drm 1.1.0 20060810
[ 0.241298] loop: module loaded
[ 0.243141] scsi0 : ata_piix
[ 0.243903] scsi1 : ata_piix
[ 0.244497] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
[ 0.245719] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
[ 0.247274] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[ 0.248341] e100: Copyright(c) 1999-2006 Intel Corporation
[ 0.249591] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[ 0.250826] e1000: Copyright (c) 1999-2006 Intel Corporation.
[ 0.252211] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[ 0.557292] ata2.00: ATAPI: QEMU DVD-ROM, 2.0.0, max UDMA/100
[ 0.558763] ata2.00: configured for MWDMA2
[ 0.559993] scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.0. PQ: 0 ANSI: 5
[ 0.571788] sr0: scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[ 0.572786] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 0.588224] sr 1:0:0:0: Attached scsi generic sg0 type 5
[ 0.589719] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[ 0.591061] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[ 0.592299] sky2: driver version 1.30
[ 0.593086] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.594285] ehci-pci: EHCI PCI platform driver
[ 0.595171] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.596284] ohci-pci: OHCI PCI platform driver
[ 0.597131] uhci_hcd: USB Universal Host Controller Interface driver
[ 0.598322] usbcore: registered new interface driver usblp
[ 0.599330] usbcore: registered new interface driver usb-storage
[ 0.600491] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[ 0.602687] serio: i8042 KBD port at 0x60,0x64 irq 1
[ 0.603611] serio: i8042 AUX port at 0x60,0x64 irq 12
[ 0.604659] mousedev: PS/2 mouse device common for all mice
[ 0.606067] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[ 0.609107] rtc_cmos 00:00: RTC can wake from S4
[ 0.610530] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[ 0.611875] rtc_cmos 00:00: alarms up to one day, 114 bytes nvram, hpet irqs
[ 0.613231] hidraw: raw HID events driver (C) Jiri Kosina
[ 0.614402] usbcore: registered new interface driver usbhid
[ 0.615407] usbhid: USB HID core driver
[ 0.616204] Netfilter messages via NETLINK v0.30.
[ 0.617082] nf_conntrack version 0.5.0 (884 buckets, 3536 max)
[ 0.618221] ctnetlink v0.93: registering with nfnetlink.
[ 0.619275] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 0.620301] TCP: cubic registered
[ 0.620880] Initializing XFRM netlink socket
[ 0.621720] NET: Registered protocol family 17
[ 0.622603] Key type dns_resolver registered
[ 0.623603] registered taskstats version 1
[ 0.624613] Magic number: 2:588:227
[ 0.625361] console [netcon0] enabled
[ 0.625999] netconsole: network logging started
[ 1.180213] tsc: Refined TSC clocksource calibration: 2994.561 MHz
[ 1.211209] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
[ 2.181327] Switched to clocksource tsc
[ 2.632618] e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[ 2.645159] Sending DHCP requests ., OK
[ 2.650354] IP-Config: Got DHCP answer from 192.168.2.1, my address is 192.168.2.100
[ 2.651816] IP-Config: Complete:
[ 2.652424] device=eth0, hwaddr=52:54:00:12:34:56, ipaddr=192.168.2.100, mask=255.255.255.0, gw=192.168.2.1
[ 2.654214] host=192.168.2.100, domain=lan, nis-domain=(none)
[ 2.655310] bootserver=192.168.2.1, rootserver=192.168.2.10, rootpath=
[ 2.656523] nameserver0=192.168.2.1
[ 2.657774] Root-NFS: nfsroot=/home/ivan/code/nfs-root,nfsvers=4.1,tcp
[ 2.659017] NFS: nfs mount opts='vers=2,udp,rsize=4096,wsize=4096,nfsvers=4.1,tcp,nolock,addr=192.168.2.10'
[ 2.660657] NFS: parsing nfs mount option 'vers=2'
[ 2.661550] NFS: parsing nfs mount option 'udp'
[ 2.662381] NFS: parsing nfs mount option 'rsize=4096'
[ 2.663332] NFS: parsing nfs mount option 'wsize=4096'
[ 2.664264] NFS: parsing nfs mount option 'nfsvers=4.1'
[ 2.665212] NFS: parsing nfs mount option 'tcp'
[ 2.666035] NFS: parsing nfs mount option 'nolock'
[ 2.666911] NFS: parsing nfs mount option 'addr=192.168.2.10'
[ 2.667981] NFS: MNTPATH: '/home/ivan/code/nfs-root'
[ 2.668877] --> nfs4_try_mount()
[ 2.715406] 192.168.2.10-ma (783) used greatest stack depth: 13480 bytes left
[ 2.719882] <-- nfs4_try_mount() = 0
[ 2.720727] VFS: Mounted root (nfs4 filesystem) on device 0:16.
[ 2.722163] devtmpfs: mounted
[ 2.724152] Freeing unused kernel memory: 1028K (ffffffff81cce000 - ffffffff81dcf000)
[ 2.725594] Write protecting the kernel read-only data: 12288k
[ 2.729310] Freeing unused kernel memory: 804K (ffff880001737000 - ffff880001800000)
[ 2.736241] Freeing unused kernel memory: 1796K (ffff880001a3f000 - ffff880001c00000)
[ 2.946324] random: systemd urandom read with 30 bits of entropy available
[ 2.971731] systemd[1]: systemd 214 running in system mode. (+PAM -AUDIT -SELINUX -IMA -SYSVINIT -LIBCRYPTSETUP -GCRYPT -ACL +XZ -SECCOMP -APPARMOR)
[ 2.974200] systemd[1]: Detected virtualization 'kvm'.
[ 2.975180] systemd[1]: Detected architecture 'x86-64'.

Welcome to Exherbo Linux!

[ 2.986200] systemd[1]: Failed to insert module 'ipv6'
[ 2.989085] systemd[1]: Set hostname to .
[ 3.018706] systemd-getty-g (791) used greatest stack depth: 12600 bytes left
[ 3.030065] systemd-system- (788) used greatest stack depth: 12576 bytes left
[ 3.047767] systemd-gpt-aut (789) used greatest stack depth: 12464 bytes left
[ 3.161188] systemd[1]: Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
[ 3.164201] systemd[1]: Expecting device dev-ttyS0.device...
Expecting device dev-ttyS0.device...
[ 3.166448] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[ 3.167953] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 3.169337] systemd[1]: Starting Remote File Systems.
[ OK ] Reached target Remote File Systems.
[ 3.171635] systemd[1]: Reached target Remote File Systems.
[ 3.172707] systemd[1]: Starting Dispatch Password Requests to Console Directory Watch.
[ 3.174198] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[ 3.175645] systemd[1]: Starting Paths.
[ OK ] Reached target Paths.
[ 3.177484] systemd[1]: Reached target Paths.
[ 3.178303] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.
[ OK ] Set up automount Arbitrary Executable File Formats F...utomount Point.
[ 3.181585] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[ 3.183275] systemd[1]: Starting Swap.
[ OK ] Reached target Swap.
[ 3.185204] systemd[1]: Reached target Swap.
[ 3.185986] systemd[1]: Starting Root Slice.
[ OK ] Created slice Root Slice.
[ 3.189946] systemd[1]: Created slice Root Slice.
[ 3.190830] systemd[1]: Starting User and Session Slice.
[ OK ] Created slice User and Session Slice.
[ 3.193221] systemd[1]: Created slice User and Session Slice.
[ 3.194270] systemd[1]: Starting udev Control Socket.
[ OK ] Listening on udev Control Socket.
[ 3.197090] systemd[1]: Listening on udev Control Socket.
[ 3.198080] systemd[1]: Starting Delayed Shutdown Socket.
[ OK ] Listening on Delayed Shutdown Socket.
[ 3.200368] systemd[1]: Listening on Delayed Shutdown Socket.
[ 3.201448] systemd[1]: Starting Journal Socket (/dev/log).
[ OK ] Listening on Journal Socket (/dev/log).
[ 3.204220] systemd[1]: Listening on Journal Socket (/dev/log).
[ 3.205338] systemd[1]: Starting udev Kernel Socket.
[ OK ] Listening on udev Kernel Socket.
[ 3.207513] systemd[1]: Listening on udev Kernel Socket.
[ 3.208506] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[ OK ] Listening on /dev/initctl Compatibility Named Pipe.
[ 3.211552] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[ 3.212872] systemd[1]: Starting Journal Socket.
[ OK ] Listening on Journal Socket.
[ 3.214987] systemd[1]: Listening on Journal Socket.
[ 3.215912] systemd[1]: Starting System Slice.
[ OK ] Created slice System Slice.
[ 3.218117] systemd[1]: Created slice System Slice.
[ 3.218985] systemd[1]: Starting system-getty.slice.
[ OK ] Created slice system-getty.slice.
[ 3.221388] systemd[1]: Created slice system-getty.slice.
[ 3.222375] systemd[1]: Starting system-serial\x2dgetty.slice.
[ OK ] Created slice system-serial\x2dgetty.slice.
[ 3.224963] systemd[1]: Created slice system-serial\x2dgetty.slice.
[ 3.226210] systemd[1]: Mounting Temporary Directory...
Mounting Temporary Directory...
[ 3.230372] systemd[1]: Starting Setup Virtual Console...
Starting Setup Virtual Console...
[ 3.241634] systemd[1]: Started Set Up Additional Binary Formats.
[ 3.254979] systemd[1]: Started Load Kernel Modules.
[ 3.257215] systemd[1]: Starting Journal Service...
Starting Journal Service...
[ OK ] Started Journal Service.
[ 3.265685] systemd[1]: Started Journal Service.
Starting Apply Kernel Variables...
Mounting Huge Pages File System...
Mounting Debug File System...
Starting udev Coldplug all Devices...
Mounting POSIX Message Queue File System...
Starting Create Static Device Nodes in /dev...
[ OK ] Reached target Slices.
Starting Remount Root and Kernel File Systems...
[ OK ] Mounted Temporary Directory.
[ OK ] Mounted Huge Pages File System.
[ OK ] Mounted POSIX Message Queue File System.
[ OK ] Mounted Debug File System.
[ OK ] Started Apply Kernel Variables.
[ OK ] Started Remount Root and Kernel File Systems.
Starting Load/Save Random Seed...
[ OK ] Started udev Coldplug all Devices.
[ 3.592033] systemd-tmpfile (800) used greatest stack depth: 12448 bytes left
[ OK ] Started Create Static Device Nodes in /dev.
Starting udev Kernel Device Manager...
[ OK ] Reached target Local File Systems (Pre).
[ OK ] Reached target Local File Systems.
Starting Create Volatile Files and Directories...
Starting Trigger Flushing of Journal to Persistent Storage...
[ OK ] Started Load/Save Random Seed.
[ 3.727215] systemd-udevd[850]: starting version 214
[ OK ] Started udev Kernel Device Manager.
[ 3.732738] systemd-journald[794]: Received request to flush runtime journal from PID 1
[ OK ] Started Trigger Flushing of Journal to Persistent Storage.
[ 3.788998] gzip (807) used greatest stack depth: 12384 bytes left
[ 3.796880] gzip (809) used greatest stack depth: 12376 bytes left
[ 3.868702] gzip (1026) used greatest stack depth: 12224 bytes left
[ OK ] Started Setup Virtual Console.
[ OK ] Started Create Volatile Files and Directories.
[ OK ] Found device /dev/ttyS0.
Starting Update UTMP about System Boot/Shutdown...
[ 4.179435] random: nonblocking pool is initialized
[ OK ] Started Update UTMP about System Boot/Shutdown.
[ OK ] Reached target System Initialization.
[ OK ] Reached target Timers.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Basic System.
Starting Login Service...
Starting Permit User Sessions...
Starting D-Bus System Message Bus...
[ OK ] Started D-Bus System Message Bus.
Starting Network Service...
[ OK ] Started Permit User Sessions.
[ OK ] Started Login Service.
Starting Getty on tty1...
[ OK ] Started Getty on tty1.
Starting Serial Getty on ttyS0...
[ OK ] Started Serial Getty on ttyS0.
[ OK ] Reached target Login Prompts.
[ OK ] Started Network Service.
Starting Network Name Resolution...
[ OK ] Reached target Network.
[ OK ] Started Network Name Resolution.
[ OK ] Reached target Multi-User System.
[ OK ] Reached target Graphical Interface.

This is localhost.unknown_domain (Linux x86_64 3.15.2+) 11:14:45

localhost login: root
Password:
Last login: Sun Jun 29 09:10:44 UTC 2014 on ttyS0
root@localhost ~ # cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 6
model name : QEMU Virtual CPU version 2.0.0
stepping : 3
microcode : 0x1000065
cpu MHz : 2994.369
cache size : 512 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 x2apic popcnt hypervisor lahf_lm svm abm sse4a
bogomips : 5988.73
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:

root@localhost ~ # free -m
total used free shared buffers cached
Mem: 114 38 75 4 0 17
-/+ buffers/cache: 20 93
Swap: 0 0 0
root@localhost ~ # ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.100/24 brd 192.168.2.255 scope global eth0
valid_lft forever preferred_lft forever
[ 19.289091] ip (1192) used greatest stack depth: 12160 bytes left
root@localhost ~ # poweroff
[ OK ] Stopped target Network.
Stopping User Manager for UID 0...
[ OK ] Stopped target Graphical Interface.
[ OK ] Stopped target Multi-User System.
Stopping Network Name Resolution...
Stopping Login Service...
[ OK ] Stopped target Login Prompts.
Stopping Getty on tty1...
Stopping Serial Getty on ttyS0...
Stopping D-Bus System Message Bus...
[ OK ] Stopped Login Service.
[ OK ] Stopped Getty on tty1.
[ OK ] Stopped D-Bus System Message Bus.
[ OK ] Stopped Serial Getty on ttyS0.
[ OK ] Stopped Network Name Resolution.
[ OK ] Stopped User Manager for UID 0.
[ OK ] Removed slice user-0.slice.
[ OK ] Removed slice system-serial\x2dgetty.slice.
[ OK ] Removed slice system-getty.slice.
Stopping Permit User Sessions...
[ OK ] Stopped Permit User Sessions.
[ OK ] Stopped target Basic System.
[ OK ] Stopped target Slices.
[ OK ] Removed slice User and Session Slice.
[ OK ] Stopped target Paths.
[ OK ] Stopped target Timers.
[ OK ] Stopped target Sockets.
[ OK ] Closed D-Bus System Message Bus Socket.
[ OK ] Stopped target System Initialization.
Stopping Setup Virtual Console...
[ OK ] Stopped Setup Virtual Console.
Stopping Apply Kernel Variables...
[ OK ] Stopped Apply Kernel Variables.
Stopping Load/Save Random Seed...
Stopping Update UTMP about System Boot/Shutdown...
[ OK ] Stopped target Swap.
[ OK ] Stopped target Remote File Systems.
[ OK ] Stopped Update UTMP about System Boot/Shutdown.
Stopping Create Volatile Files and Directories...
[ OK ] Stopped Create Volatile Files and Directories.
[ OK ] Stopped target Local File Systems.
Unmounting /run/user/0...
Unmounting Temporary Directory...
[ OK ] Unmounted /run/user/0.
[ OK ] Stopped target Local File Systems (Pre).
[ OK ] Unmounted Temporary Directory.
[ OK ] Reached target Unmount All Filesystems.
[ OK ] Stopped Load/Save Random Seed.
Stopping Remount Root and Kernel File Systems...
[ OK ] Stopped Remount Root and Kernel File Systems.
[ OK ] Reached target Shutdown.
[ 24.374630] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[ 24.378547] systemd-journald[794]: Received SIGTERM from PID 1 (systemd-shutdow).
[ 24.383376] systemd-network (1168) used greatest stack depth: 11728 bytes left
[ 24.386008] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[ 24.390476] systemd-shutdown[1]: Unmounting file systems.
[ 24.391717] systemd-shutdown[1]: Unmounting /dev/mqueue.
[ 24.393060] systemd-shutdown[1]: Unmounting /sys/kernel/debug.
[ 24.394178] systemd-shutdown[1]: Unmounting /dev/hugepages.
[ 24.396158] systemd-shutdown[1]: All filesystems unmounted.
[ 24.397233] systemd-shutdown[1]: Deactivating swaps.
[ 24.398387] systemd-shutdown[1]: All swaps deactivated.
[ 24.399380] systemd-shutdown[1]: Detaching loop devices.
[ 24.402160] systemd-shutdown[1]: All loop devices detached.
[ 24.403213] systemd-shutdown[1]: Detaching DM devices.
[ 24.404201] systemd-shutdown[1]: All DM devices detached.
[ 24.405189] systemd-shutdown[1]: Storage is finalized.
[ 24.420385] systemd-shutdown[1]: Powering off.
[ 24.460923] ACPI: Preparing to enter system sleep state S5
[ 24.462020] reboot: Power down
So what happened here is: qemu created a virtual ethernet nic e1000 in guest, tap0 interface in host and connected tap0 to br0 bridge (-netdev bridge,br=br0 is default). Then qemu started the vm, ran the kernel, kernel (and later userspace) used the host's terminal from which I lauchned qemu for i/o. Kernel configured its virtual ethernet nic with settings from router's dhcpd, mounted the rootfs, started systemd and then I logged in, ran a few commands and powered the vm off.

And this is how it's done.
Previous post Next post
Up