Configuration Apple-pi - Raspbian: Difference between revisions

From miki
Jump to navigation Jump to search
(→‎Issues: Frequent loss of Wifi)
Line 135: Line 135:
== To Do ==
== To Do ==
=== Issues ===
=== Issues ===
* '''{{red|Issue}}''' — To be completed
* '''{{red|Issue}}''' — Frequently losing WiFi connection, without reconect.
:* '''Workaround''' — Use a cron script to detect and force reconnect [http://www.raspberrypi.org/forums/viewtopic.php?t=13169&p=451078*/5 * * * * /usr/local/bin/testwifi.sh 2> /var/log/testwifi.log]
:* Crontab line, edited with <code>sudo crontab -e</code>
<pre>
*/2 * * * * /usr/local/bin/testwifi.sh > /var/log/testwifi.log 2>&1
</pre>
:* {{file|/usr/local/bin/testwifi.sh}}
<source lang=bash>
#echo '/usr/local/bin/testwifi.sh log'
TESTIP=172.19.100.107

#ping -c4 ${TESTIP} > /dev/null
/sbin/ifconfig wlan0 | grep --quiet $TESTIP

if [ $? != 0 ]
then
logger -t $0 "WiFi seems down, restarting"
sudo /sbin/ifdown --force wlan0
sleep 10
sudo /sbin/ifup wlan0
else
#logger -t $0 "WiFi seems up."
fi

</source>
* '''{{red|To Do}}''' — Description
* '''{{red|To Do}}''' — Description



Revision as of 00:05, 3 July 2014

Configuration Page

Introduction

This is the configuration page for the Raspbian partition on Apple-pi.

Configuration Files

All configuration files can be found here.

Repositories

To be completed.

Installed Applications

Common applications

Some application from the Common configuration for Linux, namely:

sudo apt-get install git etckeeper libnss-mdns avahi-daemon mdns-scan mc autossh vim-gnome tmux

Essential

Git (git)
# Setup git repo main directory
sudo useradd -s /usr/bin/git-shell -m git   # User both for ssh: and git: protocol access (shell disabled)
sudo su -p git                              # Notice -p since shell is disabled
cd ~git
mkdir git                                   # This directory will store all .git repo
mkdir .ssh
cat ... >> .ssh/authorized_keys             # Add keys of user that can use the ssh: protocol
  • Install git-daemon (enable git: protocol):
sudo apt-get install git-daemon-sysvinit
sudo vi /etc/default/git-daemon             # Change user to 'git'
sudo /etc/init.d/git-daemon start           # Start daemon
  • Setup minecraft.git:
sudo su -p git                              # or sudo su -s /bin/bash git
cd ~git/git
git init --bare minecraft.git
cd minecraft.git
touch git-daemon-export-ok
git config --add daemon.receivepack true    # no hyphen in receivepack!
exit
sudo ln -sf ~git/git/minecraft.git /var/cache/git/minecraft.git

Local Applications

Application (package) [YYYY-MM-DD] Update
Additional configuration settings

Uninstalled

Application (package) [YYYY-MM-DD] Update
Additional configuration settings

Settings

Network WIFI Check that WiFi dongle is detected with lsusb
lsusb
# Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

Check that wireless device has an interface available with iwconfig [1] [2]

iwconfig
# wlan0     IEEE 802.11bgn  ESSID:"ManticoreNet"  Nickname:"<WIFI@REALTEK>"
#           Mode:Managed  Frequency:2.412 GHz  Access Point: 00:1D:7E:0C:24:5E   
#           Bit Rate:150 Mb/s   Sensitivity:0/0  
#           Retry:off   RTS thr:off   Fragment thr:off
#           Power Management:off
#           Link Quality=100/100  Signal level=87/100  Noise level=0/100
#           Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
#           Tx excessive retries:0  Invalid misc:0   Missed beacon:0

We configure interface wlan0 to use WPA in roaming, and static ip address for network id home.[3]

  • See man interfaces for instruction
  • auto wlan0 tells that the interface should start automatically at boot
  • wpa-roam implies that manual must be used
  • To configure a static address, add an extra interface (here with name home), and configure this interface instead.
    The name must match name given in attribute id_str in file wpa_supplicant.conf. This allows to have different network configuration for different wireless networks.
  • Wifi network credentials are stored in a separate file that only root can read

File /etc/network/interfaces:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface home inet static
    address 172.19.100.107
    netmask 255.255.0.0
    gateway 172.19.3.1

File /etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
	ssid="***********"
	psk="************"
	proto=RSN
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
	id_str="home"
}

Bring up or down the interface with:

sudo ifup wlan0
sudo ifdown wlan0

The following error messages can be ignored [4]:

$ sudo ifup wlan0
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

To Do

Issues

  • Issue — Frequently losing WiFi connection, without reconect.
*/2 * * * * /usr/local/bin/testwifi.sh > /var/log/testwifi.log 2>&1
  • /usr/local/bin/testwifi.sh
#echo '/usr/local/bin/testwifi.sh log'
TESTIP=172.19.100.107

#ping -c4 ${TESTIP} > /dev/null
/sbin/ifconfig wlan0 | grep --quiet $TESTIP

if [ $? != 0 ]
then
    logger -t $0 "WiFi seems down, restarting"
    sudo /sbin/ifdown --force wlan0
    sleep 10
    sudo /sbin/ifup wlan0
else
    #logger -t $0 "WiFi seems up."
fi
  • To Do — Description

Done & Fixed

  • Fixed — Issue description
    Fix description
  • Done — Description