N900 tethering on Ubuntu 11.04

I’ve recently been unpleased to discover that tethering (over USB) my Nokia N900 didn’t work any more on Ubuntu 11.04 (even with up-to-date versions of all packages), while it used to work perfectly on 10.10 and 10.04. There is a thread on Ubuntu Forums about this, and an associated bug report on Launchpad. The fix I found is from Ubuntu Forums, here it is.

Edit: looks like the bug will be corrected in 11.10.

To tether your N900, begin as if everything worked:

Plug your N900 and set it to PC-Suite mode. Edit connections in NetworkManager and create a new “Mobile Broadband” one (selecting the country, provider and plan yielded the correct APN for me). Try to connect.

Now this is where things stopped working for me: connection fails, and if you look at your syslog you’ll find a rather cryptic error: “GSM modem enable failed: (32) Serial command timed out”. To overcome this, run this script as root:

service network-manager stop
pkill modem-manager
modprobe -r cdc_acm
modprobe cdc_acm
service network-manager start

The problem seems to come from the cdc_acm kernel module trying to communicate with the device before you tell it to switch to PC Suite mode. Running this script will just restart communication from the beginning, successfully this time because the device is already listening. It worked for me, but then I have to run this script every time I want to tether...

PS: you can also do WiFi tethering using the JoikuSpot application (not that hard to find on the Bay). Bandwidth is much better than with Bluetooth, but it only works if you don’t mind security (WEP128 is the best it can do, and it’s crackable within seconds...) I tried it on my device and it works pretty well.