That day has come.

There’s been a Raspberry Pi 3 B with a touchscreen running Windows 10 IoT Core on my desk at work for a while now.

We’ve been using docker and Qemu to test aarch64/ARM64, but .NET Core for ARM32 doesn’t work atop Qemu. So we need an actual device running Debian. It just so happens I have another Pi 3!

Install Raspbian

The official installation instructions are good:

  1. Download Raspbian
  2. Install
  3. Insert the SD card into the RPi and power it on

For example, on macOS:

diskutil list
# My SD card is /dev/disk2

diskutil unmountDisk /dev/disk2
# Note: /dev/rdiskX not /dev/diskX
sudo dd bs=1m if=~/Downloads/2019-09-26-raspbian-buster.img of=/dev/rdisk2 conv=sync
# Note: /dev/rdiskX
sudo diskutil eject /dev/rdisk2

SSH and VNC/XRDP

Pretty much the first thing I ever do is get SSH working so I can use a single keyboard/mouse/screen/etc. While you’re there you can turn on VNC:

sudo raspi-config
  • Interfacing Options > SSH > Yes
  • Interfacing Options > VNC > Yes

Alternatively, from the desktop, Pi > Preferences > Raspberry Pi Configuration > Interfaces.

When it comes to Linux configuration, one of the best investments you can make is setting up “SSH Key-Based Authentication”. If that means nothing to you, look into it, it will change your life. There’s numerous excellent guides on the internet, but if you’re on Linux/macOS you should be able to:

# Replace with IP address of your Pi.  Default password is "raspberry"
ssh-copy-id pi@192.168.X.Y
# From now on you can ssh in without a password
ssh pi@192.168.X.Y

Speaking of investments, given the premium placed on screen real-estate don’t overlook the -X option to ssh (on macOS/OSX you also need XQuartz):

VNC will give you access to the full desktop.

If you use a VNC client other than RealVNC you may not be able to connect. TigerVNC complains: No matching security types. Either use RealVNC or follow the VNC configuration instructions.

Another option worth looking at is xrdp. It makes sense when:

  • Network connectivity/bandwidth are not an issue (ethernet works best- same goes for VNC)
  • You’re already using RDP to connect to Windows machines
  • There’s a small screen connected to the Pi
# On the pi
sudo apt-get install -y xrdp

You should then be able to use an RDP client (e.g Microsoft Remote Desktop 10) to connect to raspberrypi.local or the IP address of the Pi.

Screen

If you’ve got some kind of small display (like the 7” touchscreen) you may need additional configuration.

  • Rotate screen 180 degrees. In /boot/config.txt add:
      lcd_rotate=2
    
  • Adjust screen brightness (max brightness is 255, higher than that results in “I/O Error”):
      sudo sh -c "echo 80 > /sys/class/backlight/rpi_backlight/brightness"
    
  • Virtual Keyboard. Regardless if you call it a “soft keyboard”, “on-screen keyboard”, or something else, you might want one. Regardless if you prefer iOS or Android, prepare to be disappointed:
      sudo apt-get install matchbox-keyboard
    
  • Screen saver:
      sudo apt-get install xscreensaver
    

Software

Update the firmware (may not be necessary with recent devices):

sudo rpi-update

For case-insensitive shell auto-completion, in ~/.inputrc:

set completion-ignore-case on

Pretty much the first thing you’re going to want to do is:

sudo apt-get update
sudo apt-get install -y vim screen # Other stuff...

If you haven’t already, take the time to learn vim or emacs. Nano/pico are the Linux moral equivalent of Windows Notepad. It takes a month to feel productive, but totally worth it. If you go with emacs and have a gimpy ctrl key (like Mac laptops), you might want to swap “caps lock” and ctrl:

  • MacOS: System Preferences > Keyboard > Keyboard > Modifier Keys…
  • Win10: in PowerShell (from this SO- you are using PowerShell, right?):
    $hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00".Split(',') | % { "0x$_"}
    $kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout'
    New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified)
    

Because everything takes longer on low-end devices, “screen” is handy if you plan to leave the Pi plugged in somewhere and use a laptop. It allows you to have a session persist after you clam up:

screen # Start a session
screen -S <name> # Start session with <name>
# Ctrl-a d # Detach from the session
screen -x # Attach to running session
screen -r <name> # Attach to session with <name>
screen -dRR # Attach to session creating/detaching as needed (if multiple use first)
screen -ls # List sessions
screen -e xy # Change command character
# For example, since Ctrl-a interferes with bash's default emacs mode:
screen -e^gg
# Now `Ctrl-g d` detaches and `Ctrl-g g` is a literal `Ctrl-g`

More goodies: