Public Service Announcement: Don’t believe the Internet

My apologies to the VirtualBox team.  The problem appears to be users who are either (a) following really old VirtualBox recommendations that don’t even apply to their version, or (b) the age-old open-source problem of:

I found a HOW-TO that suggesting adding the following line to my /etc/fstab:
none /sys/bus/usb/drivers usbfs devgid=501,devmode=664 0 0

Don’t believe the Internet…  especially if it asks for sysadmin privileges.

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

Whipping out the pipe snake

Not done yet; room for two more...
Can’t go home till the plumbing is done

… to get down and dirty with your wifi card.  Really, get your mind out of the gutter.  Lets keep this PG shall we?

The Wireless Summit, LinuxCon, and Linux Plumbers Conference were all two weeks ago, where the Wireless Cartel of Awesome met to unclog the drain of Linux wireless with the righteous hand of glory.  We solved world peace while simultaneously making the earth safe for Democracy, David Zeuthen’s favorite pink pony, and a bunch of cute fuzzy kittens.  But that’s boring.  Instead, two other things deserve your attention:

Background Scanning

As of the 2.6.32 kernel WiFi scans requested while connected to an access point are background scans.  The mac80211 stack will spread the scan out over about 30 seconds, jumping back to the associated AP’s channel every so often so it doesn’t stall your traffic.  We’ve actually done this in the OLPC Libertas for a long time, and now everyone on the block gets it.  There’s been any number of bugs open about NetworkManager’s scan behavior, including misguided requests for huge fat “Don’t scan while connected” checkboxes in the UI.  And now that’s been fixed upstream.  Oh, bought a Ralink card or a Broadcom?  Sorry, better luck next time.  This is why you buy hardware that actually works with Linux, so that the Gods of Kernel Wireless will rock your card, and you won’t be stuck with dead-end shit that never gets better.  But maybe pain floats your boat.  If you bought Intel or Atheros then you’re awesome.

Sometimes people stop me on the street and ask me why we want to scan periodically.  Here’s what I tell them.  Besides enabling location-based services (which help me find great candle-lit bistros for dates with your mom) there’s one super-important reason: roaming.  Not just between networks, but also between APs in the same network.  If the wifi card doesn’t have an up-to-date scan list, you’ll take the hit anyway at the worst possible moment: when your back is against the wall, the gun’s in your face, and you have to switch APs or lose the connection entirely.  So better do it while you can.  Only have one AP at your place and don’t need roaming?  That’s nice, but writing software is about making things work smoothly for everybody.  Which is what background scanning is all about.

wpa_supplicant D-Bus Interface 2.0

Over the summer, Witold Sowa rocked AP mode support in NetworkManager (though I still have to merge it), and as part of that hugely rewrote the D-Bus interface to wpa_supplicant that I wrote back in 2007.  In conjunction with the upstream mac80211-based kernel drivers (sorry Broadcom and ralink, no soup for you) we’ll get better failure information, finer-grained control over wifi connections, faster reconnections, better handling of link dropouts, AP mode support, great roaming behavior, better power-saving for awesome netbook performance, and a lot of other stuff.  Jouni already merged most of the supplicant patches so soon we’ll be rocking the wifi goodness bullet train.

And just one more thing…

Did somebody say Bluetooth DUN?

On different note, I did about 75% of the work to get bluetooth Dial-Up Networking support going this weekend.  It’s too late to land in a 0.8 release later this month but first on the merge list for 0.8.1.  Setup will be just as smooth as PAN setup, configuring your mobile broadband provider when you pair the phone and one-click connection after that.  DUN gets requested a lot, and now with ModemManager backing our mobile broadband support, there’s enough flexibility to handle most of the really crappy phones out there.  Honestly PAN just works better, but whatever.

More later.  Peace out kids.