<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>3184</bug_id>
          
          <creation_ts>2012-09-26 22:29:59 +0000</creation_ts>
          <short_desc>running an image with kvm enabled fails if the runqemu command is used</short_desc>
          <delta_ts>2012-10-08 14:35:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>virtual machines</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>4b5d9da07c2b4946cf2321ce537047bd61366a6e</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.3 M5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Laurentiu Serban">laurentiu.serban</reporter>
          <assigned_to name="Cristian Iorga">cristian.iorga</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>alexandru.damian</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>25816</commentid>
    <comment_count>0</comment_count>
    <who name="Laurentiu Serban">laurentiu.serban</who>
    <bug_when>2012-09-26 22:29:59 +0000</bug_when>
    <thetext>Following the wiki
https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM
causes this error while starting the machine:

lserban@computer1:~/work/master/build$ runqemu tmp/deploy/images/bzImage-qemux86.bin tmp/deploy/images/core-image-minimal-qemux86-20120926220014.rootfs.ext3 kvm nographic
Set MACHINE to [qemux86] based on kernel [tmp/deploy/images/bzImage-qemux86.bin]

Continuing with the following parameters:
KERNEL: [tmp/deploy/images/bzImage-qemux86.bin]
ROOTFS: [tmp/deploy/images/core-image-minimal-qemux86-20120926220014.rootfs.ext3]
FSTYPE: [ext3]
Setting up tap interface under sudo
Acquiring lockfile for tap0...
WARNING: distccd not present, no distcc support loaded.
Running qemu-system-i386...
/home/lserban/work/master/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel tmp/deploy/images/bzImage-qemux86.bin -net nic,model=virtio -net tap,vlan=0,ifname=tap0,script=no,downscript=no,vhost=on -drive file=tmp/deploy/images/core-image-minimal-qemux86-20120926220014.rootfs.ext3,if=virtio -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -nographic -enable-kvm -cpu host -m 128 --append &quot;vga=0 root=/dev/vda rw mem=128M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 console=ttyS0&quot;
qemu-system-i386: -net tap,vlan=0,ifname=tap0,script=no,downscript=no,vhost=on: vhost-net requested but could not be initialized
qemu-system-i386: -net tap,vlan=0,ifname=tap0,script=no,downscript=no,vhost=on: Device &apos;tap&apos; could not be initialized
Set &apos;tap0&apos; nonpersistent
Releasing lockfile of preconfigured tap device &apos;tap0&apos;


if the command /home/lserban/work/master/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel tmp/deploy/images/bzImage-qemux86.bin -net nic,model=virtio -net tap,vlan=0,ifname=tap0,script=no,downscript=no,vhost=on -drive file=tmp/deploy/images/core-image-minimal-qemux86-20120926220014.rootfs.ext3,if=virtio -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -nographic -enable-kvm -cpu host -m 128 --append &quot;vga=0 root=/dev/vda rw mem=128M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 console=ttyS0&quot; is run with sudo the machine starts.

This is an incorrect behavior, the sudo password should be asked when the machine starts</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25830</commentid>
    <comment_count>1</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2012-09-27 06:35:54 +0000</bug_when>
    <thetext>Hello,

This is the key:

&quot;vhost-net requested but could not be initialized&quot;

This is not a problem of poky, Yocto Linux or qemu.

This basically means that the user did not configure properly vhost-net driver in order to be run also under a user without administrative rights.

See this part from the guide:

 Change the kvm dev ownership for non-root user

qemu is started as non-root user in poky, but /dev/kvm from some distribution remains root:root that only allow root to use KVM. To work around this, we need create a new group named kvm, and make both /dev/kvm and the non-root user belongs to it.

$ sudo addgroup --system kvm
$ sudo adduser $USER kvm
$ sudo chown root:kvm /dev/kvm
$ sudo chmod 0660 /dev/kvm

The output of &quot;ls -l /dev/kvm&quot; should be like this:

crw-rw----+ 1 root kvm 10, 232 2010-07-02 09:27 /dev/kvm

On a system that runs udev, you will probably need to add the following line somewhere in your udev configuration so it will automatically give the right group to the newly created device (i-e for ubuntu add a line to /etc/udev/rules.d/40-permissions.rules).

KERNEL==&quot;kvm&quot;, GROUP=&quot;kvm&quot;

Something similar must be done for vhost-net!!


Note

    You need log out then log in the non-root user to take the effect
    Some distributions have already made this, so that we can skip this step 

And also:

Basically, follow the same guide as for enabling KVM on the host (step 1.), but replace kvm with vhost_net 


Or course that running under sudo solves the issue.
And if someone authenticated himself/herself to run something under sudo, there a limited period of time in which the system does not ask you again for your password.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26022</commentid>
    <comment_count>2</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2012-10-02 11:14:41 +0000</bug_when>
    <thetext>Please document all this with the ready-to-run copy-paste scripts in the Wiki page.
The wiki page is not clear on what you are supposed to do.


Please detect in the runqemu script when this error is triggered, and provide an informative message with a link to the wiki page.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26023</commentid>
    <comment_count>3</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2012-10-02 11:17:52 +0000</bug_when>
    <thetext>Agreed.

1. Online guide will be updated.
2. Reported error will be clarified and a link to the online guide will be provided.

Regards,
Cristian</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26105</commentid>
    <comment_count>4</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2012-10-03 10:55:24 +0000</bug_when>
    <thetext>Patch submitted for review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26106</commentid>
    <comment_count>5</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2012-10-03 10:56:03 +0000</bug_when>
    <thetext>Online guide has been updated and clarified.

See: https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26189</commentid>
    <comment_count>6</comment_count>
    <who name="Cristian Iorga">cristian.iorga</who>
    <bug_when>2012-10-04 06:26:54 +0000</bug_when>
    <thetext>Fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26342</commentid>
    <comment_count>7</comment_count>
    <who name="Alexandru Georgescu">alexandru.c.georgescu</who>
    <bug_when>2012-10-08 14:35:42 +0000</bug_when>
    <thetext>Verified.
Following the wiki could help me boot qemu kvm enabled.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>