# [solved] qemu: can't boot guest with virtio and lvm

## pactoo

Ok, I successfully installed a guest on a logical volume and also grub on this guest. Host in this example ist gentoo, the guest would be arch. Installation went fine using:

```

qemu -drive file=/dev/QEMU_TEST/quemu_sys,if=virtio -m 256 -net nic,macaddr=52:54:00:12:35:59,model=virtio -net vde,sock=/tmp/vswitch1 -cdrom /home/images/archlinux-2010.05-core-i686.iso -kernel-kqemu -enable-kqemu -boot d

```

However, if I try to boot, the guest bios claims:

```

# qemu -drive file=/dev/QEMU_TEST/quemu_sys,if=virtio -m 256 -net nic,macaddr=52:54:00:12:35:59,model=virtio -net vde,sock=/tmp/vswitch1  -kernel-kqemu -enable-kqemu 

...

Boot failed: Could not read the boot disk

```

For most documentation I have found that deals with virtio wants a boot=on option: file=/dev/QEMU_TEST/quemu_sys,if=virtio,boot=on

However, specifying this I do get an error:

```

qemu: unknown parameter 'boot' in 'file=/dev/QEMU_TEST/quemu_sys,if=virtio,boot=on'

```

So I am a bit lost. Any ideas what may be going wrong?Last edited by pactoo on Tue Aug 17, 2010 10:28 am; edited 1 time in total

----------

## Hu

What is the output of emerge --info ; emerge --pretend --verbose $(eix -I --only-names qemu)?

----------

## pactoo

Here we go:

```

# emerge --info ; emerge --pretend --verbose $(eix -I --only-names qemu)

Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.4, glibc-2.11.2-r0, 2.6.35.2 x86_64)

=================================================================

System uname: Linux-2.6.35.2-x86_64-AMD_Athlon-tm-_64_Processor_3200+-with-gentoo-1.12.13

Timestamp of tree: Sun, 15 Aug 2010 17:00:01 +0000

app-shells/bash:     4.0_p37

dev-java/java-config: 2.1.11

dev-lang/python:     2.6.5-r3

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 1.12.13

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.13, 2.65

sys-devel/automake:  1.8.5-r3, 1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.4.4-r1

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6b

virtual/os-headers:  2.6.34

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=k8 -O2 -mmmx -m3dnow -msse -msse2 -mfpmath=sse -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=k8 -O2 -mmmx -m3dnow -msse -msse2 -mfpmath=sse -pipe"

DISTDIR="/usr/src/gentoo/distfiles"

FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="de_DE.utf8"

LC_ALL="de_DE.utf8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="de nds en_GB"

MAKEOPTS="-j1"

PKGDIR="/usr/src/gentoo/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_EXTRA_OPTS="--delete-before"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/usr/src/gentoo/tmp"

PORTDIR="/usr/src/gentoo/portage"

PORTDIR_OVERLAY="/usr/src/gentoo/local"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="3dnow 3dnowext 64bit X a52 aac aalib accessibility acpi aften aiglx akonadi alsa amd64 arts asf audio audiofile ayatana bcmath berkdb bluetooth bzip2 bzlib cairo caps cdda cdparanoia cdr chipcard consolekit corefonts cpudetection cracklib crypt css cups curl curlwrappers dbus desktopglobe dga dirac directfb dri dts dv dvb dvd dvdr enca encode exif expat faac faad fam fbcon ffmpeg fftw flac ftp gallium gallium-radeon garmin gatos gd gif glib glitz gmp gpac gphoto2 gpm gps gs hbci hunspell iconv icu ieee1394 imagemagick imlib ithreads jack joystick jpeg jpeg2k kde kipi kontact lame lcms libmms libsamplerate libwww live lm_sensors logrotate lv2 lzma lzo mad matroska md5sum midi mmap mms mmx mmxext mng mp2 mp3 mp4 mpeg multilib multimedia musepack nls no-old-linux no_wxgtk1 nonfsv4 nptl nptlonly offensive ogg oggvorbis openct openexr opengl openmp pam pcsc-lite pdf pdflib phonon pic pkcs11 png policykit ppds ps pvr pwdb qt3support qt4 quicktime radio raster raw rdesktop readline rss rtc scanner schroedinger sdl semantic-desktop sftp smartcard sndfile sox speex spell sqlite sse sse2 ssl svg taglib theora threads threadsafe tiff truetype udev unicode usb v4l v4l2 vcd video vorbis wav wavpack webkit wifi wma x264 xcb xcomposite xine xml xml2 xorg xsl xv xvid zlib zvbi" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug lfloat linear meter mulaw multi null rate route share shm asym plug softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="canon fuji kodak ptp2" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de nds en_GB" LIRC_DEVICES="all" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon v4l vesa vga" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] app-emulation/kqemu-1.4.0_pre1-r1  0 kB

[ebuild   R   ] app-emulation/qemu-0.11.1  USE="alsa bluetooth kqemu ncurses sdl vde -esd -gnutls -kvm -pulseaudio -sasl" QEMU_SOFTMMU_TARGETS="i386 x86_64 -arm -cris -m68k -mips -mips64 -mips64el -mipsel -ppc -ppc64 -ppcemb -sh4 -sh4eb -sparc" QEMU_USER_TARGETS="i386 x86_64 -alpha -arm -armeb -cris -m68k -mips -mips64 -mips64el -mipsel -ppc -ppc64 -ppc64abi32 -sh4 -sh4eb -sparc -sparc32plus -sparc64" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB

```

Edit

May I should have mentioned that the boot=on parameter works when using an image file and kvm, but not with qemu and LVM. Haven't tested kvm with boot=on and lvm though, due to lack of LVM on the other machine, that is kvm capable.

----------

## Hu

That is a fairly old qemu.  I think the boot= option was introduced later.  You should consider upgrading to a newer qemu as soon as possible.  There have been many improvements.

----------

## pactoo

There isn't any newer: 

```

# ls -al /usr/src/gentoo/portage/app-emulation/qemu 

total 100

drwxr-xr-x   3 root root  4096 Jul  1 00:05 .

drwxr-xr-x 101 root root  4096 Aug 15 18:41 ..

-rw-r--r--   1 root root 10409 Jul  1 00:05 ChangeLog

-rw-r--r--   1 root root  4552 Jul  1 00:05 Manifest

drwxr-xr-x   2 root root  4096 Oct 23  2009 files

-rw-r--r--   1 root root   910 Dec 29  2009 metadata.xml

-rw-r--r--   1 root root   523 Mar  9  2009 qemu-0.10.0.ebuild

-rw-r--r--   1 root root   523 Mar 23  2009 qemu-0.10.1.ebuild

-rw-r--r--   1 root root  4716 Jul  1 00:05 qemu-0.10.3.ebuild

-rw-r--r--   1 root root  4800 Jul  1 00:05 qemu-0.10.4.ebuild

-rw-r--r--   1 root root  4887 Jul  1 00:05 qemu-0.10.5.ebuild

-rw-r--r--   1 root root  4859 Jul  1 00:05 qemu-0.10.6.ebuild

-rw-r--r--   1 root root  4910 Jul  1 00:05 qemu-0.11.0.ebuild

-rw-r--r--   1 root root  4910 Jul  1 00:05 qemu-0.11.1.ebuild

-rw-r--r--   1 root root   503 Apr  5  2009 qemu-0.9.0.ebuild

-rw-r--r--   1 root root   515 Apr  5  2009 qemu-0.9.1.ebuild

```

Asides, the 0.12 Version does not support kqemu any more. However, this particular machine does not have an virtualisation support, so kvm is not a choice. But I do no rely on the boot=on option, I just would like to make the lvm guest boot, by what means ever.

----------

## Hu

You can run qemu without kqemu, though there is a performance penalty if you do not use hardware-assisted virtualization.  How old is your CPU?  I thought that SVM support had been standard for several years now.  Could you post the output of cat /proc/cpuinfo?

----------

## pactoo

I've done that, run qemu without kqemu first. On my machine the performance gain with kqemu is incredible. Really an order of a magnitude. Not, that the guest is really fast, but at least you can survive the installation with just a bit of patience. Without it was just a plain pain.

```

# cat /proc/cpuinfo 

processor       : 0

vendor_id       : AuthenticAMD

cpu family      : 15

model           : 31

model name      : AMD Athlon(tm) 64 Processor 3200+

stepping        : 0

cpu MHz         : 2000.000

cache size      : 512 KB

fpu             : yes

fpu_exception   : yes

cpuid level     : 1

wp              : yes

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good lahf_lm

bogomips        : 4086.85

TLB size        : 1024 4K pages

clflush size    : 64

cache_alignment : 64

address sizes   : 40 bits physical, 48 bits virtual

power management: ts fid vid ttp

```

You see, no support here. Socket 939, first generation. Remember, when we were young? 

However, this problem is related to the virtio driver. Using virtio with a file works. Using LVM without virtio works, too. I just haven't managed to make LVM and virtio playing together.  This may well be due to an older version, but I still have some doubts, as everything else works.

----------

## pactoo

It was indeed the version. Using LVM and virtio_blk on a kvm enabled machine with qemu 0.12.5 the parameter boot=on was accepted and the guest boots as expected using following command:

```

qemu -drive file=/dev/KVM/kvm_sys,if=virtio,boot=on -m 256 -net nic,macaddr=52:54:00:12:35:59,model=virtio -net vde,sock=/tmp/vswitch1 -vnc 192.168.10.1:1 -k de

```

Thanks to all who helped

----------

