Bug 12447 - Need TUN enabled in CROPS container to run QEMU
Summary: Need TUN enabled in CROPS container to run QEMU
Status: RESOLVED DUPLICATE of bug 10713
Alias: None
Product: CROPS
Classification: Yocto Project Subprojects
Component: crops-default (show other bugs)
Version: 2.5
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Todor Minchev
QA Contact: Toaster default assignee
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-12-22 02:14 UTC by Chin Huat Ang
Modified: 2017-12-22 17:07 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chin Huat Ang 2017-12-22 02:14:41 UTC
Here's how I tried to execute runqemu using Brian's prototype toolchain container, however runqemu failed complaining TUN is not enabled: 

parallels@ubuntu:~/sdk$ docker run --rm -it -v $PWD:$PWD bavery/scott:cross --workdir=$PWD --cmd="runqemu qemux86 $PWD/bzImage-qemux86.bin $PWD/MY_QEMU_ROOTFS"
sourcing /opt/poky/sdk/environment-setup-i586-poky-linux
runqemu - INFO - Can't find required *.qemuboot.conf in /home/parallels/sdk/MY_QEMU_ROOTFS
runqemu - INFO - Assuming /home/parallels/sdk/MY_QEMU_ROOTFS is an nfs rootfs
runqemu - INFO - Assuming MACHINE = qemux86
runqemu - INFO - Can't find qemuboot conf file, DEPLOY_DIR_IMAGE is NULL!
runqemu - INFO - Setting STAGING_DIR_NATIVE to OECORE_NATIVE_SYSROOT (/opt/poky/sdk/sysroots/x86_64-pokysdk-linux)
runqemu - INFO - Setting STAGING_BINDIR_NATIVE to /opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin
Traceback (most recent call last):
    File "/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu", line 1199, in <module>
      ret = main()
    File "/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu", line 1186, in main
      config.check_and_set()
    File "/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu", line 619, in check_and_set
      check_tun()
    File "/opt/poky/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu", line 103, in check_tun
      raise Exception("TUN control device %s is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)" % dev_tun)
Exception: TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)

I've also tried to workaround this by bind-mounting host /dev/net/tun (docker run ... -v /dev/net/tun:/dev/net/tun ...) but I prompted to enter pokyuser password which I don't know. But in any case this might not be a good idea as it will only work on Linux hosts.
Comment 1 Joshua Lock 2017-12-22 17:07:05 UTC
Enabling TAP devices in the container is difficult on Linux (requires root and doesn't play nicely with shared systems) and won't work at all on Windows or macOS. 

Instead we'll need to add slirp support as in https://bugzilla.yoctoproject.org/show_bug.cgi?id=10713

*** This bug has been marked as a duplicate of bug 10713 ***