Skip to content

Instantly share code, notes, and snippets.

@copuzzle
Last active September 30, 2017 13:33
Show Gist options
  • Save copuzzle/8e8c44ab2bfd781f45ea097fcc9c6db5 to your computer and use it in GitHub Desktop.
Save copuzzle/8e8c44ab2bfd781f45ea097fcc9c6db5 to your computer and use it in GitHub Desktop.

System Feature

auto config

There are some great answers here, but many are out of date. Since May 2016, Raspbian has been able to copy wifi details from /boot/wpa_supplicant.conf into /etc/wpa_supplicant/wpa_supplicant.conf to automatically configure wireless network access:

If a wpa_supplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpa_supplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition. wpa config update

Since the /boot partition is accessible by any computer with an SD card reader, wifi configuration is now much simpler.

A skeleton wpa_supplicant.conf file can be as little as:

network={ ssid="YOUR_SSID" psk="YOUR_PASSWORD" key_mgmt=WPA-PSK } Also, since November 2016, SSH is disabled on Raspbian by default. However, it is very easy to enable:

For headless setup, SSH can be enabled by placing a file named 'ssh', without any extension, onto the boot partition of the SD card. When the Pi boots, it looks for the 'ssh' file; if it is found, SSH is enabled and then the file is deleted. The content of the file doesn't matter: it could contain either text or nothing at all.

ssh security

Trick

ssh Connection refused problem:

sudo dpkg-reconfigure openssh-server

auto wifi

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

apt source

vi /etc/apt/sources.list

deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib

keyboard

vi /etc/default/keyboard

modify XKBLAYOUT="pb" to XKBLAYOUT="us"

sdcard clone (too big)

diskutil list
sudo dd if=/dev/disk2 of=~/berry/SDCardBackup-17-09-30.dmg

#Then use the this to write the image back to the SD card:
diskutil unmountDisk /dev/rdisk2 
sudo dd bs=1m if=~/SDCardBackup.dmg of=/dev/rdisk2

#Once it has finished writing the image to the SD card, you can remove it from your Mac using:
sudo diskutil eject /dev/rdisk2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment