Bug 8587 - runqemu deletes preconfigured tap on exit
Summary: runqemu deletes preconfigured tap on exit
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.0
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.1 M4
Assignee: Saul Wold
QA Contact: Mihail Stanciu
URL:
Whiteboard:
: 8804 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-27 12:27 UTC by Mihail Stanciu
Modified: 2016-04-07 19:15 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: Regression (Used to work)
Verified:
Documentation change: Yes (doc changes required)


Attachments
full runqemu output (17.24 KB, text/plain)
2015-10-30 14:26 UTC, Mihail Stanciu
no flags Details
full runqemu output ubuntu (17.29 KB, text/plain)
2015-10-30 14:36 UTC, Mihail Stanciu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mihail Stanciu 2015-10-27 12:27:52 UTC
Tested on master: 505a82673ac2487df5ea343a6422c2fc47018831
OS affected: Fedora 22, CentOS 7.1

During distro testing for 2.0 rc2 found that qemu will delete the tap file it uses on quit on fedora and centos.

Taps were configured using the runqemu-gen-tapdevs script at system startup.

This caused all remaining tests to fail, because qemu was using the IPs for the lower taps(192.168.7.2, 4 and 6) which no longer existed on the host machine(192.168.7.1, 3 and 5) - our machines are configured to run at most 3 processes in parallel.
Comment 1 Ross Burton 2015-10-27 14:35:03 UTC
Is this on the QA autobuilder machines?  I wonder how this works on the main autobuilder.
Comment 2 Mihail Stanciu 2015-10-27 14:44:58 UTC
(In reply to comment #1)
> Is this on the QA autobuilder machines?  I wonder how this works on the main
> autobuilder.

Yes, it's on the QA machines. 

It is my understanding that the main autobuilder doesn't have this issue, so I'm inclined to believe this is something to do with our local configuration, but I haven't been able to identify where the difference between the main AB and our AB is.
Comment 3 Paul Eggleton 2015-10-29 13:42:51 UTC
Can we have the logs (the runqemu output specifically) for the first time runqemu was executed and apparently deleted the tap device?
Comment 4 Mihail Stanciu 2015-10-30 09:21:47 UTC
(In reply to comment #3)
> Can we have the logs (the runqemu output specifically) for the first time
> runqemu was executed and apparently deleted the tap device?

Continuing with the following parameters:
KERNEL: [/home/autobuilder/yocto-autobuilder/yocto-worker/nightly-mips/build/build/tmp/deploy/images/qemumips/vmlinux-qemumips.bin]
ROOTFS: [/home/autobuilder/yocto-autobuilder/yocto-worker/nightly-mips/build/build/tmp/deploy/images/qemumips/core-image-minimal-qemumips-20151029181503.rootfs.ext4]
FSTYPE: [ext4]
Acquiring lockfile for tap0...
Using preconfigured tap device 'tap0'
If this is not intended, touch /tmp/qemu-tap-locks/tap0.skip to make runqemu skip tap0.
Running qemu-system-mips...
/home/autobuilder/yocto-autobuilder/yocto-worker/nightly-mips/build/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-mips -kernel /home/autobuilder/yocto-autobuilder/yocto-worker/nightly-mips/build/build/tmp/deploy/images/qemumips/vmlinux-qemumips.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -M malta -drive file=/home/autobuilder/yocto-autobuilder/yocto-worker/nightly-mips/build/build/tmp/deploy/images/qemumips/core-image-minimal-qemumips-20151029181503.rootfs.ext4,format=raw -no-reboot -vga cirrus -show-cursor -usb -usbdevice wacom-tablet -no-reboot -m 256 -serial mon:vc -serial null --append "root=/dev/hda rw console=ttyS0 console=tty ip=192.168.7.2::192.168.7.1:255.255.255.0 mem=256M rootfstype=ext4 "
Releasing lockfile of preconfigured tap device 'tap0'
Comment 5 Mihail Stanciu 2015-10-30 14:26:38 UTC
Created attachment 2834 [details]
full runqemu output

Attaching full runqemu output with debug output on Fedora 22.

To note: interface is taken down AFTER runqemu script ends execution.
Comment 6 Mihail Stanciu 2015-10-30 14:36:13 UTC
Created attachment 2835 [details]
full runqemu output ubuntu

Full runqemu debug output on Ubuntu 15.04

To note: tap interface still remains up after scripts finish running.
Comment 7 Cristian Iorga 2015-10-30 14:54:45 UTC
Investigation started.
Comment 8 Cristian Iorga 2015-10-30 14:55:53 UTC
At this point this issue seems to be caused by bad management of Fedora 22 TAP interfaces.
Comment 9 Cristian Iorga 2015-10-30 15:12:45 UTC
If NetworkManager is stopped, the issue does not reproduce. Looking into a proper fix.
Comment 10 Mihail Stanciu 2015-10-30 15:30:58 UTC
NetworkManager version on Fedora 22 machine:
[autobuilder@FedoraAB ~]$ /usr/sbin/NetworkManager -V
1.0.6-6.fc22
Comment 11 Daniel Istrate 2015-10-30 15:33:30 UTC
Reproduced on Fedora 21:

[daniel@fedora-ws poky-build-M3]$ sudo NetworkManager --version
0.9.10.2-5.fc21
[daniel@fedora-ws poky-build-M3]$ cat /etc/*release*
Fedora release 21 (Twenty One)
cat: /etc/lsb-release.d: Is a directory
NAME=Fedora
VERSION="21 (Twenty One)"
ID=fedora
VERSION_ID=21
PRETTY_NAME="Fedora 21 (Twenty One)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:21"
HOME_URL="https://fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=21
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=21
Fedora release 21 (Twenty One)
Fedora release 21 (Twenty One)
cpe:/o:fedoraproject:fedora:21
[daniel@fedora-ws poky-build-M3]$ uname -a
Linux fedora-ws 4.1.8-100.fc21.x86_64 #1 SMP Tue Sep 22 12:13:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[daniel@fedora-ws poky-build-M3]$
Comment 12 Beth Flanagan 2015-10-30 16:10:03 UTC
Autobuilder wise, we've documented these issues:

http://git.yoctoproject.org/cgit/cgit.cgi/yocto-autobuilder/commit/?id=b1f2f0cd4b29edbdb167c95238520c72d6d11649

and

http://git.yoctoproject.org/cgit/cgit.cgi/yocto-autobuilder/commit/?id=218d57081f1ef74308c145866d3a522207d3f375

It has been suggested that the autobuilder should be setting up the tap devices. I'm very opposed to the autobuilder messing around with end users networking as there is too much that could go wrong there. The possible fixes here are to either document it (which we've done) or fix NetworkManager.
Comment 13 Cristian Iorga 2015-10-30 16:48:46 UTC
Alternative solutions:

http://support.qacafe.com/knowledge-base/how-do-i-prevent-network-manager-from-controlling-an-interface/

1. Tell Network Manager to stop controlling the interfaces used by the test configuration
2. Stop the Network Manager process
3. Remove the Network Manager software from the system

Solution 1. might be handy to implement.
Comment 14 Mihail Stanciu 2016-02-04 10:13:36 UTC
*** Bug 8804 has been marked as a duplicate of this bug. ***
Comment 15 Saul Wold 2016-02-10 17:15:48 UTC
Pushing to M3 due to change of resources
Comment 16 Richard Purdie 2016-03-09 11:52:14 UTC
I suspect the easiest solution is to modify uilt/path.c in qemu such that it doesn't interate all paths at the start but does so "on demand". This would avoid it walking pieces of the tree it never uses.
Comment 17 Richard Purdie 2016-03-09 13:24:54 UTC
Comment on the wrong bug, sorry.
Comment 18 Saul Wold 2016-03-28 23:10:10 UTC
For NetworkManager.conf, the best solution would be to add a line in the conf 
file that marks the tap* devices as unmanaged

[keyfile]
unmanaged-devices=interface-name:tap*
Comment 19 Mihail Stanciu 2016-03-30 10:57:06 UTC
(In reply to comment #18)
> For NetworkManager.conf, the best solution would be to add a line in the
> conf 
> file that marks the tap* devices as unmanaged
> 
> [keyfile]
> unmanaged-devices=interface-name:tap*

I'll look into doing this as soon as the machines in question are free. Right now they're running builds for M3.rc2.
Comment 20 Mihail Stanciu 2016-04-01 11:33:14 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > For NetworkManager.conf, the best solution would be to add a line in the
> > conf 
> > file that marks the tap* devices as unmanaged
> > 
> > [keyfile]
> > unmanaged-devices=interface-name:tap*
> 
> I'll look into doing this as soon as the machines in question are free.
> Right now they're running builds for M3.rc2.

The workaround seems to have done the trick. So far the tap interfaces have not been deleted by running one test.
Will leave a full set of builds to run over the weekend, but I don't expect things to fail.
Will update should there be a problem.
Comment 21 Mihail Stanciu 2016-04-04 13:09:13 UTC
Confirmed everything works.