Raspberry Pi B+ Setup & Configuration

Environment

Setup Platform:
Windows 8.1

Raspberry Pi:
Board:
Wireless Adapter: EdiMax 150Mbps Wireless 802.11b/g/n nano USB Adapter, Model EW-7811Un
Software:Raspbian OS

Caveats

Without a properly configured & booting sd-card, no video will be put out at all!

Install OS

First Boot & Initial Configuration

Wireless Network Configuration

1. First, let’s make sure your wireless hardware is correctly working
Perform a wireless survey via commandline:

iwlist wlan0 scan

If the can fails, try it a few more times.
In my experience, I’ve had to scan more than once to get a good survey.

2. Edit the interfaces config file

sudo vi /etc/networ/interfaces
#Change as follows:
allow-hotplug wlan0 #Applies to plug-n-play hardware such as USB, specify the interface name (e.g. wlan0)
iface wlan0 inet dhcp #Specify dhcp for the interface
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf #Applies to Wi-Fi Protected Access client wpa_supplicant/
pre-up wpa_supplicant -B w -D wext -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf #Specify preflight command for wpa initialization
powt-down killall -q wpa_supplicant #Specify post command for wpa stop

Important: Notice the lack of a space after the -c switch in the wpa_supplicant command. That is purposeful!

3. Next, we are going to be using the wpa_passphrase command to generate the encrypted passphrase that will be used int the wpa_supplicant.conf file referenced in the interface config

#Call the wp_passphrase command with the Wireless SSID and the Password Phrase (passphrase)
#usage: wpa_passphrase <ssid> [passphrase]
#If passphrase is left out, it will be read from stdin
#Change directory to the relevant path
cd /etc/wpa_supplicant 
#issue the wpa_passphrase command to generate the encrypted psk passphrase
wpa_passphrase {ESSID} {pass}
#where {ESSID} and {pass} are your Wireless SSID and Passwrd, respectively

4. Copy the encrypted key. You’ll need this for the next step

5. Modify the wpa supplicant configuration file according to your wireless network configuration
Here is my file:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="MyNetworkName"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk=134b516a855384ea15429da72033ec2725934ed3ff5e3bc2fff64b8ad78c2dfc
}

Important: The above psk passphrase was randomnly generated! You must change it to match your settings. Also, do not enclose the value in double quotes.

6. Restart your wireless network client

sudo wpa_action wlan0 stop
sudo ifup wlan0
#--or--#
sudo wpa_action wlan0 stop && sudo ifup wlan0

7. Verify your wireless connectivity

iwconfig
#-- or --#
sudo wpa_cli status
#-- or --#
ifconfig
#Optionally, you can query your dhcp lease records file
sudo cat /var/lib/dhcp/dhclient.leases

If problems, see the Troubleshooting section

[divider]

Appendix

[divider]

Command Cheatsheet

Handy Commands
Command Description iwconfig wlan0 essid NETWORK_ID key WIRELESS_KEY Call the iwconfig command to generate the wireless configuration sudo wpa_action wlan0 stop Stop the wireless network interface sudo ifup wlan0 Start the wireless network interface sudo wpa_action wlan0 stop && sudo ifup wlan0 Previous two commands, second command runs if first is successful sudo find /somepath -type f -name '*' -executable Search for executables under the specified folder

Customizations

1. Enable filesystem check (fsck) after reboot
Because we’re working with flash media (SD Cards, etc), I wanted a way to force the Raspberry Pi to check its filesystem after every reboot.
The Raspbian OS will perform a filesystem check if a special file semaphore is present in the root (/) path

/forcefsck
You can run a one-time fsck on the system simply by creating this file with the touch command, as in:
sudo touch /forcefsck
To ensure this happens after every reboot, you can add this command sequence to the Raspbian OS system startup file: /etc/rc.local
sudo vi /etc/rc.local

Add the below line:

/usr/bin/touch /forcefsck

Soldering Inputs & Interfaces

The purpose of the P6 header is to enable a reset of the Raspberry Pi’s CPU. The reset switch can restart the system, but it does not provide the safe shutdown

Troubleshooting

wpid249-media_1410657586290.png

1. Search the system log for any errors

grep -i handshake /var/log/syslog | tail -20

2. Sep 14 00:13:32 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Sep 14 00:13:36 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Sep 14 00:13:40 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Sep 14 00:13:45 raspberrypi wpa_supplicant[4303]: wlan0: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
Correct the passphrase
sudo rm -f /var/run/wpa_supplicant/wlan0
sudo rm -f /var/run/wpa_supplicant/wlan0
4. Try to manually run the connection command: 
 sudo /sbin/wpa_supplicant -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c/etc/wpa_supplicant/wpa_supplicant.conf

Important Logs:

/var/log/syslog

Multimeter

wpid250-media_1411009676659.png

Sources

Description URL Notes Making a Reset Switch for your Rev 2 Raspberry Pi http://raspi.tv/2012/making-a-reset-switch-for-your-rev-2-raspberry-pi Google Search:
"raspberry pi" "reset switch" "Volume was not properly unmounted" wpa_supplicant(8) – Linux man page
http://linux.die.net/man/8/wpa_supplicant Howto Set Up Multiple Network Schemes on a Linux Laptop http://www.shallowsky.com/linux/networkSchemes.html Google Searches:
"raspberry pi" "Association request to the driver failed"
wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf"
kwd:{"Side note wpa_cli is odd the flags are not followed by a space. for example you want to do Raspberry Pi GPIO Documentation and Tutorials
http://raspi.tv/rpi-gpio RPi.GPIO update and detecting BOTH rising and falling edges http://raspi.tv/2014/rpi-gpio-update-and-detecting-both-rising-and-falling-edges Raspberry Pi – Install a Momentary Reset Button http://www.savagehomeautomation.com/projects/raspberry-pi-install-a-momentary-reset-button.html Google Search:
raspberry pi momentary switch Triple function button to reboot/halt/reset/restart Pi
http://www.raspberrypi.org/forums/viewtopic.php?t=48455&p=379280 Google Searches:
"p6" "sudo reboot" Soldering Is Easy
http://mightyohm.com/files/soldercomic/FullSolderComic_EN.pdf Adding a (Safe) On/Off switch to your Raspberry Pi http://www.raspberry-pi-geek.com/Archive/2013/01/Adding-an-On-Off-switch-to-your-Raspberry-Pi Google Search:
"raspberry" "sudo reboot" "via gpio" Downloads: Raspberry Pi Scripts & Resources
ftp://ftp.linux-magazin.de/pub/listings/rasp-pi-geek.com/01 Get started with Raspberry Pi http://www.siongboon.com/projects/2013-07-08_raspberry_pi/index.html

Terminology

Term Notes dupont wires http://lmgtfy.com/?q=dupon
wires




Adding a Network Card to CentOS Linux

Detect & Configure The New Network Adapter

1. Determine existing network interfaces

ifconfig -a
2. Change directory to the network scripts folder
cd /etc/sysconfig/network-scripts
3. Clone the existing eth0 device network script
cp ifcfg-eth0 ifcfg-eth1 # this assumes the old card was eth0 and the new one is eth1
4. Get the Hardware Address for the eth1 network card, again this assumes the new card is eth1
grep eth1 /etc/udev/rules.d/70-persistent-net.rules
#you can get fancy and use awk and cut to isolate the string containing the Hardware Address
grep eth1 /etc/udev/rules.d/70-persistent-net.rules | awk -F"," '{print $4}' | cut -d= -f3
5. Replace all occurences of eth0 with eth1 in the new network configuration script
sed -i 's/eth0/eth1/g' ifcfg-eth1 # or edit it by hand and change eth0 to eth1 where it appears
6. Edit the eth1 network configuration script and replace the Hardware Address with the one in the 70-persistent-net-rules file
vi ifcfg-eth1
7. Bring the eth1 interface up
ifup eth1




CentOS 6 64-bit on ESXi 5.0 – No Network After Cloning

Scenario: Installed CentOS 6.x x86_64 on VMWare ESXI 5.5

Upon login, noticed no NICS detected

see:{Centos 6.2 set static IP@https://www.linuxquestions.org/questions/linux-server-73/centos-6-2-set-static-ip-931188/

see:{Settimg up a new network device in CentOS@http://linuxtoolkit.blogspot.com/2013/09/settimg-up-new-network-device-in-centos.html

Regenerate the Persistent Network Rules Using udevadm

[code language=””]
#Regenerate the file using udevadm
rm -f /etc/udev/rules.d/70-persistant-net.rules
udevadm trigger –action=add
reboot
[/code]

Manually Verify and Correct NIC Device

media_13941660650572.png

[code language=”bash”]
#1. Verify problem (no ethNn present)
ifconfig
#2. Verify system detects ethernet hardware
dmesg | grep -e ‘vmx\|eth’
#3. Verify ethernet driver is loaded
lspci | grep -i ethernet
#4. If not already present, create generic eth0 config file
vi /etc/sysconfig/network-scripts/ifcfg-eth0
#If there is already a UUID line, Delete it, save, exit
#5. If this system was cloned, you’ll need to remove the old MAC address reference.
#See next step
[/code]

Manually Correct NIC MAC Address After Cloning

media_1408027818072.png

After cloning a CentOS 6.x machine, you may find that connectivity is limited to only the loopback (127.x.x.x) interface

This is likely because the system has retained the MAC address specification of the machine from which it was cloned

You can correct this by modifying the Persistent Network Rules File

[code language=”bash”]
vi /etc/udev/rules.d/70-persistant-net.rules
[/code]

Configure NIC Device Using System Config Network Utility

media_1394166095376.png

1. Launch the System Network Configuration Utility

[code language=”bash”]
system-config-network
[/code]

2. Choose ‘Device configuration’ in the dialog

3. Fill in settings accordingly (e.g. Name:eth0;Device:eth0;DHCP:enabled. Press OK

You’ll be taken back to the original dialog

4. Press Save&Quit. Restart networking services

Settings should persist even after reboot