Created attachment 507476 [details, diff] fix USB device forwarding in app-emulation/virtualbox doesn't work if no USB device was plugged in before virtualbox was started, even though USB controller drivers were loaded and root hubs were present. Simple way to reproduce the problem: 1) Boot the system with absolutely no USB device plugged in (lsusb only shows root hubs), 2) Start virtualbox, 3) Plug in a USB device, 4) Observe that virtualbox says that no USB devices are plugged in. Similarly, if a USB device forwarding filter was set for the device that you had just plugged in it still wouldn't be forwarded to the VM, 5) Close virtualbox, wait a few seconds for VBoxSVC to terminate and then start virtualbox again, 6) See that now the USB device is visible and the USB forwarding filter does it job properly. This problem is actually caused by virtualbox USB proxy service not initializing correctly at virtualbox startup if "/dev/vboxusb" directory is missing. This directory is created by "/lib/udev/VBoxCreateUSBNode.sh" script when a first USB device is plugged in (crucially, USB hubs don't count). If no USB device was plugged in yet the "/dev/vboxusb" directory will not be created, so at virtualbox startup the USB proxy service will fail to initialize correctly and the USB forwarding will not be available for the whole virtualbox session. Exact failing call chain is: access("/dev/vboxusb") -> USBProxyLinuxCheckDeviceRoot (in VBox/Main/src-server/linux/USBGetDevices.cpp) -> USBProxyLinuxChooseMethod (in the same file) -> USBProxyBackendLinux::init (in VBox/Main/src-server/linux/USBProxyBackendLinux.cpp). A simple fix is to create the "/dev/vboxusb" directory even if the "/lib/udev/VBoxCreateUSBNode.sh" script was triggered by a hub event (this way it will be triggered by the root hubs appearing which they always do at controller initialization time). The creation of actual USB device nodes for these hubs will still get skipped, as is was before. A patch doing this is attached.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d087dca3521231a1e62ed53ab5a72795a0d2f0c9 commit d087dca3521231a1e62ed53ab5a72795a0d2f0c9 Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2018-02-16 14:39:42 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2018-02-16 14:56:06 +0000 app-emulation/virtualbox: Improved USB device detection. Closes: https://bugs.gentoo.org/639352 Package-Manager: Portage-2.3.24, Repoman-2.3.6 .../files/virtualbox-detect-usb-fix.patch | 24 ++++++++++++++++++++++ app-emulation/virtualbox/virtualbox-5.1.32.ebuild | 1 + app-emulation/virtualbox/virtualbox-5.2.6.ebuild | 1 + 3 files changed, 26 insertions(+)
Committed without a revbump since this is quite a corner case which won't affect many people. Also made upstream aware of this issue. Thanks for the report and patch!