Category Archives: linux

linux sysadmin technical

How to fix Huawei E620 USB 3G Modem in Ubuntu 9.10 Karmic Koala

I recently upgraded my laptop to Ubuntu 9.10 (Karmic Koala) and among a few other niggles (mostly related to intel video support, or lack thereof) it completely broke support for my Huawei 3G (E620) modem. Fortunately the fix is fairly straightforward: install a new kernel. I went with the latest (v2.6.32 release candidate available over here at kernel.ubuntu.org ) and the problem is solved.

If you want the gory details, check the thread over at bugs.launchpad.net. I’ll distil the useful bits below.

After the upgrade, my huawei 3G modem stopped being detected by NetworkManager. I’d see the fake ‘ZeroCD’ drive try to map itself and occasionally a gnome message box would be thrown up about a failed mount attempt, but no modem.

A look in the logs revealed /var/log/messages filling up with lines like this:

kernel: option 3-1:1.2: GSM modem (1-port) converter detected
kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
kernel: option 3-1:1.1: GSM modem (1-port) converter detected
kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
kernel: option 3-1:1.0: GSM modem (1-port) converter detected
kernel: usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2
kernel: option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
kernel: option 3-1:1.0: device disconnected
kernel: option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
kernel: option 3-1:1.1: device disconnected
kernel: option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
kernel: option 3-1:1.2: device disconnected

So the modem was being disconnected and reconnected at least a couple of times a second for some reason, and the storage device was not appearing at all.

I tried the usb_modeswitch tool which is supposed to jolt misbehaving HUAWEI (and other brand) devices out of their stupor with some undocumented SCSI/USB commands, but no success this time.

After a bit of googling, it turns out this is (was) a known bug in the way the more recent linux kernel handles the combination USB Modem/Storage device hardware (and was allowed to remain in a major release of Ubuntu which is a bit unfortunate as it seems these types of USB modems are pretty common).

There are a couple of fixes pending an official update: either install a patched version of the kernel, or temporarily disable the USB Storage kernel module which looks pretty easy and apparently worked for a few people:

# rmmod usb-storage

Untested by me: Your mileage may vary.  Be warned that even if this works, by unloading the usb-storage kernel module you will lose support for any USB based storage devices, so this is strictly a temporary workaround. I thought I’d try the more permanent and possibly dangerous (?) kernel solution first, which worked.

Steps to upgrade your kernel to a compatible version:

  1. Check your current version with the uname -a command. My post-9.10-Karmic upgrade version was: 2.6.31-14-generic #48-Ubuntu SMP  x86_64 GNU/Linux
  2. Go to http://kernel.ubuntu.com/~kernel-ppa/mainline/ and download the .deb files for the kernel headers (“all”) and the kernel for your architecture (“amd64” or “i386”). If you don’t have any kind of internet on the affected ubuntu box, grab them via another connected machine and copy them via removable media (windows or mac should be fine for just getting the files). You want the “linux-header” and “linux-image” files from within the folder with the latest (hopefully stable) version number. You can ignore the source file for now.
  3. Go to a command prompt, change to the folder where the downloaded .deb files are located, and execute the following, substituting the .deb file names for the versions you have (make sure you install the headers first).
  4. sudo dpkg -i ./linux-headers-2.6.32-020632rc8_2.6.32-020632rc8_all.deb
  5. sudo dpkg -i ./linux-image-2.6.32-020632rc8-generic_2.6.32-020632rc8_amd64.deb

After this, provided everything worked, you’re a reboot away from your modem working again. After the boot, uname -a should reveal the newly installed kernel version. Mine is: 2.6.32-020632rc8-generic #020632rc8 SMP

Once plugged in, the modem worked instantly and my mobile broadband account connected fine. Hooray!

While lsusb output looked the same as before:

Bus 006 Device 004: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem

My /var/log/messages also looked a lot healthier:

kernel: USB Serial support registered for GSM modem (1-port)
kernel: option 6-2:1.0: GSM modem (1-port) converter detected
kernel: usb 6-2: GSM modem (1-port) converter now attached to ttyUSB0
kernel: option 6-2:1.1: GSM modem (1-port) converter detected
kernel: usb 6-2: GSM modem (1-port) converter now attached to ttyUSB1
kernel: option 6-2:1.2: GSM modem (1-port) converter detected
kernel: usb 6-2: GSM modem (1-port) converter now attached to ttyUSB2
kernel: usbcore: registered new interface driver option
kernel: option: v0.7.2:USB Driver for GSM modems
kernel: scsi 8:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
kernel: scsi 8:0:0:1: Direct-Access     HUAWEI   SD Storage       2.31 PQ: 0 ANSI: 2
kernel: sr0: scsi-1 drive
kernel: Uniform CD-ROM driver Revision: 3.20
kernel: sr 8:0:0:0: Attached scsi generic sg1 type 5
kernel: sd 8:0:0:1: Attached scsi generic sg2 type 0
kernel: sd 8:0:0:1: [sdb] Attached SCSI removable disk

Additionally, with the new kernel, both the pseudo cdrom, the 3G modem, and presumably the SD storage (though I don’t use it) are working at the same time. So, problem solved.

(Another improvement I noticed with the new version of ubuntu/kernel is I can disconnect the wireless broadband account via networkmanager without nasty gnome freeze-ups. Not sure what the culprit was for this: I worked around by disconnecting the hardware to avoid freezes, but looks like this too is now solved).

linux netbook technical

Ubuntu Netbook Remix on Asus eeepc / eee pc

Following my previous post on restoring the default xandros install to the eeepc, it didn’t take me long to move to (and ultimately settle on) Ubuntu. Its not perfect but a hell of a lot better than stock Xandros.

I had a play with the stock ASUS install for a while, but it was less than exciting. What finally killed it for me was the broken Xandros wireless networking. To get WPA you need to do an update (via the wired connection) and after the update it still didn’t work for me. I finally learned that due to some scripting errors by the eee pc xandros developers WPA still breaks if there are certain characters in the password. Rather than do the script editing dance to fix a distro I was already feeling lackluster about I decided to move on to Ubuntu.

Installation of Ubuntu is a total breeze and everything you need plus instructions is over here : http://www.ubuntu-eee.com/. I won’t go over it here but to summarize:

  1. Grab the .ISO (less than 700MB, I used the torrent)
  2. Get the unetbootin netboot install utility (sourceforge)
  3. Blast the .ISO onto your 1GB usb drive
  4. Fire up your eeepc, do the usual ESC to choose boot device, and you’re away.

Up until the install I wasn’t aware of the existence of the ubuntu netbook interface remix: its essentially a touchscreen friendly netbook menu/window manager and very cool. Its the first real argument I’ve seen that might sway me towards installing a third party aftermarket touchscreen.

There are a couple of things that needed changing from the stock install, most importantly the broken SD Card mount function. Fortunately this is dead easy to fix (and it is maybe already sorted in the latest release even as I type this).

Run an update

Before doing any tinkering, its worth allowing ubuntu to run a package update via the synaptic package manager / built in updater / cmd line “apt-get update, apt get upgrade”. This is dead easy: do it first =)

Fixing the SD Card mount

This is a minor annoyance, possibly already fixed if there is a new release out, but very easy to fix.

  1. Fire up a terminal window (under accessories)
  2. sudo gedit /etc/fstab
  3. Comment out (put a hash at the start of) the last line which refers to the cdrom.
  4. Save and exit.

This is a minor oversight by the distribution chefs and takes about five minutes to fix. After doing that the SD card mount works seamlessly.

Getting your Divx/Xvid going

The next thing you’ll probably want to do is install media codecs so you can play your divx/xvids files on the go. This is as simple as firing off the media player while you have an active net connection and telling it to download the codecs from the apt repository (just search for ‘xvid’).

Another package I needed which didn’t come preinstalled was the VPN client. Standard ubuntu procedure applies here, as in the following packages should be installed:

  • pptp-client
  • gnome-network-manager

After that a command line network manager restart command purports to give you the VPN options in your network menu, but I needed to reboot before mine appeared. After all this was installed, my netbook connected ot the WPA network and through again to the PPTP VPN no worries.

Currently Unresolved Resolved Issue 1: hibernation is busted.

I won’t go into detail, but even after installing the hibernate package and going in with a gparted usb boot to match the swap partition size to my installed RAM size (512mb), hibernation is still broken. I don’t get the “Insufficient SWAP” type error messages now and it appears to be hibernating, but powering it back on results in a fresh boot rather than a restore from hibernation.

For the time being I’m resorting to leaving it in suspend and making sure I keep it charged if its not being used for a few days.

UPDATE: following the instructions for file-based hibernation in this excellent article at ubuntu-eee.com has things working perfectly.

Currently Unresolved Resolved Issue 2: Webcam is busted

Firing up the built-in ‘cheese’ app doesn’t give me any webcam goodness, only static. This is probably some default setting gone awry in a config file: once again I havent done much (any) research on this so it might be a simple fix. I haven’t tried Skype with it yet either.

UPDATE: Somehow the webcam had become disabled in the BIOS between the Xandros install and the Ubuntu install. Re-enabling it fixed all. Doh.

Currently Unresolved Issue 3: Some windows don’t fit the screen

This can be gotten around to an extent by the hold-down-alt-when-clicking trick, but what I really want is a VGA utility like the one included in the stock distro which allows a bigger virtual screen size. There might be something out there, but I haven’t give it a proper look yet.

I’ll post an update if I manage to resolve any of these items (before going on holiday in a few weeks =) )

linux netbook technical

Restore an Eee PC 701 back to factory Xandros from a USB stick with no ASUS Support DVD

My recently aquired (used) asus eee pc 701 came with XP installed and no support CD/DVD. I wanted to get rid of XP and have a play with the stock linux O/S instead: I expected this to be an easy gimmie, but it was not, and ate up an evenings worth of my time googling around for solutions so I’m going to lay out the shortcuts here to hopefully save someone else the pain.

As mentioned, the eeepc I acquired had XP installed (nlited) and no recovery DVD, so no option of using the built in rescue partition to restore the EEEPC back to the factory state. (Apparently you can hit F9 normally and it takes to to a ‘restore me from hidden partiton’ type GRUB menu). I figured this wouldn’t be a problem, I’d just go to the Asus support site and grab the image. Its linux, right, should be able to get the firmware images easily from the manufacturer, right?

Wrong.

I ransacked the official eeepc.asus.com support site looking for what I needed: at the other end of the search I can honestly say I found zero useful material or info there. (Don’t even bother visiting it, you’re better off going straight to google for this). The support/download section had BIOS updates and the like, but nothing to help with a reinstall. Even searching the forums for what I imagined to be blatantly obvious issues (eg: where do I download the restore cd?) came up with bupkis.

I concluded, to my chagrin, Asus has decided to withhold the support software (a linux distro?) for whatever reason, and the forums were evidently being policed according to this policy, removing any useful information pertaining to it. I expected to find at least a link to an outside site, as google was telling me about various helpful torrents: not finding even a whisper of this on the official support forums smells like seafood.

After a bit of googling and torrent searching I found a few ISO images which purported to be eeepc 701 flavored including a copy of Ubuntu, but I couldn’t get them to run from USB key: syslinux made the drive bootable but either the kernel options were wrong and linux would not boot, or I could get it to boot by plugging in manual options (specifying location of initrd etc) but only made it partway into a boot before falling over and restarting. (I didn’t bother noting or chasing down those errors as I didn’t particularly fancy my mission this evening to be going down the road of fixing boot issues in roll-your-own livecds booting from USB sticks). I realise I’ll probably have to suss this out properly for installing Ubuntu and other flavors down the road, but for now I just wanted the stock Xandros system restore.

I eventually found some downloads which solved the problem.

Heres the process in WinXP:

  1. The first thing you need is the EeePC 901 ASUS Linux USB Flash Utility available from eeefiles.com (Link updated! http://www.netbookfiles.com/574/eee-pc-8g-xp-asus-usb-flash-utility-version-v1131/ ). I guess this is the version which comes on the support DVD, but I don’t have that and it wasn’t available from the official site, so… (By the way, thanks a lot Asus, making me resort to downloading from a third party site instead of a trusted source).
  2. The next file you’ll need is the Xandros Eee Pc 701 Edition ISO. Get it from the eeepc 701 community project on sourceforge.
  3. Once you’ve downloaded both of the above its all pretty much downhill!
  4. Now either burn the ISO to a physical disk, or mount the image using a program like daemontools.
  5. Plug in your 2GB+ USB stick
  6. Run the USB Flash utility, select the detected USB drive,wait for it to format. If prompted, remove and re-insert the stick after the format. It will ask for the linux disk (either insert the physical copy you burned or mount the ISO into a drive).
  7. Linux will copy (it takes a few minutes) and at the end you should have a bootable restore on the USB drive.
  8. Power on the eeepc, hit F2 for BIOS options, go to “Advanced” and set the “OS Installation” to “Start”. F10 to Save and exit.
  9. Put the USB drive in your eeepc, reboot, hit escape on POST to get to the boot menu, and you’re off.
  10. Xandros will install (took about ten minutes on mine). Remember to go back into the BIOS and set “OS Installation” to “Finished” once its finished.

That really shouldn’t have taken me a whole evening of googling to get done =