Raspberry Pi - mikec964/chelmbigstock GitHub Wiki

This will be a more-or-less chronological list of challenges and discoveries on the Pi. You might also like these reference pages:

[Bash shell shortcuts]] ](/mikec964/chelmbigstock/wiki/[[Network-troubleshooting)

Contents

Next Steps

Install the OS

Use NOOBS

Start with the basic NOOBS Setup. The instructions walk you through:

  • Downloading NOOBS (Includes Raspbian Linux)
  • Downloading the SD Formater software
  • Formatting the SD card. (I named mine "HAWKGIRL_SD".)
  • Copying the NOOBS files to the SD. (Don't forget to unzip/untar them first.)
  • Install Raspbian Linux

Do It Yourself

Instead of NOOBS, you can select an image and install it yourself from the command line.

Start it up!

The default username and password are pi and raspberry.

  • startx # Launches the GUI.
  • shutdown reboot # Reboots
  • sudo shutdown -h now # Shuts down

Configure WiFi

I used the OurLink WiFi adapter. Support was built-in to Raspbian and configuration through the GUI was easy.

Access Pi remotely

Use SSH

On the Pi, use ifconfig to get the IP address. If it's on WiFi, the IP address is on wlan0. If it's on Ethernet, the IP is on eth0. You might be able to figure out the IP address from your laptop; check out the Network troubleshooting page.

Robin:~(0) mikec$ ssh [email protected]
The authenticity of host '10.0.0.33 (10.0.0.33)' can't be established.
RSA key fingerprint is 71:4c:d6:70:b6:09:40:eb:1c:e5:c1:81:be:af:df:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.33' (RSA) to the list of known hosts.
[email protected]'s password: 
Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Feb 16 14:06:38 2015
pi@raspberrypi ~ $ ls
Desktop  python_games

Use VNC

http://www.maketecheasier.com/setting-vnc-raspberry-pi/

VNC security is pretty weak, but it works even when your Raspberry Pi is headless. You may prefer something else. This is what I started with.

I installed the VNC server on the Pi, and www.realvnc.com onto my Mac. When it asks for the server that you want to connect to, don't forget to put the :1 at the end of the IP address: 10.0.0.23:1.

  • vncserver :1 -geometry 1024x768 -depth 24 Starts the server
    • The :1 is the desktop. You can have multiple desktops.
    • Assign an 8-character password for accessing via VNC ('controlpi!')
    • Optionally, assign an 8-character password for viewing via VNC ('lookatpi')
  • You can change the password with vncpasswd
  • vncserver -kill :1 Stops that particular desktop

Use XRDP

http://www.maketecheasier.com/enabling-remote-desktop-access-on-raspberry-pi/

http://joshua14.homelinux.org/blog/?p=1688

To install as a service, just use: sudo apt-get install xrdp.

After installing xrdp, when I launch Remote Desktop on the Mac, I just get a black screen. I tried using startx on the Pi, but it fails with: FATAL: Module g2d_23 not found. I suspect that XRDP does not work when the Pi is headless.

GBBus ERROR

  Error: Dialog box "GDBus.Error org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject"

Fix: For now, I just clear the dialog box and ignore this.

Truly Headless

If you want to use your Raspberry Pi without a screen, keyboard and mouse, the catch-22 with the above methods is that they assume your Pi has connected to the network and that you know its IP address. In a Wi-Fi environment, it might not be able to connect until you've selected an SSID and entered a password, or gotten past an login web page. You can't do that without a screen and keyboard.

One answer is to connect your Pi directly to your laptop with an Ethernet cable and share the laptop's internet access to your Pi.

  • Connect your laptop to the Internet
  • Connect the Pi to your laptop with an Ethernet cable. You don't need a crossover cable.
  • Configure your laptop to share its Internet.
    • On the Mac, Settings, Sharing, Internet.
    • On Ubuntu, set up Connection Sharing
      • Settings > Network > Wired. Click Options. IPv4 tab, Method=Shared to other computers.
    • ifconfig Note the address of the Ethernet port... probably a .1 address. On the Mac, en0 is the Ethernet port, en1 is the WAN port.
    • Mac OS: ping -t 10 <address.255>. Ubuntu: ping -t 10 -b <address.255> For example: ping -t 10 -b 10.42.0.255. After 10 seconds or so, press control-C.
    • arp -a
    • Here are some other ways to troubleshoot the network.
    • Odds are that it will have a .2 address.
Robin:raspberrypi(0) mikec$ arp -a
? (10.1.10.1) at 0:13:72:3c:91:82 on en1 ifscope [ethernet]
? (10.1.10.52) at 0:db:df:24:31:a0 on en1 ifscope [ethernet]
? (10.1.10.75) at 0:b:81:90:cb:4e on en1 ifscope [ethernet]
? (10.1.10.255) at ff:ff:ff:ff:ff:ff on en1 ifscope [ethernet]
? (169.254.255.255) at ff:ff:ff:ff:ff:ff on en0 [ethernet]
? (192.168.2.1) at 0:22:41:1e:fe:7d on en0 ifscope permanent [ethernet]
? (192.168.2.2) at b8:27:eb:98:a4:af on en0 ifscope [ethernet]
? (192.168.2.255) at ff:ff:ff:ff:ff:ff on en0 ifscope [ethernet]

For another solution, check out https://github.com/adafruit/Adafruit-Pi-Finder. I haven't tried it yet.

Other Setup

  • raspi-config # Even works via ssh

Change password and hostname

Change the password with the passwd command.

Change the hostname:

pi@raspberrypi ~ $ sudo vi /etc/hostname
pi@raspberrypi ~ $ cat /etc/hostname
hawkgirl
pi@raspberrypi ~ $ sudo vi /etc/hosts
pi@raspberrypi ~ $ cat /etc/hosts
127.0.0.1	localhost
::1		localhost ip6-localhost ip6-loopback
fe00::0		ip6-localnet
ff00::0		ip6-mcastprefix
ff02::1		ip6-allnodes
ff02::2		ip6-allrouters

127.0.1.1	hawkgirl
pi@raspberrypi ~ $ sudo reboot
... (reconnect)
pi@hawkgirl ~ $ hostname
hawkgirl

Vim

pi@raspberrypi ~ $ vi --version
...
pi@raspberrypi ~ $ which vi
/usr/bin/vi
pi@raspberrypi ~ $ ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 Jan  1  1970 /usr/bin/vi -> /etc/alternatives/vi
pi@raspberrypi ~ $ vi --version
VIM - Vi IMproved 7.2 ...
...
pi@raspberrypi ~ $ sudo apt-get vim
...
pi@raspberrypi ~ $ echo "syntax on" >> ~/.vimrc