# VirtualBox crashes when USB device attached



## pwr2srv (Sep 22, 2014)

Greetings all,

I'm only a newbie, but have been reading and using FreeBSD for some time now.  I began making a serious effort at FreeBSD just before 8.0 arrived, or thereabouts.  Trying to get away from Microsoft, but I have some software investment (mostly NT4 era apps) so I need a MS Windows virtual machine to run them.  I had for a time run NT4 to run the software, then Windows 2000, now XP.  I like the extra features with XP and the ability to run a few games.  I run many virtual machines in my FreeBSD host like Linux but mostly other FreeBSD's from which to learn.  I run one FreeBSD box on a AMD processor as a dedicated print server and a headless XP machine within that, for example.  Anyway, I'm to the point after a few years that I am not afraid of FreeBSD any more and am getting much better at fixing problems.  Also, I just recently got away from my older Pentium 4 and now run FreeBSD-amd64 on my new Lenovo TS140 dream machine.

I had just been running virtualbox-ose-4.3.12_1.  I have an XP virtual machine wherein USB was working fine.  E.g., the Microsoft Sidewinder Precision 2 Joystick, the Logitech USB Optical Mouse, the Logitech USB Keyboard, and SanDisk Cruzer devices were all listed and successfully passed to the XP virtual machine.

I keep my ports tree up to date.  When I built VirtualBox to virtualbox-ose-4.3.16 and started the XP  machine from the VirtualBox Manager the machine lists as “aborted.” If I remove the above listed USB devices the XP machine starts, but when I try to connect a USB device while the virtual machine is running I get the message:


```
Failed to attach the USB device Microsoft SideWinder Precision 2 Joystick to the virtual machine xpts2.
Failed to create a proxy device for the USB device. (Error: VERR_READ_ERROR).

Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
Console
Interface:
IConsole {8ab7c520-2442-4b66-8d74-4ff1e195d2b6}
```

and the the XP virtual machine crashes.

Since I keep backups of the installed packages, deleting virtualbox-ose-4.3.16 via pkg and re-installing virtualbox-ose-4.3.12_1 via pkg restores the XP virtual machine to a working state.

I have checked UPDATING.

So, this is the first time I'm asking for help.  Please be patient with me as I am in my 50's now and a bit beyond my formative years.

Thank YOU.


```
# uname -a
FreeBSD ts 10.0-RELEASE-p9 FreeBSD 10.0-RELEASE-p9 #0: Mon Sep 15 14:35:52 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## pwr2srv (Sep 23, 2014)

Also, as I just now started a FreeBSD virtual machine I was reminded that the mini toolbar is no longer is displayed.


----------



## robbak (Sep 26, 2014)

Have you found any solution to this issue? I have the same problem, and have worked around it by downgrading.

I am sending a message to emulation@freebsd.org to see if there is a fix.


----------



## pwr2srv (Sep 26, 2014)

No, just downgrading to work around.  I have been looking, though.  Just rebuilt again and the same thing.

here is my /var/log/messages

```
Sep 25 19:00:00 ts newsyslog[88259]: logfile turned over due to size>100K
Sep 25 19:15:18 ts pkg: libxul-24.8.0 deinstalled
Sep 25 19:15:20 ts pkg-static: libxul-24.8.1 installed
Sep 25 20:06:18 ts kernel: em0: promiscuous mode disabled
Sep 25 20:07:04 ts pkg: ca_root_nss-3.17 deinstalled
Sep 25 20:07:04 ts pkg-static: ca_root_nss-3.17.1 installed
Sep 25 20:07:38 ts pkg: py27-lxml-3.3.5 deinstalled
Sep 25 20:07:38 ts pkg-static: py27-lxml-3.4.0 installed
Sep 25 22:18:59 ts pkg: chromium-37.0.2062.120_3 deinstalled
Sep 25 22:19:01 ts pkg-static: chromium-37.0.2062.124 installed
Sep 25 23:47:25 ts pkg: firefox-32.0_2,1 deinstalled
Sep 25 23:47:26 ts pkg-static: firefox-32.0.3,1 installed
Sep 26 08:06:31 ts pkg: virtualbox-ose-4.3.12_1 deinstalled
Sep 26 08:06:34 ts pkg-static: virtualbox-ose-4.3.16 installed
Sep 26 09:46:41 ts kernel: em1: promiscuous mode enabled
Sep 26 09:47:22 ts kernel: pid 61605 (VirtualBox), uid 1001: exited on signal 11
Sep 26 09:47:22 ts kernel: em1: promiscuous mode disabled
Sep 26 09:52:11 ts kernel: em1: promiscuous mode enabled
Sep 26 09:52:44 ts kernel: pid 61618 (VirtualBox), uid 1001: exited on signal 11
Sep 26 09:52:44 ts kernel: em1: promiscuous mode disabled
Sep 26 10:11:52 ts kernel: em1: promiscuous mode enabled
Sep 26 10:12:33 ts kernel: pid 61680 (VirtualBox), uid 1001: exited on signal 10
Sep 26 10:12:33 ts kernel: em1: promiscuous mode disabled
```

Virtual machines will start with no USB devices attached and I think I see the mini toolbar display briefly.  Everything seems to work until a USB device is attached.


----------



## cederom (Sep 29, 2014)

Damn, just did a `pkg upgrade` and found this issue. This blocks my work :-( :-( :-(


----------



## robbak (Sep 30, 2014)

I haven't had any replies to my message to freebsd-emulators@. The next step is probably to file a bug report with Bugzilla

Edit: could you provide us a uname? Mine is: `$ uname -a`

```
FreeBSD boffin 9.3-STABLE FreeBSD 9.3-STABLE #1 r271733: Thu Sep 25 20:46:45 AEST 2014     robbak@boffin:/usr/obj/home/src/sys/GENERIC  amd64
```


----------



## z3tbl4 (Sep 30, 2014)

*H*i,

*S*ame stuff after `portupgrade -a`

```
FreeBSD alpha 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## pwr2srv (Sep 30, 2014)

`% uname -a`


```
FreeBSD ts 10.0-RELEASE-p9 FreeBSD 10.0-RELEASE-p9 #0: Mon Sep 15 14:35:52 UTC 2014     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## emmex (Oct 4, 2014)

HI,
the same bug here:

```
# uname -a
FreeBSD clover-nas2 9.3-STABLE FreeBSD 9.3-STABLE #0 r271760: Thu Sep 18 16:25:02 CEST 2014     ssh@clover-nas2:/usr/obj/usr/src/sys/GENERIC  amd64
```
with a Windows 7 VM.

And here:

```
# uname -a
FreeBSD ativ.local 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r272216: Sat Sep 27 21:53:55 CEST 2014     root@ativ.local:/usr/obj/usr/src/sys/NEWCONS  amd64
```
Virtual machines: Windows XP and Ubuntu.


----------



## z3tbl4 (Oct 4, 2014)

Btw as the problem apperas after updating the ports (not any system related sources) probably it is the VirtualBox itself, right?


----------



## robbak (Oct 5, 2014)

Yes, it seems clear that it is a regression in VirtualBox. The problem happens when you upgrade, and a workaround is to downgrade to the old version. I did this by building by own, although it might be easier to install a package if you have, or have kept, one.


```
mkdir virtualbox
cd virtualbox/
svn checkout svn://svn0.us-west.FreeBSD.org/ports/head/emulators/virtualbox-ose@367888 emulators/virtualbox-ose
svn checkout svn://svn0.us-west.FreeBSD.org/ports/head/emulators/virtualbox-ose-kmod@367888 emulators/virtualbox-ose-kmod
cd emulators/virtualbox-ose-kmod
make
sudo pkg delete virtualbox-ose-kmod
sudo make install virtualbox-ose-kmod
cd ../virtuabox-ose
make
sudo pkg delete virtualbox-ose
sudo make install virtualbox-ose
```

(If a mod wants to edit this to use [cmd] instead, you'll have to edit the cmd formatter to not collapse the URL first!)


----------



## emmex (Oct 6, 2014)

Just opened a PR  with Bugzilla: emulators/virtualbox-ose: crashes when USB device attached

Please add your comments here if you like.

Regards,
Maurizio


----------



## nakal (Oct 7, 2014)

It seems that downgrading emulators/virtualbox-ose and emulators/virtualbox-ose-kmod to 4.3.12_2 helps.


----------



## Crivens (Oct 9, 2014)

robbak said:
			
		

> Yes, it seems clear that it is a regression in VirtualBox. The problem happens when you upgrade, and a workaround is to downgrade to the old version. I did this by building by own, although it might be easier to install a package if you have, or have kept, one.
> 
> 
> ```
> ...



This seems not to work (at least not for me right now). There is a problem with the build failing due to 

```
kBuild: Generating /usr/home/XXX/Source/VirtualBox/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.12/out/freebsd.amd64/release/revision.kmk
/usr/local/bin/kmk_redirect -E 'LC_ALL=C' -wo /usr/home/XXX/Source/VirtualBox/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.12/out/freebsd.amd64/release/revision.kmk.ts.tmp -- svn info /usr/home/XXX/Source/VirtualBox/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.12
svn: warning: W155010: The node '/usr/home/XXX/Source/VirtualBox/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.12' was not found.
```
This is done as normal user on a "10.1-BETA3 FreeBSD 10.1-BETA3 #7 r272295:" system.
Before I dive into this headlong I'd like to ask if it is something obvious and well known.


----------



## z3tbl4 (Oct 9, 2014)

Crivens said:
			
		

> This seems not to work (at least not for me right now). There is a problem with the build failing due to
> 
> ```
> kBuild: Generating /usr/home/XXX/Source/VirtualBox/emulators/virtualbox-ose-kmod/work/VirtualBox-4.3.12/out/freebsd.amd64/release/revision.kmk
> ...


+1


----------



## Crivens (Oct 10, 2014)

Small update. After `rm -rf .svn` in the -kmod directory, this one now builds without issues. The build for -ose is currently running, but I think this is/was the problem.

Okay, virtualbox-ose has built. You need to take care that you first install the kernel module, otherwise the `make install` will try to install the kernel module from /usr/ports.


----------



## Anti_Evil (Nov 18, 2014)

Same problem here, just did an upgrade of FreeBSD (to 10.1) and packages (Virtualbox to 4.3.16) , and now when I attach the USB device to the VM machine, I get the same error message. Is it possible to downgrade the version with the pkg command?

Thanks.


----------



## Anti_Evil (Nov 18, 2014)

Anti_Evil said:


> Same problem here, just did an upgrade of FreeBSD (to 10.1) and packages (Virtualbox to 4.3.16) , and now when I attach the USB device to the VM machine, I get the same error message. Is it possible to downgrade the version with the pkg command?
> 
> Thanks.



I followed the workaround described by robbak and it just worked fine 
I'd like to know if this issue is resolved in 4.3.18.


----------



## Anti_Evil (Nov 22, 2014)

I just tried to compile the virtualbox-ose-kmod (ver:4.3.12_2 rev:367888) on another FreeBSD machine:
	
	



```
FreeBSD fbsd-pc 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```
During compile I got below error messages:
	
	



```
kBuild: Pass - DLLs
kBuild: Pass - Programs
kBuild: Compiling wrapper - /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/lib/wrapper.c
kmk_builtin_cp -f /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/config.h.freebsd /usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed/config.h
kmk_builtin_cp -f /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/lib/regex_.h /usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed/regex.h
kBuild: Compiling kmk_sed - /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/sed/sed.c
kBuild: Compiling kmk_sed - /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/lib/regex.c
In file included from /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/basicdefs.h:46:0,
  from /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/sed/sed.h:23,
  from /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/sed/sed.c:23:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd10.0/4.8.3/include-fixed/wchar.h:90:1: error: unknown type name '__wchar_t'
typedef __wchar_t wchar_t;
^
kmk: *** [/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed/sed/sed.o] Error 1
The failing command:
@gcc48 -c -O2 -g -O3 -m64 -I/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed -I/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed -I/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/lib -I/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/intl -I/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/lib -I/usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/kmk/glob -I/usr/local/include -DKBUILD_VERSION_MAJOR=0 -DKBUILD_VERSION_MINOR=1 -DKBUILD_VERSION_PATCH=9998 -DKBUILD_OS_FREEBSD -DKBUILD_ARCH_AMD64 -DHAVE_CONFIG_H -DNDEBUG -Wp,-MD,/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed/sed/sed.o.dep -Wp,-MT,/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed/sed/sed.o -Wp,-MP -o /usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/obj/kmk_sed/sed/sed.o /usr/ports/devel/kBuild/work/kBuild-0.1.9998/src/sed/sed/sed.c
kmk: *** Waiting for unfinished jobs....
kmk: Leaving directory `/usr/ports/devel/kBuild/work/kBuild-0.1.9998'
kmk: Entering directory `/usr/ports/devel/kBuild/work/kBuild-0.1.9998'
kmk: *** Exiting with status 2
bootstrap.gmk:221: recipe for target '/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/bootstrap/ts-stage2-build' failed
gmake[4]: *** [/usr/ports/devel/kBuild/work/kBuild-0.1.9998/out/freebsd.amd64/release/bootstrap/ts-stage2-build] Error 2
gmake[4]: Leaving directory '/usr/ports/devel/kBuild/work/kBuild-0.1.9998'
./kBuild/env.sh: info: rc=2: gmake -f bootstrap.gmk
*** Error code 2

Stop.
make[3]: stopped in /usr/ports/devel/kBuild
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/kBuild
*** Error code 1

Stop.
make[1]: stopped in /root/virtualbox_4-3-12/emulators/virtualbox-ose-kmod
*** Error code 1

Stop.
make: stopped in /root/virtualbox_4-3-12/emulators/virtualbox-ose-kmod
```
Can you please help me? Thanks.


----------



## epopen (Nov 26, 2014)

Hi all.

I had been upgraded to emulators/virtualbox-ose revision 4.3.20. And removed/reinstalled all of ports. Got the same problem.

Thanks a lot.


----------



## Chester Wisniewski (Dec 15, 2014)

A workaround is to install the current kBuild from binary. Then VirtualBox can be built without issue. `pkg install kBuild`.


----------



## max21 (Feb 12, 2015)

Chester Wisniewski said:


> A workaround is to install the current kBuild from binary. Then VirtualBox can be built without issue. `pkg install kBuild`.


Will it still work if we build kBuild from port?

 I’m working on a minimal install as possible of everything beginning with x11-servers.  I'm at QT5 and I hope I have not screwed up again by not installing QT4.  All of this is for MATE on my new FreeBSD 10.1 …  I wiped and reinstalled 8X already before getting to this point.


----------



## max21 (Feb 12, 2015)

Oh, iI see, the OP tried already.  I'm going to have to stop skipping.  This got to be the best heads-up ever for Virtualbox on these more advanced versions of FreeBSD.  Thank you Chester Wisniewski.

Ahh ... I just got a notion, it's going to be days before I get to Virtualbox so what I'll do is activate every sensible, if not all kBuild options.  `portmaster -dwv` will help to take care of everything.  Everything else will have only what's needed, and nothing that's not.


----------

