This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| linux:raspberry:raspbian:troubleshooting [2015/04/06 22:30] – created lunetikk | linux:raspberry:raspbian:troubleshooting [2020/01/15 12:01] (current) – lunetikk | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Raspberry Troubleshooting ===== | ===== Raspberry Troubleshooting ===== | ||
| - | ==== WLAN0 is loosing | + | ==== WLAN0 is losing |
| \\ | \\ | ||
| After a while the raspberry loses the network connection via WLAN0 \\ | After a while the raspberry loses the network connection via WLAN0 \\ | ||
| Line 15: | Line 15: | ||
| < | < | ||
| options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1</ | options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1</ | ||
| + | Third (optional): Create a cronjob with a script to check the connection and restart if wlan0 is turned off -> [[https:// | ||
| + | <code bash WiFi_Check># | ||
| + | ################################################################## | ||
| + | # A Project of TNET Services, Inc | ||
| + | # | ||
| + | # Title: WiFi_Check | ||
| + | # Author: Kevin Reed (Dweeber) | ||
| + | # [email protected] | ||
| + | # Project: Raspberry Pi Stuff | ||
| + | # | ||
| + | # Copyright: Copyright (c) 2012 Kevin Reed < | ||
| + | # https:// | ||
| + | # | ||
| + | # Purpose: | ||
| + | # | ||
| + | # Script checks to see if WiFi has a network IP and if not | ||
| + | # restart WiFi | ||
| + | # | ||
| + | # Uses a lock file which prevents the script from running more | ||
| + | # than one at a time. If lockfile is old, it removes it | ||
| + | # | ||
| + | # Instructions: | ||
| + | # | ||
| + | # o Install where you want to run it from like / | ||
| + | # o chmod 0755 / | ||
| + | # o Add to crontab | ||
| + | # | ||
| + | # Run Every 5 mins - Seems like ever min is over kill unless | ||
| + | # this is a very common problem. If once a min change */5 to * | ||
| + | # once every 2 mins */5 to */2 ... | ||
| + | # | ||
| + | # */5 * * * * / | ||
| + | # | ||
| + | ################################################################## | ||
| + | # Settings | ||
| + | # Where and what you want to call the Lockfile | ||
| + | lockfile='/ | ||
| + | # Which Interface do you want to check/fix | ||
| + | wlan=' | ||
| + | pingip=' | ||
| + | ################################################################## | ||
| + | echo | ||
| + | echo " | ||
| + | date | ||
| + | echo | ||
| + | # Check to see if there is a lock file | ||
| + | if [ -e $lockfile ]; then | ||
| + | # A lockfile exists... Lets check to see if it is still valid | ||
| + | pid=`cat $lockfile` | ||
| + | if kill -0 &>1 > /dev/null $pid; then | ||
| + | # Still Valid... lets let it be... | ||
| + | #echo " | ||
| + | exit 1 | ||
| + | else | ||
| + | # Old Lockfile, Remove it | ||
| + | #echo "Old lockfile, Removing Lockfile" | ||
| + | rm $lockfile | ||
| + | fi | ||
| + | fi | ||
| + | # If we get here, set a lock file using our current PID# | ||
| + | #echo " | ||
| + | echo $$ > $lockfile | ||
| + | # We can perform check | ||
| + | echo " | ||
| + | /bin/ping -c 2 -I $wlan $pingip > /dev/null 2> /dev/null | ||
| + | if [ $? -ge 1 ] ; then | ||
| + | echo " | ||
| + | / | ||
| + | /bin/sleep 5 | ||
| + | /sbin/ifup --force $wlan | ||
| + | else | ||
| + | echo " | ||
| + | fi | ||
| + | echo | ||
| + | echo " | ||
| + | / | ||
| + | echo | ||
| + | # Check is complete, Remove Lock file and exit | ||
| + | #echo " | ||
| + | rm $lockfile | ||
| + | exit 0 | ||
| + | ################################################################## | ||
| + | # End of Script | ||
| + | ################################################################## | ||
| + | </ | ||
| + | |||
| + | \\ | ||
| + | \\ | ||
| + | ~~DISCUSSION: | ||