Version 2 (modified by tim, 8 years ago) (diff)

Added note about graphical setup and VNC

Setting up a Raspberry Pi for Fawkes

This document describes how to get a Raspberry Pi (raspi) board up and running for use with Fawkes. We will go with the Fedora ARM Remix installation, as we use that system on the other robot and desktop machines as well.

Raspberry Pi Installation - Laptop

We chose to go with the easy route through the graphical installer Fedora ARM Installer, but you can choose any installation method, for example the ones described on the Fedora Raspberry Pi wiki page. The catch with the graphical installer is that it must be run with the English locale. If you use a different default locale, for example German, run the installer with (on your laptop/desktop):

LANG=C fedora-arm-installer

Update the list of images, choose the SD card device (unmount the drive if it was automatically mounted on insertion), and start the writing process. Then you are done.

Raspberry Pi Installation - On the raspi

The following installation instructions are meant to be executed on the raspi. After writing the image to the SD card plug the card into the raspi and connect it to Ethernet and power. The raspi will automatically get an IP address via DHCP if such service is provided. All the following instructions assume that you have found a way to know the IP (query the router/DHCP server or guess) and logged in as root using ssh root@the-ip-you-found. The initial password is raspberrypi.

First Boot Setup

If you plug a screen, keyboard, and mouse, or if you connect using VNC to the first boot screen you can do several of the steps mentioned later over the graphical first time setup guide, i.e. resizing the root file system, setting up the time zone, or configuring the graphical output. Confer the setting up VNC below to use the VNC method. If you choose to use the graphical setup you can skip the following manual steps.

Installing a VNC Server

There are two methods to setup the VNC server. First, you can run a VNC server manually each time you want to use it. This method is required to connect to the first boot screen. The second method adds a module loaded by the X server so that VNC is enabled each time the graphical screen starts.

For either method first install the required packages using

yum install tigervnc-server tigervnc-server-module

Manual VNC Server

Login as root. Check which display the X server is using by issuing

ps ax | grep Xorg

You will get a line where the commands starts with something like /usr/bin/Xorg :0. The ":0" shows you the display number. For first boot it will most likely be ":9". Then create a password and run the VNC server with

# vncpasswd /etc/vnc-passwd
Password: ...
Verify: ...
# DISPLAY=:0 x0vncserver -PasswordFile /etc/vnc-passwd

As you can see the display number must be adjusted as needed.

Automatic VNC Server integrated in X Server

First setup the password file as described above in the manual section. Then create the file /etc/X11/xorg.conf.d/30-vncserver.conf with the following content.

Section "Screen"
    Identifier "VNC"
    Option "SecurityTypes" "VncAuth"
    Option "UserPasswdVerifier" "VncAuth"
    Option "PasswordFile" "/etc/vnc-passwd"

Section "Module"
    Load "vnc"

The VNC server will be active after the next restart of the X server. In doubt just reboot. Do this only after first boot has been completed initially.

Resizing the Root Partition

The default image comes for a 2GB SD card, while you typically will want to use a larger disk. Hence the root partition must be resized. For this we will need to erase the partition and create a new one that starts exactly at the same position, but spans the free space. Afterwards need to reboot and to (on-line) resize the file system. Now step by step:

  1. Login as root on the raspi using SSH.
  2. Run fdisk and resize the partition by deleting and recreating.
    [root@raspi ~]# LANG=C fdisk /dev/mmcblk0
    Welcome to fdisk (util-linux 2.21.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    Command (m for help): p
    Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
    4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xfdddd43b
            Device Boot      Start         End      Blocks   Id  System
    /dev/mmcblk0p1   *        2048      106495       52224    c  W95 FAT32 (LBA)
    /dev/mmcblk0p2          106496    15523839     7708672   83  Linux
    Command (m for help): d
    Partition number (1-4): 2
    Partition 2 is deleted
    Command (m for help): n
    Partition type:
       p   primary (1 primary, 0 extended, 3 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 2): 2
    First sector (106496-15523839, default 106496): 106496
    Last sector, +sectors or +size{K,M,G} (106496-15523839, default 15523839): 
    Using default value 15523839
    Partition 2 of type Linux and of size 7.4 GiB is set
    Command (m for help): w

Now you need to reboot the raspi using reboot.

  1. Resize the file system. This can be done online. Just login as root again and execute:
    resize2fs /dev/mmcblk0p2

After a few seconds to minutes you will be able to make use of the full space.

Set Timezone

The time zone is set to EST by default. To switch it copy the appropriate zoneinfo file (see the available files with rpm -ql tzdata). For example for Europe/Berlin? do:

cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime

Enable Avahi mDNS-SD Service Discovery

Service discovery and host name announcement is extremely convenient and heavily used by Fawkes. You can enable it issuing the following commands:

systemctl unmask avahi-daemon.service
systemctl unmask avahi-daemon.socket
systemctl enable avahi-daemon.service
systemctl start avahi-daemon.service