projects/ janelia/ Y-Arena/

Repository README

raspberrypi_setup notes

Raspberry Pi setup notes and supporting files for ycontroller.

This local copy stores the Raspberry Pi setup notes referenced by the Y-Arena ycontroller setup page.

Key Files

Repository Information

Author
Peter Polidoro
License
BSD-3-Clause

Raspberry Pi Setup

Setup Ubuntu Server SD Card

On a host computer run:

cd ~/Downloads && wget https://cdimage.ubuntu.com/releases/22.04.1/release/ubuntu-22.04.1-preinstalled-server-arm64+raspi.img.xz

On a host computer run this before plugging SD card into host computer:

lsblk -p

Plug SD card into host computer and run:

lsblk -p

After verifying which device is your SD card (e.g. /dev/sdf1), unmount it using the following command:

umount /dev/sdf[0-9]

Next, we can write the image file to the SD card (be very careful using dd!):

Wait for a long time for command to finish.

cd ~/Downloads && xzcat ubuntu-22.04.1-preinstalled-server-arm64+raspi.img.xz | sudo dd of=/dev/sdf bs=4M status=progress conv=fsync
sudo touch $(findmnt -S /dev/sdf1 -o TARGET -n)/ssh
umount /dev/sdf[0-9]

Remove SD card from host computer.

Initialize Raspberry Pi

Insert the SD card you’ve set up with Ubuntu Server into the microSD card slot on the underside of your Raspberry Pi.

Use an Ethernet cable to connect the Ethernet port on Raspberry Pi to an Ethernet socket on the wall, or toon your internet router, or to a host computer ethernet port, or to a usb to ethernet adapter.

Plug the USB power supply into a socket and connect it to your Raspberry Pi’s power port.

SSH into Raspberry Pi

ssh ubuntu@ubuntu.local
  1. If 'No route to host' error:

    ip addr
    # find ip addresses of various ip links on the host computer
    # e.g. 192.168.1.117
    nmap -p22 --open -sV 192.168.1.0/24
    ssh ubuntu@192.168.1.77
    # e.g. 10.42.0.1
    nmap -p22 --open -sV 10.42.0.0/24
    ssh ubuntu@10.42.0.193
    

Change password

Initial password is: ubuntu Change password

Update

# may need to reboot before upgrade if unattended-upgr has cache lock
sudo apt update && sudo apt full-upgrade -y
sudo apt autoremove -y
# reboot after upgrade

Setup avahi-daemon so you can reach hostname.local from from host OS

sudo apt install -y avahi-daemon avahi-discover avahi-utils libnss-mdns mdns-scan
sudo reboot

Change username and hostname

  1. Create temporary user

    sudo adduser tempuser && sudo usermod -aG sudo tempuser
    exit
    
  2. Change username

    ssh tempuser@<ipaddress>
    
    sudo usermod -l newusername -d /home/newusername -m ubuntu
    sudo groupmod -n newusername ubuntu
    sudo ln -s /home/newusername /home/ubuntu
    exit
    
    ssh newusername@ubuntu.local
    
    sudo userdel -r tempuser
    exit
    
  3. Change hostname

    hostnamectl
    sudo hostnamectl set-hostname newhostname
    sudo reboot
    

Setup cockpit for managing Ubuntu with a web console

sudo apt install -y cockpit
  1. Access cockpit web console on Ubuntu

    https://hostname.local:9090

Setup SSH Keys

ssh-keygen -t ed25519 -C "your_email@example.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Install Docker

../docker_setup/DOCKER_SETUP_LINUX.html

Connecting to Raspberry Pi

Ubuntu

USB to Ethernet Adapter Direct Connection

Setup Ethernet connection for USB ethernet adapter device and under IPv4 settings set method to 'Shared to other computers'.

Windows

Download Bonjour Print Services for Windows

To make hostname.local work with windows, you must download and install Bonjour for Windows:

https://developer.apple.com/bonjour/

USB to Ethernet Adapter Direct Connection

Setup Ethernet connection for USB ethernet adapter device and in Network and Sharing Center select network with internet access and allow internet connection sharing with Ethernet connection of USB ethernet adapter.