Unlock 3G USB Dongles in Linux

There is a very easy way to do this on linux. I unlocked a Huawei E160G Dongle that was sim locked to the 3 network using the method given below.

first order of business, getting the unlock code for the 3G dongle.
For Huawei dongles, this is very easily obtained using this site : http://bb5.at

To do this, first get the IMEI code for your dongle and in a new browser window, enter the url as below :


replace xxxxxxxxxxxxxxxxx with your actual 15 digit IMEI code.
this will show a page giving the unlock code like the one below :

The unlock code is the 8 digit number in the line that says :

Entsperren / Unlock: 65031494

Tools you need :
minicom – a terminal software that can communicate with the serial ports. On windows, there is Hyper terminal. This is the Linux counterpart for that.

minicom is available in just about every linux distro there is.
On Debian based systems (ubuntu,mint,mepis,etc.) this can be installed with :

sudo apt-get install minicom

On Redhat based systems (CentOS, Fedora ):

sudo yum install minicom

On Suse :

sudo zypper install minicom

now, we need to know on what port the dongle is connected on. to do this, open up a command terminal and login as root

sudo su

and run for Debian based systems :

tail -f /var/log/syslog

For Redhat/Suse based systems :

tail -f /var/log/messages

keep that terminal open and plugin the 3G dongle with the SIM removed from it.
THere’ll me a lot of lines as the kernel detects the attached device. Among them will be lines similar to these :

kernel: [122067.688806] usb 1-4: Product: HUAWEI Mobile
kernel: [122067.688821] usb 1-4: Manufacturer: HUAWEI Technology
kernel: [122067.689178] usb 1-4: configuration #1 chosen from 1 choice
kernel: [122067.708406] option 1-4:1.0: GSM modem (1-port) converter detected
kernel: [122067.708774] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
kernel: [122067.709341] option 1-4:1.1: GSM modem (1-port) converter detected
kernel: [122067.709721] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB1

It identified the device as a modem and attached it to the ports ttyUSB0 and ttyUSB1
The full paths are :
/dev/ttyUSB0 and /dev/ttyUSB1

These are the details we need.

we can get back to the interactive command line by pressing CTRL + C
now, we need to configure minicom so that it’ll talk to the 3G dongle. in 99% of the cases, /dev/ttyUSB0 is the port we need to unlock the dongle.

So as root, run :

minicom -s

This opens up minicom in the configuration mode.

First thing to do is to set the Serial Port so select Serial Port Config from the list of options and press Enter.

First thing is to change the port to /dev/ttyUSB0. So press A and change the /dev/tty0 to /dev/ttyUSB0

And press Enter.

Next, we need to change the Baud Rate, paritiy and bits to 9600,N,8 (respectively). To do this, press E.

From the list of options C has 9600, so press C
Press Enter to confirm.

now it should look like this :

A – Serial Device : /dev/ttyUSB0
E – Bps/Par/Bits : 9600 8N1

Press Enter to complete the Serial port Setup.
Now select Exit to exit the configuration menu.

Note, this is Exit and NOT Exit from minicom option.

Now it’ll initialize the modem:

And open up the terminal :

Now comes the actual command to unlock the dongle. The terminal you’re in now is not a interactive shell like the usual command prompt. You cannot make any mistakes in typing commands here.
the AT command to unlock the dongle has to be entered in capital letters so its a good idea to press capslock.

the unlock command is :


replace xxxxxxx with the unlock code for your dongle the “” are compulsory!

and press enter.

Now, depending on the dongle model, you might get a reply like this :

^CARDLOCK 2,10,0

or simply (this is what I got for the E160G) :


now just close the command line interface and pull out the dongle.
Put your own sim in and plug it in. It’ll now work with your sim.

Big thanks goes to Sandeepa for his blog post (http://sadeepasepala.blogspot.com/2010/03/huawei-hsdpa-usb-unlock.html) for providing the AT command to unlock, the Baud rates, and an easy way to get the unlock codes. His blog post shows how to unlock 3G dongles in windows without using any 3rd part software.

Also credit is due to this blog post (http://linuxwave.blogspot.com/2009/06/hyper-terminal-for-linux.html) from linuxwave for giving a heads up on minicom.


One Response to “Unlock 3G USB Dongles in Linux”

  1. Dane Maslen Says:

    Excellent! I’d kept finding completely opaque solutions that used downloaded software for Windows. It was wonderful to find a solution for Linux that was completely transparent and involved no mumbo-jumbo. Even better, it worked!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: