Start Synergy (or any application) BEFORE logging in Ubuntu 16.04.2 LTS
Solution 1
For 16.04.2 create the following file (it doesn't exist)
/etc/lightdm/lightdm.conf
with the contents:
[Seat:*]
autologin-user=
[SeatDefaults]
greeter-setup-script=/usr/bin/synergyc --name <hostname> 192.168.x.x
Follow this ubuntu wiki guide for more information.
EDIT:
From man synergyc
:
STARTING AUTOMATICALLY...
options must not include
-f
or--no-daemon
. It's important to make sure no old copies of synergy are running so they can't interfere with the new one.
Solution 2
Go into your startup..for newbies like me do it this way:
- "search your computer" type in start, click on Startup Applications
-
click Add
- Name: Synergy
- Command: browse if you like but its /usr/bin/synergy
thats it, DO NOT ADD ANY "c", nothing to the end of synergy.
Now I also have the script running because I was too lazy to remove it..so both are there.
[Seat:*]
autologin-user=
[SeatDefaults]
greeter-setup-script=/usr/bin/synergyc --MediaServer 192.168.2.253:port
now to find the port is interesting, its not the default port so do this type in terminal
netstat -atn
now how I found it was look for your server ip...I know my SYNERGY server ip so right across from it is my client ip and port number.
Related videos on Youtube
DeeJayh
Updated on September 18, 2022Comments
-
DeeJayh almost 2 years
Using Ubuntu 16.04.2 (Xenial) on Intel x64:{Both Processor and Ubuntu install}
This question has been answered a million times, but none of the solutions work. So I don't want to duplicate a question, but it hasn't been answered.
When I fire up a terminal and
sudo -i
, the following command works just as expected.`root@user-pc:~# /usr/bin/synergyc -f --no-tray --debug INFO --name user-pc 192.168.xxx.xxx:24800 [2017-05-23T09:20:44] NOTE: started client [2017-05-23T09:21:01] NOTE: connecting to '192.168.5.100': 192.168.5.100:24800 [2017-05-23T09:21:01] NOTE: connected to server`
I am then able to utilize the program for it's purpose. However, I want this to be done automatically before login so that I can utilize it's purpose from the login screen. (Synergy allows you to use one keyboard and mouse across multiple computers, almost like a virtual KVM but instead of hitting switches, you just roll your mouse right onto the next screen as if they were all attached to one graphics card)
The first thing I tried was rc.local:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. exec /usr/bin/synergyc -f --no-tray --debug INFO --name user-pc 192.168.5.100:24800 exit 0
~~~
ls /etc/rc.local -l
:-rwxr-xr-x 1 root root 390 May 22 20:56 /etc/rc.local
So it's definitely executable, but upon rebooting the PC:
~~~
ps aux | grep syner
:`root 990 0.0 0.0 63656 5372 ? Ssl 09:33 0:00 /usr/bin/synergyc -f --no-tray --debug INFO --name user-pc 192.168.5.100:24800`
However it isn't doing what it is supposed to, even unity dialogs are being called saying something went wrong, which only happens when this executes, so I can safely assume it's that.
My safest assumption is that the program is being run just fine, the problem is that rc.local is run prior to the x session starting so any hooks to the keyboard and mouse are never established, which is also likely only done at the beginning of execution of
synergyc
and not attempted again beyond that point.The second thing I tried was "Startup Applications", it works, but not until after login, which is not what we want going on here.
If my assumption is correct:
What is a way to call execution of a process after the x server is up, but before any user has to login.
If my assumption is not correct:
-
Rinzwind about 7 yearsProbably for gdm you need
/etc/gdm/Init/Default
and for Unity you need to add a script to/etc/init/lightdm.conf
. -
DeeJayh about 7 years@Rinzwind lightdm.conf is still too early, even in the post-start section of it, synergy errors out using the same command that works perfectly fine from the terminal. Ubuntu throws an error saying synergy stopped unexpectedly, likely because it can't access the hooks it needs to control the keyboard and mouse yet, need it to happen right when the login screen is displayed so that everything is up and running already
-
Mark about 7 yearsNot terribly helpful but perhaps a little comforting - I struggled with this for about a year before a gave up (GDM) ... I did settle on what I thought was a way it "might" work: two user systemd units, one for a virtual x-server login (think kiosk but not shown), then a trigger to kill that when an actual user logs on. In the end for my use case it wasn't worth it but maybe that helps you. All hail ACME!
-
Ziazis about 7 yearsIf I'm not mistaken synergy needs an X server though, so it can't work without a user logged in
-
anonymous2 about 7 yearsJust a wild stab in the dark, but have you tried adding to
.xinitrc
? -
mini about 7 yearsUse systemd timer or crontabe to run the command on boot.
-
DeeJayh about 7 years@mini that doesn't work because it's called before the xserver, therefor it isn't able to hook into the keyboard or mouse
-
DeeJayh about 7 years@anonymous2 .xinitrc is a no-go, but thank you for trying.
-
DeeJayh about 7 years@Ziazis it was possible in the past according to help.ubuntu.com/community/… so why not now?
-
-
Ziazis about 7 yearsThat's acutally really nice! Good to know, just adding it to
/etc/lightdm/lightdm.conf
is enough to make it work completly. Maybe add what he has to add to the answer instead of only linking the ubuntu link. -
pa4080 about 7 yearsThis approach definitely works, but in within my system, when there is auto-login user some error is generated.
-
Ziazis about 7 yearsSpas if you have an auto login, just add synergy to your startup applications.
-
DeeJayh about 7 yearsPretty sure this works on an older version of Ubuntu, but not on mine. I created /etc/lightdm/lightdm.conf because it didn't exist and put in the two lines above (of course changing it to use my own information) I now have synergy connection when the screen loads up, however I now no longer get the login screen. It's just a blank screen with an X cursor.
$ sudo find / -name lightdm.conf
gives/etc/init/lightdm.conf
and/etc/lightdm/lightdm.conf
with the latter being the one I created manually with the two-liner in it. Removing the lightdm.conf I created restores it back to working order. -
Ziazis about 7 yearsDeeJayh, the only difference I have for myself is that I have in the first two lines my autologin which I removed. so my first line is
[Seat:*]
and second line isautologin-user=
it's a longshot but maybe try adding at least the [Seat:*] as your first line or just both? -
pa4080 about 7 yearsI can confirm that, this approach works on 16.04.2!
-
DeeJayh about 7 years@Ziazis putting all 4 lines of code worked!
-
DeeJayh about 7 years@SpasSpasov I know I'm so excited, I changed the answer to reflect our specifics, waiting on peer review.
-
BitBug about 6 yearsNote that if you are just using the synergy server's IP set the last line of code to:
greeter-setup-script=/usr/bin/synergyc 192.168.x.x
-
DerfK almost 5 yearsOne more thing to add with the latest versions, I was unable to get this to start as a client until I added
--enable-crypto
(1.10.3)