I have made some progress...
I was looking for a way of adding multiple interfaces, I learned that
there exists a runqemu-gen-tapdevs(1) that was designed just for that.
It reads
# Create a "bank" of tap network devices that can be used by the
# runqemu script. This script needs to be run as root, and will
# use the tunctl binary from the build system sysroot.
So equipped with that, I modify my script to say
echo "=== Deleteing existing taps..."
sudo $RUNQEMU_GEN_TAPDEVS $myID $myGID 0 $OECORE_NATIVE_SYSROOT
echo "=== Creating $ifcnt taps..."
sudo $RUNQEMU_GEN_TAPDEVS $myID $myGID $ifcnt $OECORE_NATIVE_SYSROOT
netConf=" -netdev tap,id=net0,ifname=tap0 -device virtio-net-pci,netdev=net0 "
cmd+=" qemuparams=\"-m $memory $qemu_virtio_params $netConf\""
eval $cmd
And I get the following....
...skip...
=== Deleteing existing taps...
Note: Destroying pre-existing tap interface tap0...
Set 'tap0' nonpersistent
Creating 0 tap devices for UID: 1000 GID: 1000...
=== Creating 1 taps...
Creating 1 tap devices for UID: 1000 GID: 1000...
Creating tap0
...skip..
Acquiring lockfile for tap0...
Using preconfigured tap device 'tap0'
....skip....
RTNETLINK answers: Operation not permitted
W: /etc/qemu-ifup: no bridge for guest interface found
qemu-system-x86_64: -net tap,vlan=0,ifname=tap0,script=no,downscript=no: could
not configure /dev/net/tun (tap0): Device or resource busy
Releasing lockfile of preconfigured tap device 'tap0'
Do I need to chase the bridge issue ? or Device or resource busy issue
Thanks
Medi
On 12/18/2017 07:16 PM, Medi Montaseri wrote:
Hi,
I am trying to configure multiple nic interfaces and having some
problems, help is appreciated.
my runqemu(1) script from poky/scripts/runqemeu is
commit 1db3dc88036ccd46ed2b714fdc0fb565beb001ed
Author: Robert Yang <[email protected]>
Date: Sun Apr 10 07:16:48 2016 -0700
I have been using it successfully like
About to run [runqemu qemux86-64 serial kvm qemuparams="-m 256
-device virtio-serial -chardev
socket,path=./virtio-ports/tty0,server,nowait,id=tty0 -device
virtserialport,chardev=tty0,name=tty0 "]
I notice that it is creating tap0 and then cleans it up (a transient
tap device).
runqemu(1) in-turn is calling
build/tmp-glibc/sysroots/x86_64-linux/usr/bin/qemu-system-x86_64
-kernel
/home/medim/work3/build/tmp-glibc/deploy/images/qemux86-64/bzImage-qemux86-64.bin
-net nic,model=virtio -net
tap,vlan=0,ifname=tap0,script=no,downscript=no
-cpu kvm64 -drive
file=/home/medim/work3/build/tmp-glibc/deploy/images/qemux86-64/og-image-consoleserver-dev-qemux86-64-20171218190955.rootfs.ext4,if=virtio,format=raw
-show-cursor -usb -usbdevice tablet -vga vmware -no-reboot -serial
stdio -enable-kvm -m 256
-device virtio-serial -chardev
socket,path=./virtio-ports/tty0,server,nowait,id=tty0
-device virtserialport,chardev=tty0,name=tty0
-append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/vda rw
mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1
rootfstype=ext4 console=ttyS0"
As seen, we have one tap0 device. I would like to create multiple tap
devices (say tap1, tap2, etc). I have tried adding the following to
qemuparams
case 1: " -net nic,model=virtio -net tap,ifname=tap1,script=no"
case 2: " -netdev tap,id=net0,ifname=tap1 -device
virtio-net-pci,netdev=net0 "
case 3: " -net none -netdev tap,id=net0,ifname=tap1 -device
virtio-net-pci,netdev=net0 "
And always get the following error
qemu-system-x86_64: -netdev tap,id=net0,ifname=tap1: could not
configure /dev/net/tun (tap1): Operation not permitted
Set 'tap0' nonpersistent
Releasing lockfile of preconfigured tap device 'tap0'
/dev/net/tun mode is
ls -ld /dev/net/tun
crw-rw-rw- 1 root root 10, 200 Dec 11 16:20 /dev/net/tun
there is a sudo operation going on by someone (but I can't tell by who
or when)....
Continuing with the following parameters:
KERNEL:
[/home/medim/work3/build/tmp-glibc/deploy/images/qemux86-64/bzImage-qemux86-64.bin]
ROOTFS:
[/home/medim/work3/build/tmp-glibc/deploy/images/qemux86-64/og-image-consoleserver-dev-qemux86-64-20171218190955.rootfs.ext4]
FSTYPE: [ext4]
Setting up tap interface under sudoAcquiring lockfile for tap0...
Anyways, I have the following questions:
1- Can I mix -net and -netdev together. Looks like -net is deprecated
2- Say I want to have persistent devices, how to instruct runqemu(1)
or qemu-system-x86_64(1) to stay away from tap creation, and use
existing persistent taps.
3- Do you have any suggestions as how to fix this issue.
Thans
Medi