Created attachment 241544 [details] patch from 6.1.36 to 6.1.42 and llvm14 $ uname -srvK FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n262122-2ef2c26f3f13: Thu Apr 13 08:06:35 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC 1400086 $ VBoxManage --version 6.1.42r155177 $ VBoxManage startvm bar --type gui I've attached the VBox.log and git diff At first glance, doesn't appear to be a permissions issue but a change in the USB API in Current. John groenveld@acm.org
Created attachment 241545 [details] VBox.log VBox.log correlates the GUI Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER) 00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6', rc=VERR_INVALID_PARAMETER 00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2
(In reply to groenveld from comment #0) Almost certainly a change in CURRENT as it works here: $ uname -srvKU FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n262010-f21faa67ab6b: Thu Apr 6 07:56:57 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC 1400085 1400085 John groenveld@acm.org
Reproduced with 6.1.44. John groenveld@acm.org $ pkg info virtualbox-ose virtualbox-ose-6.1.44_1 Name : virtualbox-ose Version : 6.1.44_1 Installed on : Fri May 19 11:31:57 2023 EDT Origin : emulators/virtualbox-ose Architecture : FreeBSD:14:amd64 Prefix : /usr/local Categories : emulators Licenses : GPLv2 Maintainer : vbox@FreeBSD.org WWW : https://www.virtualbox.org/ Comment : General-purpose full virtualizer for x86 hardware Options : AIO : on ALSA : off DBUS : on DEBUG : off GUESTADDITIONS : off MANUAL : off NLS : on OPUS : off PYTHON : off QT5 : on R0LOGGING : off UDPTUNNEL : on VDE : off VNC : on VPX : off WEBSERVICE : on X11 : on Shared Libs required: libxml2.so.2 libxcb.so.1 libvncserver.so.1 libpng16.so.16 libcurl.so.4 libXt.so.6 libXext.so.6 libXcursor.so.1 libX11.so.6 libSDL-1.2.so.0 libQt5X11Extras.so.5 libQt5Widgets.so.5 libQt5PrintSupport.so.5 libQt5OpenGL.so.5 libQt5Gui.so.5 libQt5Core.so.5 libGL.so.1 Annotations : FreeBSD_version: 1400088 cpe : cpe:2.3:a:oracle:vm_virtualbox:6.1.44:::::freebsd14:x64:1 Flat size : 165MiB Description : Oracle VM VirtualBox is a hosted hypervisor for x86 virtualisation. Supported guests include BSD, Haiku, Linux, OS/2, ReactOS, Solaris and Windows. Guest Additions are available from: emulators/virtualbox-ose-additions For the Extension Pack: FreeBSD is not a supported host platform. Installation of the Pack will not extend the feature set. WWW: https://www.virtualbox.org/
This *might* be fallout from this commit: commit 9b077d72bcc313baea2b9283afc7f568739eaadc Author: Hans Petter Selasky <hselasky@FreeBSD.org> Date: Fri Mar 31 19:14:18 2023 +0200 usb(4): Separate the fast path and the slow path to avoid races and use-after-free for the USB FS interface. The error message, "Failed to create a proxy device for the USB device" is here: ./work/VirtualBox-6.1.46/src/VBox/Main/src-client/ConsoleImpl.cpp The error message, "usbProxyConstruct: Failed to open" is here: ./work/VirtualBox-6.1.46/src/VBox/Devices/USB/USBProxyDevice.cpp Not sure what are the underlying calls to the USB(4). John groenveld@acm.org
Here's the vbox.log snippet with debug enabled. 00:00:19.593390 usbProxyConstruct: Failed to open '/dev/ugen0.2', rc=VERR_INVALID_PARAMETER 00:00:19.594118 00:00:19.594121 !!Assertion Failed!! 00:00:19.594122 Expression: <NULL> 00:00:19.594125 Location : /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.46/src/VBox/VMM/VMMR3/PDMUsb.cpp(717) int pdmR3UsbCreateDevice(PVM, PPDMUSBHUB, PPDMUSB, int, PCRTUUID, PCFGMNODE *, VUSBSPEED, const char *) 00:00:19.594190 Stack : 00:00:19.594191 00000008221982e7 00:00:19.594193 00:00:19.594275 Failed to construct 'USBProxy'/0! VERR_INVALID_PARAMETER (-2) - Invalid parameter. In order to build emulators/virtualbox-ose I needed to rebuild devel/gsoap with debug enabled. A quick kludge: git diff diff --git a/devel/gsoap/Makefile b/devel/gsoap/Makefile index 253374b56909..9b2eaf9c601b 100644 --- a/devel/gsoap/Makefile +++ b/devel/gsoap/Makefile @@ -26,7 +26,7 @@ PORTSCOUT= limit:^2\.8\.[0-9][0-9][0-9]$ WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:R} -OPTIONS_DEFINE= IPV6 +OPTIONS_DEFINE= IPV6 OPTIONS_DEFAULT= IPV6 OPENSSL OPTIONS_RADIO= SSL OPTIONS_RADIO_SSL= GNUTLS OPENSSL @@ -35,7 +35,7 @@ GNUTLS_LIB_DEPENDS= libgcrypt.so:security/libgcrypt \ libgpg-error.so:security/libgpg-error GNUTLS_CONFIGURE_ON= --enable-gnutls GNUTLS_LDFLAGS= -L${LOCALBASE}/lib -IPV6_CONFIGURE_ENABLE= ipv6 +IPV6_CONFIGURE_ENABLE= ipv6 debug OPENSSL_CONFIGURE_ENABLE= ssl post-patch: John groenveld@acm.org
USBProxyDevice-freebsd.cpp usbProxyFreeBSDFsInit calls usbProxyFreeBSDDoIoCtl which issues iCmd=0x801055c3 which returns 22 which converts to -2. John groenveld@acm.org
Hi, after reverting 9b077d72bcc313baea2b9283afc7f568739eaadc all works fine again FreeBSD laptop.domain 15.0-CURRENT FreeBSD 15.0-CURRENT #24 main-n265517-37236ab7e4e8-dirty: Tue Oct 17 18:00:07 +03 2023 root@laptop.domain:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 virtualbox-ose-6.1.46
(In reply to Sergey V. Dyatko from comment #7) git revert 9b077d72bcc313baea2b9283afc7f568739eaadc with releng/14.0 branch also fixed 14.0-RC2. John groenveld@acm.org
After upgrade to 14.0-RELEASE, usb passtrought stops working. I can see this lines in the logfile: 00:00:00.251832 usbProxyConstruct: Failed to open '/dev/ugen0.2', rc=VERR_INVALID_PARAMETER 00:00:00.251988 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: V ERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2
(In reply to Alex Soto Aguilera from comment #9) I baypassed this error with my device "Conbee II" trough serial port bypass. In case anyone has the same problem I solved it like this: vboxmanage modifyvm homeassistant --uart1 0x2E8 3 vboxmanage modifyvm homeassistant --uartmode1 /dev/ttyU0
Created attachment 248190 [details] USB passthrough fix after 9b077d72bcc313baea2b9283afc7f568739eaadc after 9b077d72bcc313baea2b9283afc7f568739eaadc this was changed - if (fs_ep_ptr == NULL || ep_index_max > 127) + if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX) where USB_FS_XFER_MAX defined as 126 but in src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp USBFBSD_MAXENDPOINTS defined as 127 so change it to 126. patch attached.
(In reply to Igor Malyshev from comment #11) Thank you. Tested on 14.0-RELEASE-p4 John groenveld@acm.org $ cat files/patch-src_VBox_Devices_USB_freebsd_USBProxyDevice-freebsd.cpp --- src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp.orig 2024-01-11 12:23:15 UTC +++ src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp @@ -57,7 +57,7 @@ #include "../USBProxyDevice.h" /** Maximum endpoints supported. */ -#define USBFBSD_MAXENDPOINTS 127 +#define USBFBSD_MAXENDPOINTS 126 #define USBFBSD_MAXFRAMES 56 /** This really needs to be defined in vusb.h! */
FWIW, I was just bitten by this issue on FreeBSD 13.3-STABLE, because the relevant commit 9b077d72 to /usr/src/ that broke Virtualbox USB passthrough was cherry-picked into 13/stable in commit 53e253c7. So the patch provided in the attachment is necessary in the 13.x branch after that commit. I have confirmed that applying the patch does indeed fix the broken USB issue, and after adding the patch to the ports tree and rebuilding, I can connect to the USB device I was trying to attach.
The same problem here on releng/14.1-n267679-10e31f0946d8 vbox 6.1.50 :-(
bhyve is not an option here because single port cannot be selected on laptop right? i have only two usb ports so not possible to redirect usb controller to vmm too. embedded development on vm is blocked due to this bug :-(
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=4b9b21dfcdc6a213b8b9842dbc7ea8dd8fcd48e3 commit 4b9b21dfcdc6a213b8b9842dbc7ea8dd8fcd48e3 Author: Igor Malyshev <bsd@itglob.ru> AuthorDate: 2024-07-20 09:31:14 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-07-20 09:35:41 +0000 emulators/virtualbox-ose{,-nox11}-legacy: fix USB passthrough fails with: Failed to create a proxy device for the USB device Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER) 00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6', rc=VERR_INVALID_PARAMETER 00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2 In commit https://cgit.freebsd.org/src/commit/?id=9b077d72bcc313baea2b9283afc7f568739eaadc +#define USB_FS_XFER_MAX 126 - if (fs_ep_ptr == NULL || ep_index_max > 127) + if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX) To fix VirtualBox decrease USBFBSD_MAXENDPOINTS from 127 to 126: -#define USBFBSD_MAXENDPOINTS 127 +#define USBFBSD_MAXENDPOINTS 126 PR: 270900 Tested by: groenveld@acm.org, russo@bogodyn.org Approved by: with hat of vbox (maintainer) MFH: 2024Q3 emulators/virtualbox-ose-legacy/Makefile | 2 +- ...atch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp (new) | 11 +++++++++++ emulators/virtualbox-ose-nox11-legacy/Makefile | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=fb231153bf5b66737effcc6b2ca22296893d7510 commit fb231153bf5b66737effcc6b2ca22296893d7510 Author: Igor Malyshev <bsd@itglob.ru> AuthorDate: 2024-07-20 09:19:29 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-07-20 09:35:41 +0000 emulators/virtualbox-ose{,-nox11}: fix USB passthrough fails with: Failed to create a proxy device for the USB device Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER) 00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6', rc=VERR_INVALID_PARAMETER 00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2 In commit https://cgit.freebsd.org/src/commit/?id=9b077d72bcc313baea2b9283afc7f568739eaadc +#define USB_FS_XFER_MAX 126 - if (fs_ep_ptr == NULL || ep_index_max > 127) + if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX) To fix VirtualBox decrease USBFBSD_MAXENDPOINTS from 127 to 126: -#define USBFBSD_MAXENDPOINTS 127 +#define USBFBSD_MAXENDPOINTS 126 PR: 270900 Tested by: groenveld@acm.org, russo@bogodyn.org Approved by: with hat of vbox (maintainer) MFH: 2024Q3 emulators/virtualbox-ose-nox11/Makefile | 2 +- emulators/virtualbox-ose/Makefile | 2 +- ...atch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp (new) | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
A commit in branch 2024Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=873b08a9cff17f72029df8a6464855b631f16316 commit 873b08a9cff17f72029df8a6464855b631f16316 Author: Igor Malyshev <bsd@itglob.ru> AuthorDate: 2024-07-20 09:31:14 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-07-20 09:38:47 +0000 emulators/virtualbox-ose{,-nox11}-legacy: fix USB passthrough fails with: Failed to create a proxy device for the USB device Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER) 00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6', rc=VERR_INVALID_PARAMETER 00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2 In commit https://cgit.freebsd.org/src/commit/?id=9b077d72bcc313baea2b9283afc7f568739eaadc +#define USB_FS_XFER_MAX 126 - if (fs_ep_ptr == NULL || ep_index_max > 127) + if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX) To fix VirtualBox decrease USBFBSD_MAXENDPOINTS from 127 to 126: -#define USBFBSD_MAXENDPOINTS 127 +#define USBFBSD_MAXENDPOINTS 126 PR: 270900 Tested by: groenveld@acm.org, russo@bogodyn.org Approved by: with hat of vbox (maintainer) MFH: 2024Q3 (cherry picked from commit 4b9b21dfcdc6a213b8b9842dbc7ea8dd8fcd48e3) emulators/virtualbox-ose-legacy/Makefile | 2 +- ...atch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp (new) | 11 +++++++++++ emulators/virtualbox-ose-nox11-legacy/Makefile | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-)
A commit in branch 2024Q3 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=1a6d06fb4120fc253a48b3b95342748ddd2a651f commit 1a6d06fb4120fc253a48b3b95342748ddd2a651f Author: Igor Malyshev <bsd@itglob.ru> AuthorDate: 2024-07-20 09:19:29 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-07-20 09:38:25 +0000 emulators/virtualbox-ose{,-nox11}: fix USB passthrough fails with: Failed to create a proxy device for the USB device Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER) 00:00:24.961804 usbProxyConstruct: Failed to open '/dev/ugen0.6', rc=VERR_INVALID_PARAMETER 00:00:24.961881 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Failed to create a proxy device for the USB device. (Error: VERR_INVALID_PARAMETER)}, preserve=false aResultDetail=-2 In commit https://cgit.freebsd.org/src/commit/?id=9b077d72bcc313baea2b9283afc7f568739eaadc +#define USB_FS_XFER_MAX 126 - if (fs_ep_ptr == NULL || ep_index_max > 127) + if (fs_ep_ptr == NULL || ep_index_max > USB_FS_XFER_MAX) To fix VirtualBox decrease USBFBSD_MAXENDPOINTS from 127 to 126: -#define USBFBSD_MAXENDPOINTS 127 +#define USBFBSD_MAXENDPOINTS 126 PR: 270900 Tested by: groenveld@acm.org, russo@bogodyn.org Approved by: with hat of vbox (maintainer) MFH: 2024Q3 (cherry picked from commit fb231153bf5b66737effcc6b2ca22296893d7510) emulators/virtualbox-ose-nox11/Makefile | 2 +- emulators/virtualbox-ose/Makefile | 2 +- ...atch-src_VBox_Devices_USB_USBProxyDevice-freebsd.cpp (new) | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
Thanks for patch and testing!