Skip to content

Instantly share code, notes, and snippets.

@martinandrovich
Last active November 20, 2019 11:56
Show Gist options
  • Save martinandrovich/b20d2be98178252cf076dd50c09d1333 to your computer and use it in GitHub Desktop.
Save martinandrovich/b20d2be98178252cf076dd50c09d1333 to your computer and use it in GitHub Desktop.
Raspberry Pi Zero configuration on Ubuntu 19.04

Raspberry Pi Zero Configuration


Installation

Flashing

Installing requires downloading the a Raspbian image (archive) and installing using Etcher. The default credentials are username pi and password raspberry.

USB Connection and SSH

In root of the mounted drive, in config.txt, add the following line at the very bottom:

dtoverlay=dwc2

Next, in cmdline.txt to add the following after the rootwait parameter:

modules-load=dwc2,g_ether

In order to enable SSH, create a file /boot/ssh (the file is named ssh to be placed in the /boot/ directory).

Connecting to the Pi can then be done using the default credentials: username pi and password raspberry, with the command:

ssh pi@raspberrypi.local

Althogh, when using Linux, the network manager may not assign an IP adress to the connected device (which it also renames), and it may therefore be necessary to manually assign an IP address or alter the Ubuntu network manager settings.

General

Common settings can be configured using:

sudo raspi-config

Network Manager & Automatic Renaming

Preparing the GRUB

https://askubuntu.com/questions/767786/changing-network-interfaces-name-ubuntu-16-04/767796#767796

Adding device to rule files (interface setup)

https://unix.stackexchange.com/a/386170

Desired IP address:

169.254.0.1/16
169.254.X.X/16

Useful commands

# view IP devices
ip a
ip -br a #brief

# output kernel buffer (for device connection)
dmesg
dmesg --follow #continuous (-w)

# ping raspberry
ping raspberrypi.local

Serial Connection

Text.

sudo screen /dev/ttyUSB0 11520

WiFi Setup

BUG in Raspbian Buster [!!!]

There is a bug when trying to connect using OpenSSL 4-way handshake in Rasbian Buster.

https://cronburg.com/2019/raspberry-pi-wifi/#fixing-wifi
https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=111100&sid=8419a1e880456d7b79f01fa711efe442&start=25

wpa_supplicant file

Located at /etc/wpa_supplicant/wpa_supplicant.conf the file allows to define network configurations in the format network={...}.

A simple setup:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="SomeWifiName"
    psk="mysuperpassword"
}

The wpa can be reconfigured using:

# reconfigure
wpa_cli reconfigure
wpa_cli -i wlan0 reconfigure
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
sudo killall wpa_supplicant
sudo restart

# check connection
sudo ifconfig
sudo iwconfig

# restart all interfaces
sudo ifdown -a
sudo ifup -a

The network interface file /etc/network/interfaces must also be configured correctly for this to work, as:

auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

eduroam setup

The wpa_suplicant.conf file is edited using: https://github.com/oleks/eduroam-wpa_supplicant/blob/master/supplicant.conf. The hash is generated using the following command; after executing the command, type the password, hit enter and hit CTRL + D.

cat | tr -d ‘\n| iconv -t utf16le | openssl md4

DNS Server

In some cases the DNS server must be defined in the file /etc/dhcpcd.conf with the added lines:

# dns server
static domain_name_servers=8.8.4.4 8.8.8.8

And restart DNS using:

sudo service dhcpcd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment