Bug 5815

Summary: qemu can't connect to TAP device if another VM already is using TAP0
Product: [Runtime] General Runtime Reporter: Casey Schaufler <casey.schaufler>
Component: General RuntimeAssignee: Scott Garman <scott.a.garman>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium    
Version: 1.6   
Target Milestone: 1.6   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Casey Schaufler 2014-02-12 23:19:14 UTC
build$ runqemu qemux86

Continuing with the following parameters:
KERNEL: [/home/cschaufler/Yocto/poky-dora-10.0.1/build/tmp/deploy/images/qemux86/bzImage-qemux86.bin]
ROOTFS: [/home/cschaufler/Yocto/poky-dora-10.0.1/build/tmp/deploy/images/qemux86/core-image-sato-qemux86.ext3]
FSTYPE: [ext3]
Acquiring lockfile for tap0...
Using preconfigured tap device 'tap0'
If this is not intended, use flock on /tmp/qemu-tap-locks/tap0.lock to make runqemu skip tap0.
Running qemu-system-i386...
/home/cschaufler/Yocto/poky-dora-10.0.1/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel /home/cschaufler/Yocto/poky-dora-10.0.1/build/tmp/deploy/images/qemux86/bzImage-qemux86.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -hda /home/cschaufler/Yocto/poky-dora-10.0.1/build/tmp/deploy/images/qemux86/core-image-sato-qemux86.ext3 -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 256 --append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/hda rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 "
qemu-system-i386: -net tap,vlan=0,ifname=tap0,script=no,downscript=no: could not configure /dev/net/tun (tap0): Device or resource busy
qemu-system-i386: -net tap,vlan=0,ifname=tap0,script=no,downscript=no: Device 'tap' could not be initialized
Releasing lockfile of preconfigured tap device 'tap0'

build$ flock /tmp/qemu-tap-locks/tap0.lock
flock: bad number: /tmp/qemu-tap-locks/tap0.lock
Comment 1 Scott Garman 2014-02-15 19:10:17 UTC
I have submitted a workaround for this to the oe-core ML.

Since there is no way in software we can determine if an existing tap device is in use, the workaround allows a user to simply touch a filename in the runqemu tap lock directory, and it will skip using that tap device.