Bug 3028 - runqemu aborts if it finds a preconfigured tap device
Summary: runqemu aborts if it finds a preconfigured tap device
Status: VERIFIED FIXED
Alias: None
Product: Meta-yocto
Classification: Build System, Metadata & Runtime
Component: meta-yocto (show other bugs)
Version: 1.3
Hardware: All Multiple
: Medium normal
Target Milestone: 1.3 M4
Assignee: Scott Garman
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2012-08-28 21:33 UTC by Tom Zanussi
Modified: 2012-09-29 03:08 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Zanussi 2012-08-28 21:33:52 UTC
If there's an existing tap device on the system, runqemu takes a different path that essentially leaves the trailing colon on the tap device name e.g. tap0: instead of what it should be: tap0.  Stripping the colon off the name it finds should fix the problem, but the runqemu* scripts should be audited for similar kind of problems with this and other devices.

If there isn't a tap device found, the script uses the output of:

tap=`sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT

which doesn't cause a problem, which is why the problem isn't normally seen (i.e. everybody must be using Ubuntu).

Details: my system has the following ifconfig output:

[trz@empanada build]$ ifconfig
em1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 08:2e:5f:74:a0:a0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 48  base 0x6000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 103  bytes 5852 (5.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 103  bytes 5852 (5.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tap0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.7.1  netmask 255.255.255.255  broadcast 192.168.7.255
        inet6 fe80::707d:5fff:fe24:2343  prefixlen 64  scopeid 0x20<link>
        ether 72:7d:5f:24:23:43  txqueuelen 500  (Ethernet)
        RX packets 50  bytes 16387 (16.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21  bytes 3461 (3.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

which produces the error below:

Continuing with the following parameters:
KERNEL: [/home/trz/yocto/systemtap-ext/build/tmp/deploy/images/bzImage-qemux86.bin]
ROOTFS: [/home/trz/yocto/systemtap-ext/build/tmp/deploy/images/core-image-sato-qemux86.ext3]
FSTYPE: [ext3]
Acquiring lockfile for tap0:...
Using preconfigured tap device 'tap0:'
/home/trz/yocto/systemtap-ext/scripts/runqemu-internal: line 219: 0: * 2 + 1: syntax error in expression (error token is ": * 2 + 1")
WARNING: distccd not present, no distcc support loaded.
Running qemu...
/home/trz/yocto/systemtap-ext/build/tmp/sysroots/x86_64-linux/usr/bin/qemu -kernel /home/trz/yocto/systemtap-ext/build/tmp/deploy/images/bzImage-qemux86.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0:,script=no,downscript=no -hda /home/trz/yocto/systemtap-ext/build/tmp/deploy/images/core-image-sato-qemux86.ext3 -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 128 --append "vga=0 root=/dev/hda rw mem=128M ip=192.168.7.1::192.168.7.:255.255.255.0 oprofile.timer=1 "
qemu: -net tap,vlan=0,ifname=tap0:,script=no,downscript=no: could not configure /dev/net/tun (tap0:): Operation not permitted
qemu: -net tap,vlan=0,ifname=tap0:,script=no,downscript=no: Device 'tap' could not be initialized
Set 'tap0:' nonpersistent
Releasing lockfile of preconfigured tap device 'tap0:'
[trz@empanada build]$ emacs -nw
Comment 1 Scott Garman 2012-09-25 16:11:57 UTC
Fixed in oe-core and poky master as of:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=e46be72a8e5d064b4b46d5b0c37d67bbb2ccae55
Comment 2 liang li 2012-09-29 03:08:41 UTC
verified on :
git info:718eb85806e080d0b165344b272e531ef19421eb
git branch: 1.3_M5
test env: 
host: ubuntu 12.04 x86_64

if tap0 already existed (first qemu target has been up),then run "runqemu" to boot up second qemu target, it can boot up normally. after that,run "ifconfig" on the host,output below:
$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1a:a0:bb:2d:c5  
          inet addr:128.224.162.249  Bcast:128.224.163.255  Mask:255.255.254.0
          inet6 addr: fe80::21a:a0ff:febb:2dc5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1624216 errors:0 dropped:150 overruns:0 frame:0
          TX packets:254343 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:260431134 (260.4 MB)  TX bytes:24668860 (24.6 MB)
          Interrupt:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8824 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8824 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:853917 (853.9 KB)  TX bytes:853917 (853.9 KB)

tap0      Link encap:Ethernet  HWaddr a6:50:e7:bd:ef:83  
          inet addr:192.168.7.1  Bcast:192.168.7.255  Mask:255.255.255.255
          inet6 addr: fe80::a450:e7ff:febd:ef83/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:35901 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47692 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:13795073 (13.7 MB)  TX bytes:38379876 (38.3 MB)

tap1      Link encap:Ethernet  HWaddr ee:de:0c:3b:9c:9c  
          inet addr:192.168.7.3  Bcast:192.168.7.255  Mask:255.255.255.255
          inet6 addr: fe80::ecde:cff:fe3b:9c9c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:468 (468.0 B)  TX bytes:9842 (9.8 KB)