Skip to content

Instantly share code, notes, and snippets.

@yarwelp
Last active September 4, 2016 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yarwelp/85c0e8e3cf59768a9db2491bcd384d07 to your computer and use it in GitHub Desktop.
Save yarwelp/85c0e8e3cf59768a9db2491bcd384d07 to your computer and use it in GitHub Desktop.
Raspberry Pi 3 Model B config

Raspberry Pi 3 Model B config

Download the "Raspbian Lite" minimal image from https://www.raspberrypi.org/downloads/, unzip it and dd it to a microSD card. Insert microSD into your Raspberry Pi 3 Model B (RPi), attach keyboard, video-monitor and mouse. Power on the RPi.

Set hostname. I'll call mine rpi3b. Use something you like.

echo rpi3b | sudo tee /etc/hostname
sudo hostname rpi3b
sudo sed -i 's/raspberrypi/rpi3b/g' /etc/hosts

Next, apt update, apt upgrade and then install essential packages;

sudo apt update
sudo apt upgrade
sudo apt install \
        slim mate-desktop-environment-core mate-media \
        mate-utils mate-themes dconf-tools caja-open-terminal \
        vim-nox git rxvt-unicode-256color firefox-esr \
        libreoffice-writer libreoffice-calc libreoffice-impress \
        scribus inkscape blender \
        avr-libc gcc-avr avrdude
        

Force 1080p HDMI

sudo tee /boot/config.txt <<EOF

hdmi_force_hotplug=1

# 1080p
hdmi_group=1
hdmi_mode=16
EOF

Configure keyboard. This first part is for TypeMatrix 2030 USB.

sudo tee /etc/default/keyboard <<EOF
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="tm2030USB"
XKBLAYOUT="us"
XKBVARIANT="dvorak"
XKBOPTIONS="terminate:ctrl_alt_bksp"

BACKSPACE="guess"
EOF

Configure keyboard cont.

sudo mkdir /etc/X11/xorg.conf.d/
sudo tee /etc/X11/xorg.conf.d/10-keymap.conf <<EOF
Section "InputClass"
        Identifier "Keyboard Defaults"
        MatchIsKeyboard "yes"
        Option "XkbLayout" "dvorak"
EndSection
EOF

Configure to boot to graphical desktop

sudo systemctl set-default graphical.target

Enable WiFi always

sudo sed -i.old '8s;^;\nauto wlan0\n;' /etc/network/interfaces

Enter details for your WiFi network, replacing mysweetwifi and supersecret with your own SSID and PSK respectively

sudo tee /etc/wpa_supplicant/wpa_supplicant.conf <<EOF
network={
    ssid="mysweetwifi"
    psk="supersecret"
}
EOF

Download Synergy stable source tarball from https://github.com/symless/synergy/tags

Patch the python scripts so they are able to generate a deb without a git repository. This patch is for Synergy v1.7.5. Adapt as needed.

--- synergy-1.7.5-stable/ext/toolchain/commands1.py	2015-11-19 20:51:14.000000000 +0100
+++ synergy-1.7.5-stable/ext/toolchain/commands1.py	2016-08-30 16:11:13.899392253 +0200
@@ -945,40 +945,12 @@
 		return self.getGitRevision()
 
 	def getGitRevision(self):
-		if sys.version_info < (2, 4):
-			raise Exception("Python 2.4 or greater required.")
-		
-		p = subprocess.Popen(
-			["git", "log", "--pretty=format:%h", "-n", "1"],
-			stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
-		stdout, stderr = p.communicate()
-
-		if p.returncode != 0:
-			raise Exception('Could not get revision, git error: ' + str(p.returncode))
 	
-		return stdout.strip()
+		return "fa85a24"
 
 	def getGitBranchName(self):
-		if sys.version_info < (2, 4):
-			raise Exception("Python 2.4 or greater required.")
-		
-		p = subprocess.Popen(
-			["git", "rev-parse", "--abbrev-ref", "HEAD"],
-			stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
-		stdout, stderr = p.communicate()
-
-		if p.returncode != 0:
-			raise Exception('Could not get branch name, git error: ' + str(p.returncode))
-	
-		result = stdout.strip()
-
-		# sometimes, git will prepend "heads/" infront of the branch name,
-		# remove this as it's not useful to us and causes ftp issues.
-		result = re.sub("heads/", "", result)
 
-		return result
+		return "master"
 
 	def find_revision_svn(self):
 		if sys.version_info < (2, 4):

Build Synergy as per https://github.com/symless/synergy/wiki/Compiling#Debian_78

Create deb and install it

./hm.sh package deb
sudo dpkg -i ./bin/synergy-master-stable-fa85a24-Linux-armv6l.deb

The rpi will have the keyboard and mouse connected at all times because it has the lower power consumption. Configure synergy server. Example config shown, adapt as needed.

sudo tee -a /etc/hosts <<EOF
10.42.0.1       cubi
EOF

cat > ~/synergy.conf <<EOF
section: screens
	cubi:
	rpi3b:
end

section: links
	cubi:
		right = rpi3b

	rpi3b:
		left = cubi
end
EOF

Start Synergy server on login

mkdir -p .config/autostart/

cat > .config/autostart/synergys.desktop <<EOF
[Desktop Entry]
Type=Application
Exec=synergys -c /home/pi/synergy.conf
Hidden=false
X-MATE-Autostart-enabled=true
Name[en_US]=synergys
Name=synergys
Comment[en_US]=
Comment=
EOF

Next, install synergy on the client computer, and then configure the client computer like follows. In my case, my client computer runs LXQt on Fedora 23. Again, adapt as needed.

mkdir -p .config/autostart/

cat > .config/autostart/synergyc.desktop <<EOF
[Desktop Entry]

Type=Application

Exec=synergyc rpi3b
EOF

Reboot the RPi

sudo reboot

Reboot the client computer

sudo reboot

Temporarily lower the priority of eth0 for routing

In certain configurations, you may have your RPi connected to networks on both wireless interface wlan0 and on wired interface eth0. If you do and you want the RPi to prefer the wlan0 interface temporarily, do:

sudo route del default dev eth0

sudo route add default gw cubi metric 404 dev eth0

In the route add command above, replace cubi with the hostname or IP address of the gateway on the network of eth0.

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