Let me start with a short description of the extremely slow speed and timeouts problem I was facing with my Ralink RT2500 based (integrated laptop) wireless card. After that, I will describe my solution step by step. And although all went smooth for me, I will follow with a short list of possible issues you might encounter and finish with how to revert to your old setup.
NOTE: This is a hands-on, DIY solution that I have tested only for a short period (impatiently wanting to share it ) so please let me know if I can expect to run into any problems. And if there is another/better way, which I have not found, to solve the issue.
This method has been tested on Ubuntu 9.04, Xubuntu 9.04 and Ubuntulite 0.8 (thanks to hellion0).
REQUEST: I am a (X)Ubuntu user but I hope this works for Kubuntu too. If you find there should be some changes to make it work on these or other distros, please let me know and I will incorporate them.
I have a laptop with integrated Ralink wireless card using --like many others-- the RT2500 chipset. Since my upgrade to Jaunty, I found that my connection speed was always extremely slow. Webpages would trickle load for several minutes if not just time out, and any streaming media impossible to listen/watch because after each two seconds the stream would stall and hang for more than a few seconds. Even the admin page of my router would be subject to this tiresome slowness. Another oddity was the fact that signal strenght was always shown at much lower level than should be.
All this would no longer be the case as soon as I reconnected to my trusty old LAN cable again. (Sadly, since lightning struck our telephone wire, my LAN card is toasted. Now I really HAD to find a solution!)
I had originally installed Wicd because I like it much and it saved me from problems with the same RT2500 card a long time ago (under Feisty, I think) but I decided to try Network Manager again. Sadly, the problem persisted. However I learned from the connection information that Network Manager gave me that the connection speed (rate) was fixed at 1Mb instead of anything nearer the max 54Mb if my WLAN router.
Searching these forums I notice I am not the only one with this problem. A quick fix was presented in one thread in the form of entering the following in a terminal window, where the 11M stands for a connection speed (rate) of 11Mb/s:
I tried this and immediately my reported connection speed jumped up to 11Mb, signal strenght was reported at a more convincing level and more importantly: actual surfing and streaming was back at comfortable speed ! Hurray
sudo iwconfig wlan0 rate 11M
But then I realized that I would have to do this after each boot/login. Not very convenient, so I searched further and found another thread where the fix was combined with hard coding it into another, unrelated (anacron) boot script so that this would be automatically done during each boot-up. An excellent solution but not very elegant, I thought, considering it could be overwritten during an upgrade or what not.
Then it hit me: Trusty old Wicd! Did I not notice an option to set up scripts to run on pre-, post- and disconnection? Oooh, my preciousssssss... come back to me!
This step-by-step should be fairly simple, but if anything is unclear, please ask and I will edit if necessary.
- You should be logged in as user that is in the sudoers list, meaning you have administrative rights (but are not root) so you can install packages.
- If you already have Wicd on your system you can skip to Part II of the process.
Part I: "Get Wicd with it!"
1. Add the Wicd repository to your sources list.
NOTE: This is OPTIONAL but ADVISED for pre-Karmic users. If you feel more comfortable with sticking to official Ubuntu packages, you can skip this step but there is a somewhat outdated version of Wicd in the official Ubuntu repositories. At the time of writing this how-to (Juli 15, 2009) this is version 1.5.9 and although, it works just fine it will only allow you set up a connection specific speed-up script but no global pre-connection speed-up script. The latter is useful for those that use their wireless for roaming (see part II). Karmic repos carry version 1.6.1, which is better, but to get the latest stable version with more options (and improved performance if you select ioctl backend under Preferences > Advanced Settings -- I highly recommend it ) continue with this step. At the time of writing the latest stable version is up to 1.6.2.
Open Synaptic Package Manager and go to Settings > Repositories > Third Party Software > Add..., and enter the following line:
Open a terminal window and enter the following line:
deb http://apt.wicd.net jaunty extras
Close the Package Sources dialog window and hit 'Refresh' in Synaptic Package Manager or do in terminal:
wget -q http://apt.wicd.net/wicd.gpg -O- | sudo apt-key add -
ALTERNATIVE: Download the deb package of the latest stable version from http://downloads.wicd.net/pkgs/stable/ (browse through to the latest version, choose xUbuntu folder - small x meaning any Ubuntu derivative not just Xubuntu!) and install it by double clicking the downloaded file.
sudo apt-get update
2. Get the default Network Manager packages stored locally.
NOTE: This is OPTIONAL but ADVISED if you are solely dependent on wireless for your Internet connection! You are also advised to note down the instructions on Reverting to Network Manager at the bottom... Without it, you will not have deb packages of Network Manager to fall back on, in case Wicd does not play for you. If you can easily connect via your LAN (an Ethernet card and that gray cable, remember? ) you can skip this step.
For Ubuntu/Xubuntu users, Network Manager + the Gnome Front-end:
sudo apt-get install -d --reinstall network-manager gnome-network-manager
For Kubuntu users, Network Manager + the KDE Front-end:
sudo apt-get install -d --reinstall network-manager network-manager-kde
3. Install Wicd (Wireless Internet Connection Daemon, read more on http://wicd.net/) the easy "Ubuntu way". You can find it in Synaptic or just do in terminal:
This will force Network Manager to be removed from you system.
sudo apt-get install wicd
NOTE: After Network Manager being removed, you will get an error message from the running NM Front-end about missing resources and it will close. Just move to the next step and all will be fine again.
4. Reboot your system and use Wicd to connect to your wifi signal.
Open the Wicd Manager by double cliking the system tray icon. If you have no Wicd systray applet/icon, open the Wicd Network Manager from the your Application Menu or give the command wicd-client (use the -n switch if you are running a desktop without notification area) in terminal. Set your WPA or other encryption options under 'Advanced Settings' (1.5.9) or 'Properties' (1.6.x), right below the signal entry (in version 1.5.9 you need to unfold the entry pane by clicking the connection title). You can check 'Automatically connect to this network' if you like too.
Now that you have Wicd up and running and your connection is active -- although still painfully slow -- we can move to the actual fix...
Part II: "Speed it up!"
5. Add the speed-up script
The actual script we will be using below is
NOTE 1: The last part of the speed-up script '11M' will force the connection speed to jump to 11Mb/s which is is just fine for me since it gives me a very stable connection (as opposed to the full 54MB which is also possible with my Wifi router) and my provider limits my bandwidth to 2Mb anyway. But if you absolutely need more speed, just experiment and pump it up to e.g. 36MB or 54MB if you like.
sh -c "/sbin/iwconfig wlan0 rate 11M"
NOTE 2: If your wireless card is not set up to be available on wlan0 but for example on eth1, wmaster0 (thanks acutshall1) or ra0 (thanks hellion0), adapt the script accordingly.
Now you have two options here. If you use your wireless to connect to the same few wifi signals (or just one home signal) all the time, you can follow only the easy part 5. Home/Office but if you use your wireless for a large part for roaming (connecting to new signals often) you might want to (also) follow part 5. Roaming.
I. Open Wicd Network Manager by clicking on the tray icon or via your Network menu. Then click Scripts
(1.5.9, unfold the entry pane by clicking the connection title) or Properties > Scripts
(1.6.x) right below your active connection and enter your user password. The Configure Scripts dialog comes up.
II. Now enter in the script (above) in the Pre-connection Script field.
III. Hit OK to save.
Do this again for any secondary signal you normally connect to like your Office or the public wifi at you regular lunch place
Depending on signal strength and connection stability, you can experiment with higher speeds for each signal.
NOTE: You might run into a little bug in Wicd after entering your password. If so, you will get a system warning about Wicd Manager not responding anymore. Ignore it and just hit Cancel to continue. The Scripts dialog window might be hidden behind the Wicd Manager window!
If you use your laptop for roaming and connect to new signals on a regular basis, you might want to make the speed-up script available for each new connection. After that, you can still use the Home/Office method if you want to tweak your regular wifi signals.
I. Create a new file by opening a terminal window and entering the command
sudo gedit /etc/wicd/scripts/preconnect/rt2500fix
NOTE: Adapt this to use kate
for Kubuntu/KDE or mousepad
for Xubuntu/XFCE instead of gedit.
This will bring up the text editor with a blank file.
II. Now enter the script (above) as the only (!) content.
III. Hit 'Save' and close the editor.
IV. Finally in terminal enter
sudo chmod a+x /etc/wicd/scripts/preconnect/rt2500fix
6. Disconnect and reconnect to make the script run and go and visit your favorite download or streaming website!
You should immediately notice you are back to browsing at normal speed... If not, read on.
Possible issues & Tips
TIP: faster connection time
For better performance in establishing a connection, get the latest stable version (read step 1.a) and select ioctl backend under Preferences > Advanced Settings.
I am unable to connect
If you cannot get Wicd to connect to any wifi signal, you might want to:
1. Check the content of /etc/network/interfaces. It should be nearly empty, only containing:
auto loIf it doesn't, edit the file (and make a backup copy) with
iface lo inet loopback
(for Gnome, so adapt this command for your distro specifics: use mousepad in xubuntu, kate on Kubuntu instead of gedit)
gksudo gedit /etc/network/interfaces
2. Make sure Wicd is set up to manage the correct wireless interface. Open the Wicd Manager and hit 'Preferences'. Check if the field 'Wireless Interface:' shows the correct interface. Normally this would be wlan0 but on your system it might be set up differently like eth1, wmaster0 (thanks acutshall1) or ra0(thanks hellion0) for example .
There is no Wicd tray icon after login
Open Startup Applications (under System > Preferences menu, in Gnome at least) and see if there is an entry for Wicd. If so, make sure there is a check mark beside it or if the content is correct. If not, add a new entry with Name: Wicd and Command: wicd-client, then save and logout and back in again. If that does not do the trick, head over to the Wicd forum to get expert help on manually getting the systray applet up and running.
I can connect but still at turtle slow speed
First reboot the system and reconfirm. Then you might want to check if the script should be altered in any way to fit your system. Open the Wicd Manager and hit 'Preferences'. The field 'Wireless Interface:' shows your current (and apparently working) interface. Normally this would be wlan0 but if it is anything else like eth1 or ra0 (thanks hellion0) for example, please copy the content of the field and use that to replace the wlan0 part of the script.
If that still does not work, use the original code sudo iwconfig wlan0 rate 11M (or adapted code to fit your system) in a terminal screen to find any errors. Report them in this forum thread...
All works well but signal strength is still not shown correctly
Place a check mark at the option 'Use dBm for displaying signal strength' under 'Preferences' (1.5.9) or 'Preferences Advanced Settings' (1.6.x) in the Wicd Manager.
I can connect to any open signal and speed fix works but cannot connect to encrypted signal
I found the only setting for WPA Supplicant-driver under Preferences in the Wicd Manager that works on my system is wext but you might try other options (like the ralink legacy driver) to see if that fixes the issue. Please head over to the Wicd forum on http://wicd.sourceforge.net/punbb/ for expert help.
I get a system message: The window "Wicd Manager" does not respond
You might run into a little bug in Wicd, where after clicking the Scripts button, you get a warning like "The window Wicd Manager is unresponsive" with the options Cancel and Force close. Just choose Cancel to continue and ignore this warning.
NOTE: The Scripts dialog window might be hidden behind the Wicd Manager window!
Reverting to Network Manager
Wicd did not play for you? No problem. Just reinstall the Network Manager packages and your system is back to where you were before and search on for your slow connection problem.
For Ubuntu/Xubuntu users, Network Manager + the Gnome Front-end:
sudo apt-get install network-manager gnome-network-manager
For Kubuntu users, Network Manager + the KDE Front-end:
sudo apt-get install network-manager network-manager-kde
There is a good alternative method suggested by olejon involving ndiswrapper in this thread. Other ways to get around the slow connection issue can be found on these forums. Try http://ubuntuforums.org/showthread.php?t=1148109 or http://ubuntuforums.org/showthread.php?t=1251983 for instance.