1

I am using Ubuntu 18.04 LTS and Windows 10 PC with Synergy Version: 1.11.1rc2-4a90760e. On Windows client, it is automatically started before login and works fine. My ubuntu server doesn't have autostart feature and I would like to add it in order to be able to login on Windows even before Ubuntu login.

I have tried multiple solutions with no avail. Lastly, I have settled on creating a service file that calls the application starup scrip. Check the service status:

   Loaded: loaded (/etc/systemd/system/synergy@justech.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-02-11 08:09:05 EAT; 36min ago
 Main PID: 1021 (synergysauto)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/system-synergy.slice/synergy@justech.service
           ├─1021 /bin/bash /usr/local/bin/synergysauto
           └─1064 synergys -f -d INFO --name Hp -c /etc/synergy.conf -a 10.42.0.1:45000 --log /var/log/synergy.log

Feb 11 08:41:47 Delta synergysauto[1021]: [2021-02-11T08:41:47] INFO: switch from "Lenovo" to "Hp" at 1361,196 Feb 11 08:41:47 Delta synergysauto[1021]: [2021-02-11T08:41:47] INFO: entering screen Feb 11 08:41:48 Delta synergysauto[1021]: [2021-02-11T08:41:48] INFO: switch from "Hp" to "Lenovo" at 0,289 Feb 11 08:41:48 Delta synergysauto[1021]: [2021-02-11T08:41:48] INFO: leaving screen Feb 11 08:42:08 Delta synergysauto[1021]: [2021-02-11T08:42:08] INFO: switch from "Lenovo" to "Hp" at 1355,401 Feb 11 08:42:08 Delta synergysauto[1021]: [2021-02-11T08:42:08] INFO: entering screen Feb 11 08:42:09 Delta synergysauto[1021]: [2021-02-11T08:42:09] INFO: switch from "Hp" to "Lenovo" at 0,251 Feb 11 08:42:09 Delta synergysauto[1021]: [2021-02-11T08:42:09] INFO: leaving screen Feb 11 08:44:57 Delta synergysauto[1021]: [2021-02-11T08:44:57] INFO: switch from "Lenovo" to "Hp" at 1364,586 Feb 11 08:44:57 Delta synergysauto[1021]: [2021-02-11T08:44:57] INFO: entering screen ~

Check service file:

[Unit]
Description=Synergy Server
After=network.target

[Service] ExecStart=/usr/local/bin/synergysauto Restart=on-failure User=%i

[Install] WantedBy=multi-user.target

The synergys startup file is initiated as a process as seen in the service status output and looks like:

#!/bin/bash

use the following defined address and configuration file.

The option --daemon runs the process in the background

Use Hp as the server name instead of the hostname

Execute

synergys -f -d INFO --name Hp -c /etc/synergy.conf -a 10.42.0.1:45000 --log /var/log/synergy.log

Exit status

exit 0

Now everything is working fine except that the server cannot access the primary screen when logged out. I have confirmed this in the virtual console accessed before login to the GUI. In the synergy log file there was 'WARNING' message stating can't leave screen Hp to Lenovo which are my screens set in the config file.If you check closely you will see that I must be logged in as a certain user in the GUI for synergy to access the primary X Server. The service is start using command sudo systemctl start synergy@$(whoami) and enabled with sudo systemctl enable synergy@$(whoami).

How can I have the display manager start the server? Thanks in advance.

Justech
  • 184

1 Answers1

0

After a detailed research I have arrived to light on this issue. Synergy uses X server and to have run before login we need to let GNOME Display Manager start the service. To achieve this we have to create and edit:

edit;
/etc/gdm3/Init/Default
/etc/gdm3/PostLogin/Default

create a session file: /etc/X11/Xsession.d/85synergys

The session file confirms to be working as it is responsible for staring the server when a user login session is created. However, the dgm3 does not start the server before login and after logging out. I am calling for help to improve this answer please.

References:

SynergyHowTo

Ubuntu Maunuals

Justech
  • 184