How to get 3G working on the Raspberry Pi

by subacati

So, you've received you Raspberry Pi, unboxed it and connected everything up. Now you want to update it, but you don't have wired Internet. :awww:
Well, there is a solution… …

For this method, you will need an Internet connected computer with wget installed. This should work with Windows, but you may have to make some changes. (for example, you may have to use a .bat extension instead of .sh)

The best option, however, is to use a Linux box.

Step one

Boot up your Raspberry Pi and log in as normal. Don't startx yet.
Type the following instead;

sudo -i

By doing this, you have become root for the time being.

Step two

Change directory to a convenient location, or you can use the root home directory as well, it's your choice.
Type the following command;

apt-get -qq --print-uris install network-manager-gnome > uris

This creates a file with the filename 'uris'

Step three

Now we need to create a script to fetch the packages by typing this;

awk '{print "wget -O " $2 " " $1}' < uris > wget-script.sh

once that has finished, we can shut off the Raspberry Pi and transfer the sd card to your regular, Internet connected computer. :up:

Step four

Now, with your sd card mounted in you regular computer, navigate to the directory where the file wget-script.sh is.
Right click on that, and select 'Properties' from the context menu. Then select 'Permissions'
At the bottom you will see a small check-box with the text, "Allow this file to run as a program"
Select that and close the dialog.

Step five

Open a command line shell in that directory. (or open a command line shell and cd to that directory)
Then type;

sh -x ./wget-script.sh

This will fetch the needed packages to that directory.

Step six

Delete the files "uris" and "wget-script.sh". You don't need them anymore.
Put the sd card back into your Raspberry Pi and bootup.
type;

sudo -i

Then cd to the directory where the packages are. ( :sst: If you used the root home directory, you will already be there )
Noe type;

dpkg -i *

This will unpack and install all the .deb packages in that directory. Remember that I said to delete the files "uris" and "wget-script.sh"? If you didn't, you will see that dpkg will complain about being unable to process these two files.

The End

You can now type;

exit
startx

And you will bring up the desktop. In the systray, there will be a network icon that wasn't there before. If you right click on that, you can select "edit conections" Then choose "mobile Broadband">"add"
This will start a connection wizard to help you choose the right configuration.
Most modern 3G modems will be auto-detected and usb-modeswitch will automatically change the mode accordingly.
If you are familiar with using your modem in other Linux distros, the process will be the same with Raspbian, now that you have a decent network management system installed.

Final note: You may have to run the following from the command line before updating and upgrading;

sudo apt-get -f install

This is because some packages were missing but are dependencies of other packages that were retrieved. The missing dependencies are part of the bluetooth packages and don't interfere with the network manager.

Advertisements