Categories
Linux Posts Ubuntu

Realtek RTL8191S in Ubuntu 10.10

Errors:

$ sudo ifconfig wlan1 up
SIOCSIFFLAGS: Resource temporarily unavailable

$ dmesg usb
rtl819xU:FirmwareDownload92S(): failed with TCR-Status: a
rtl819xU:ERR!!! _rtl8192_up(): initialization is failed!

Solution 1:

To get this wifi dongle working I simply had to download the above firmware and place it in /lib/firmware/RTL8192SU/ and then reboot my computer. You should check that location before hand and make a backup of anything inside of it if you’re not sure what you are doing. If it’s empty you can use the following commands to make the directory and then download the firmware directly.

sudo mkdir /lib/firmware/RTL8192SU/
cd /lib/firmware/RTL8192SU/
sudo wget http://svn.debian.org/wsvn/kernel/dists/trunk/firmware-nonfree/realtek/RTL8192SU/rtl8192sfw.bin

Solution 2:

Alternatively download the source and build it:

wget http://launchpadlibrarian.net/33927923/rtl8192se_linux_2.6.0010.1012.2009.tar.gz
tar -zxvf rtl8192se_linux_2.6.0010.1012.2009.tar.gz
cd rtl8192se_linux_2.6.0010.1012.2009
make
sudo make install

Downloads:
Firmware: http://svn.debian.org/wsvn/kernel/dists/trunk/firmware-nonfree/realtek/RTL8192SU/rtl8192sfw.bin

Source: http://launchpadlibrarian.net/33927923/rtl8192se_linux_2.6.0010.1012.2009.tar.gz

Categories
Blog Command Line Linux Posts Ubuntu

A More Elegant Solution to Ubuntu Wi-Fi Reconnecting Issue

Previously I was having problems with Ubuntu dropping wifi connections and failing to reconnect, to solve this I wrote a script which would kill the network-manager and then connect using iwconfig commands (here). While this works fine, it felt a little hacky, having to have a script running as sudo constantly in the background checking for a dropped connection. After a little searching I came across cron (the time based job scheduler ) and /etc/rc.local (a script which is run after all other initialization scripts have ran, allowing for scripts to be ran on startup) so from this I decided to split the old script up into connection and checking scripts which could be ran from init.d/local and cron, respectively.

Firstly my startup script in /etc/init.d/local which sets up and connects to the wireless network, open the file as sudo:

 sudo gedit /etc/rc.local

Paste in the following:

#! /bin/sh

service network-manager stop && service networking stop

iwconfig wlan0 essid NETWORKNAME
iwconfig wlan0 key WEPKEY
ifconfig wlan0 up
dhclient3 wlan0

sleep 10

if iwconfig wlan0 | grep -o "Access Point: Not-Associated"
then
	ifconfig wlan0 down
	sleep 10
	ifconfig wlan0 up

fi

exit 0

Next the script for checking the network is still connected, if not attempt to reconnect (named wirelesscheck.sh):

#!/bin/bash

if iwconfig wlan0 | grep -o "Access Point: Not-Associated"
then

	ifconfig wlan0 down
	sleep 10
	ifconfig wlan0 up
	
fi

Make sure this script is executable (from the directory of the script):

 chmod +x wirelesscheck.sh 

Note: This is setup in the sudo crontab, only because this command needs root privileges – other commands could be added to a user crontab (by removing sudo from the following.)

Now, edit (-e) the crontab for sudo:

 sudo crontab -e 

If crontab has not previously been used choose an editor (I used nano – 2) and append this line to the bottom of the file and change the frequency and directory of the script. The current settings will run it every 5 minutes (*/5) every hour, day, month and year and the file is located in “/path/to/script/wirelesscheck.sh”.

*/5 * * * * /path/to/script/wirelesscheck.sh

If you have any issues, leave a comment and I will help if I can.

Categories
Linux Posts

Ubuntu Disconnecting from Wi-Fi and Failing to Reconnect.

I have an updated fix for this issue using a startup script to connect and a time scheduled script for checking the connection, rather than having one constantly running in the background, avalible here – http://alexsleat.co.uk/2011/01/09/a-more-elegant-solution-to-ubuntu-wi-fi-reconnecting-issue/

I’ve been having some trouble with my wifi on Ubuntu recently but I think it’s because I’m almost out of range of the access point. The problem is that once it disconnects it never seems to be able to reconnect unless wireless is disabled and re-enabled. No doubt there is another way of fixing this issue but it gives me a chance to write my first shell script.

In short the script disables network-manager (it was trying to do things auto which was screwing with things), sets up the connection and connects then checks for a string in the wireless card parameters which will only occur if it’s disconnected, if the string appears it’ll disable and re-enable the wireless device which seems to allow it to connect again. If it’s connected it’ll wait 3 minutes (180 seconds) before checking again where as if it does disconnect it’ll check again 30 seconds after it’s tired rebooting the device.

Here’s the script, be sure to try it if you’re having the same problem (you might need to change the wireless device ‘wlan1’ to yours) and comment if I’m doing something wrong or there’s another way around this, cheers.

#!/bin/bash

service network-manager stop

iwconfig wlan1 essid NETWORKNAME
iwconfig wlan1 key NETWORKKEY
ifconfig wlan1 up
dhclient3 wlan1

while true;
do

if (iwconfig wlan1) | grep -o "Access Point: Not-Associated"
then
	ifconfig wlan1 down
	echo "not connected, rebooting Wifi"
	ifconfig wlan1 up
	sleep 30
else
	echo "connected"
	sleep 180
fi

done