Setting up Raspberry Pi

These are the general steps I follow when preparing a new Raspberry Pi image for use with BrewPi:

  1. Download your new Raspbian image: https://www.raspberrypi.org/downloads/raspbian/ (get the full version, not the “Lite” one)
  2. Install the image on your SD card:
  3. Insert the SD card, connect keyboard, mouse, monitor, and boot to graphical desktop. (1)
  4. Set up Wireless LAN:
    • Click on Wireless graphic in top-right taskbar
    • Select your network by name
    • Enter your pre-shared key
  5. Complete configuration:
    • Select Menu > Preferences > Raspberry Pi Configuration
      • System Tab
        • Expand Filesystem, Do Not Reboot (2)
        • Change Password
        • Change Host name (suggest: BrewPi)
      • Localization Tab
        • Set Locale (Assuming a US user:)
          • Language: en (English)
          • Country: US (USA)
          • Character Set: UTF-8
        • Set Timezone (Change zone to proper one for your area:)
          • Area: America
          • Location: Chicago
        • Set WiFi Country (Assuming a US user:)
          • Country: US United States
      • Select OK and reboot

After the Pi reboots, open a terminal window:

  1. Issue the following commands to ensure your software is up to date:
    sudo apt-get update
    
    sudo apt-get upgrade -y
  2. Install support for Microsoft Terminal Server Client connections*:
    sudo apt-get install xrdp
  3. Issue the following commands to clean local repositories, deleting space used by downloaded archives:
    sudo apt-get clean
    
    sudo apt-get autoclean
  4. Issue the following command to update the firmware of your Raspberry Pi:
    sudo PRUNE_MODULES=1 rpi-update
  5. Menu > Shutdown > Reboot; or:
    sudo reboot

Your Raspberry Pi should now be accessible on the network via PuTTY and with Microsoft Terminal Server Client (mstsc) as “{servername}.local”.   To validate name resolution, open a command prompt on another computer on the network and type:

ping {servername}.local

You should see something like:

C:\>ping brewpi.local

Pinging brewpi.local [192.168.1.110] with 32 bytes of data:
Reply from 192.168.1.110: bytes=32 time=418ms TTL=64
Reply from 192.168.1.110: bytes=32 time=197ms TTL=64
Reply from 192.168.1.110: bytes=32 time=27ms TTL=64
Reply from 192.168.1.110: bytes=32 time=681ms TTL=64

Ping statistics for 192.168.1.110:
 Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
 Minimum = 27ms, Maximum = 681ms, Average = 330ms

If you receive an error stating that the host could not be found, it may be that Bonjour services is not installed on your local computer assuming you use Windows.  You can obtain Bonjour either by installing iTunes, or with the stand alone installer found here. Bonjour also enables accessing the BrewPi web page with  “{servername}.local” without having to apply a static IP or remember an IP address.  If you use Linux you will need libavahi; under Mac, Bonjour should be installed with the base OS.

RDP Errors

There is a new desktop interface called “Pixel” released with the latest Jessie, dated 2016-09-23. There is a bug between this and xrdp which a lot of us use to connect to our Raspberry Pi’s desktop with Microsoft Terminal Server Client (mstsc). It will connect to the familiar X window and hang, displaying something like this:

connecting to sesman ip 127.0.0.1 port 3350
sesman connect ok
sending login info to sesman
login successful for display 10
started connecting connecting to 127.0.0.1 5910
error - problem connecting

If you press “ok” it will present you with a credentials prompt and if you re-enter credentials it will give the same error.

To fix this, issue the following commands:

sudo apt-get --purge remove xrdp
sudo apt-get --purge realvnc-vnc-server

sudo apt-get install tightvncserver tightvnc-java
sudo apt-get install xrdp
sudo reboot

 Notes:

    1. A “headless” install is now possible.  Previously one needed to boot the Raspberry Pi in order to connect to wireless networking.   This is no longer necessary.  To do this, perform the following two steps while the SD card is mounted after flashing the boot image:
      • Create a file called “ssh” (without any extension) on the root of the boot partition of the SD card.  This allows SSH to work on first boot, circumventing new behavior in Raspbian which disables SSH by default.
      • Create a file called “wpa_supplicant.conf” on the root of the boot partition of the SD card.  In it, place the following information:
        country=US
        ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
        update_config=1
        
        network={
            ssid="SSID"
            scan_ssid=1
            psk="PASSWORD"
            key_mgmt=WPA-PSK
        }

        Replace “SSID” with the SSID of your local wireless network, and “PASSWORD” with your wireless network password.

  1. Raspbian will now automatically expand to use all of the available space on the SD card during the initial boot.