Public Service Announcement: VirtualBox 3, HAL, and NetworkManager

This is your /sys/bus/usb/drivers on VirtualBox 3
/sys/bus/usb/drivers with VirtualBox 3  (pic by mirmurr.blogspot.com)

Ever since VirtualBox 3 came out, we’ve had random reports of mobile broadband cards not working with NetworkManager 0.7.x.  Here’s why:  VirtualBox 3 thinks it’s hilarious to screw around with sysfs.  You don’t even have to run it, you just have to install it.

/sys/bus/usb/drivers without VirtualBox:

[dcbw@localhost ~]$ ls -al /sys/bus/usb/drivers
total 0
drwxr-xr-x. 15 root root 0 2009-10-14 14:33 .
drwxr-xr-x.  4 root root 0 2009-10-14 14:31 ..
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 btusb
drwxr-xr-x.  2 root root 0 2009-10-14 14:33 cdc_acm
drwxr-xr-x.  2 root root 0 2009-10-14 14:33 cdc_ether
drwxr-xr-x.  2 root root 0 2009-10-14 14:33 cdc_wdm
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 hiddev
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 hub
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 qcserial
drwxr-xr-x.  2 root root 0 2009-10-14 14:33 usb
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 usbfs
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 usbhid
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 usbserial
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 usbserial_generic
drwxr-xr-x.  2 root root 0 2009-10-14 15:40 uvcvideo

/sys/bus/usb/drivers with VirtualBox 3:

[dcbw@localhost ~]$ ls -al /sys/bus/usb/drivers
total 0
drwxr-xr-x. 10 root root 0 2009-10-14 00:03 .
drwxr-xr-x.  4 root root 0 2009-10-14 00:04 ..
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 001
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 002
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 003
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 004
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 005
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 006
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 007
dr-xr-xr-x.  2 root root 0 2009-10-14 00:03 008
-r--r--r--.  1 root root 0 2009-10-14 01:44 devices

That’s obviously wrong.  And your sysfs USB device links still point to their driver in /sys/bus/usb/drivers and thus are completely broken:

[dcbw@localhost ~]$ ls -al /sys/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/driver
lrwxrwxrwx. 1 root root 0 2009-10-14 02:20 /sys/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/driver -> ../../../../../../bus/usb/drivers/option

FAIL

Then HAL can’t determine the device’s driver because VirtualBox busted the link, and thus the modem will fail to be recognized by NetworkManager.  No 3G for you!  You can work around this with a HAL .fdi file:

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- xml -*- -->
 <deviceinfo version="0.2">
   <device>
     <match key="info.subsystem" string="usb">
       <match key="usb.vendor_id" int="0x0af0">
         <match key="usb.product_id" int_outof="0x6701">
           <merge key="info.linux.driver" type="string">option</merge>
         </match>
       </match>
     </match>
   </device>
 </deviceinfo>

Drop that (after fixing the USB IDs and driver for your device) into /usr/share/hal/fdi/information/20thirdparty/10-vbox-usb-fixup.patch and replug your modem.  Or uninstall VirtualBox.  Or revert to VirtualBox 2.  Or update to NetworkManager 0.8.x snapshots.

You have been served.

VirtualBox devs, any chance you can stop messing with sysfs?  I can file a bug if you like…

mirmurr.blogspot.co

3 thoughts on “Public Service Announcement: VirtualBox 3, HAL, and NetworkManager”

  1. Ewww. That sounds like they are mounting usbfs over /sys/bus/usb/devices. If programs use usbfs at all, wouldn’t they expect to find it in /proc/bus/usb?

    If that’s the case, does unmounting usbfs make a difference?

  2. Hmm, interesting. I’ll have to check that out, thanks! Could just be an installer mistake, but if something in VB depends on it being there that’s a bug I could file I guess. Sucks that it breaks HAL though.

  3. The only apps I’ve seen that needed usbfs were ones compiled against old versions of libusb (new versions make do with the /dev/bus/usb tree maintained by udev).

    If VirtualBox really does depend on usbfs being mounted there under /sys, that is particularly brain dead: you’d never end up with that configuration even by copying what other people do.

Comments are closed.