Running Synergy on Raspberry Pi (Raspbian) at boot

So we’ve got our little Lego-encased RasPi up and running…

ACT PWR FDX LNK

After getting the Debian installation (Berryboot, Wheezy 5/’13) up and running he 1st things I wanted to achieve were to change the username of the Pi, make it boot straight into the desktop environment again after a reboot, and to start running a Synergy client so it automatically connects to the Synergy server on my Mac. After searching for a long, long time on google and trying numerous ways that wrecked X11 beyond repair (forcing me to reinstall Raspbian), I found the answer accidentally while looking through the files in the LightDM folder. So if you too are still looking for this, here’s how incredibly simple it is.

In the terminal type:

$ sudo nano /etc/lightdm/lightdm.conf

Search for this function:

autologin-user=pi

And change the ‘pi’ entry to whatever username you are currently using, so it looks like this:

autologin-user=YOUR_USERNAME

Press ‘ctrl+x’, ‘y’ to confirm you want to save, and the enter button to confirm. You’re done! The Raspbian installation will now automatically boot into the desktop with your username logged-in.

USB

Next, I wanted to run Synergy on the Raspberry Pi. With Synergy you can share a keyboard and mouse across multiple computers, no matter what operating system. It looks and works just like having multiple screens connected to one computer, and it’s awesome! Luckily, there’s already a build for our RasPi flavour of Debian. So, lets start-off by installing Synergy, if you hadn’t already:

$ sudo apt-get install synergy

Wait for it to complete installing. Next we’re gonna make a file to tell Synergy to start at boot when X11 starts. Enter the following three commands into the terminal:

$ cd /etc/X11/Xsession.d
$ sudo touch 12synergy
$ sudo nano 12synergy

In this empty file that just popped-up when you enter the ‘nano’ command, paste the following:

#/bin/bash
/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc –daemon –restart –name CLIENT_NAME SERVER_IP_ADDRESS

CLIENT_NAME is the name you want to send to the server for identification and SERVER_IP_ADDRESS is, what else, the server’s local IP address. Press ctrl+X to quit the nano editor, press “Y” to save your changes and the enter key to confirm. Next we’re gonna give this file executing rights, by typing in:

$ sudo chmod +x 12synergy

Peek-a-boo

Credits for this go to this blog, except that the 2nd part of that tutorial doesn’t work for me cause there’s no gdm to be found on the Pi! So I did some digging around in the files (finding the auto-login solution above in the process) and here’s what needs to be done:

$ cd /etc/X11/
$ sudo nano Xsession

In this file, scroll all the way down to the last ‘fi’ and type/paste the following before ‘exit 0’:

# ADDED FOR SYNERGY
/usr/bin/killall synergyc
sleep 1
//usr/bin/synergyc –daemon –restart –name CLIENT_NAME SERVER_IP_ADDRESS
# END SYNERGY

ctrl+x, y, enter. And you’re done!! Again, CLIENT_NAME is the name you want to send to the server and SERVER_IP_ADDRESS is the server’s IP address. On the next reboot synergy will automatically run, and if you configured both the client and server correctly, will connect right away! If you’re ready to try this out, end with the following command to reboot the Raspberry Pi.

$ sudo reboot

 EDIT: I was originally planning to do a VNC tutorial on this blog as an alternative to using Synergy. However, the ‘how to’ provided by Adafruit couldn’t be any easier. They show you how to install and run VNC, but also how start it at boot the easy way. So if that’s what you’re looking for, head on over to ‘Running VNCServer at startup‘.

Edit 14/12/2013: Adafruit has also released a tutorial about installing Synergy on the Raspberry Pi. Which takes the approach of having it boot with the desktop environment by utilizing the autostart features of lxde at user-level. The tutorial includes building Symergy from source which might be daunting for some user, but it’s very educative nonetheless. I reckon using apt-get like in my tutorial’ll work fine as well, so if the source-code part scares you, try that instead.
Setting up a Synergy Server‘.

 

Comments

1 Comment

Other Links to this Post

RSS feed for comments on this post. TrackBack URI

Leave a comment