[GH-ISSUE #185] onBoot #148

Open
opened 2026-05-05 05:24:03 -06:00 by gitea-mirror · 23 comments
Owner

Originally created by @a7hybnj2 on GitHub (Nov 30, 2018).
Original GitHub issue: https://github.com/debauchee/barrier/issues/185

Operating Systems

Server: Arch from AUR

Client: Windows 10, Windows 8.1, and MacOS Mojave

I have tried looking at synergy help documents for a way to get barrier to boot before login windows so that, obviously, you can used a shared keyboard to login to multiple systems.

It seems that there are some versions of synergy that have a 'service' option at least for windows. I also tried some funny mac script that ultimately caused my OS to fail to boot and I had to recover-mode terminal delete the script to boot again.

It would be great to add a writeup to the wiki on how, if possible, to get the clients and server to start prior to login screens.

Originally created by @a7hybnj2 on GitHub (Nov 30, 2018). Original GitHub issue: https://github.com/debauchee/barrier/issues/185 ### Operating Systems ### Server: Arch from AUR Client: Windows 10, Windows 8.1, and MacOS Mojave I have tried looking at synergy help documents for a way to get barrier to boot before login windows so that, obviously, you can used a shared keyboard to login to multiple systems. It seems that there are some versions of synergy that have a 'service' option at least for windows. I also tried some funny mac script that ultimately caused my OS to fail to boot and I had to recover-mode terminal delete the script to boot again. It would be great to add a writeup to the wiki on how, if possible, to get the clients and server to start prior to login screens.
gitea-mirror added the
enhancement
help wanted
labels 2026-05-05 05:24:03 -06:00
Author
Owner

@a7hybnj2 commented on GitHub (Nov 30, 2018):

UPDATE: I don't know exactly I was doing previously but it seems that my windows machine does indeed start barrier on boot. I wasn't patient enough to wait for it to connect, takes about 10-15 seconds after login screen is visible.

I start my server with the
Arch(plasma) - System Settings - Startup and Shutdown - Autostart - "/bin/barriers -f --no-tray --debug INFO --name myPrivateName --enable-crypto -c /home/myPrivateUName/.barrier.conf --address :24800"
and that starts the service just fine but only after login.

And mac...who knows
EDIT: I have "/Applications/Barrier.app/Contents/MacOS/barrierc -f --no-tray --debug INFO --name myOtherPrivateName n --enable-drag-drop --enable-crypto [192.168.1.184]:24800"
added to login items for my user

<!-- gh-comment-id:443325702 --> @a7hybnj2 commented on GitHub (Nov 30, 2018): UPDATE: I don't know exactly I was doing previously but it seems that my windows machine does indeed start barrier on boot. I wasn't patient enough to wait for it to connect, takes about 10-15 seconds after login screen is visible. I start my server with the ```Arch(plasma) - System Settings - Startup and Shutdown - Autostart - "/bin/barriers -f --no-tray --debug INFO --name myPrivateName --enable-crypto -c /home/myPrivateUName/.barrier.conf --address :24800"``` and that starts the service just fine but only after login. And mac...who knows EDIT: I have ```"/Applications/Barrier.app/Contents/MacOS/barrierc -f --no-tray --debug INFO --name myOtherPrivateName n --enable-drag-drop --enable-crypto [192.168.1.184]:24800"``` added to login items for my user
Author
Owner

@AdrianKoshka commented on GitHub (Dec 1, 2018):

We don't really have an officially documented way of doing autostart as you said. I've been rather busy with other things in life, mostly having enough time to check issues daily and try to label them.

<!-- gh-comment-id:443398138 --> @AdrianKoshka commented on GitHub (Dec 1, 2018): We don't really have an officially documented way of doing autostart as you said. I've been rather busy with other things in life, mostly having enough time to check issues daily and try to label them.
Author
Owner

@a7hybnj2 commented on GitHub (Dec 3, 2018):

I will take a look and try to document how, if ever, I get it to work. I will leave my notes here.

Windows: Done. Seems to enable auto start automatically.

Linux: Should be easy but I did read about KDE locking the keyboard down until after login. So, that might be an issue running server on a KDE box. Now 100% sure yet.

MacOS: Seems like the 'old way' pre 10.10 was easy using plist. I am still looking for a 10.14 way that doesn't lock up my system.

Ref1
Ref2
Ref3
Ref4

<!-- gh-comment-id:443756369 --> @a7hybnj2 commented on GitHub (Dec 3, 2018): I will take a look and try to document how, if ever, I get it to work. I will leave my notes here. Windows: Done. Seems to enable auto start automatically. Linux: Should be easy but I did read about KDE locking the keyboard down until after login. So, that might be an issue running server on a KDE box. Now 100% sure yet. MacOS: Seems like the 'old way' pre 10.10 was easy using plist. I am still looking for a 10.14 way that doesn't lock up my system. [Ref1](https://github.com/symless/synergy-core/wiki/Running-Synergy-at-startup-on-MacOS) [Ref2](https://github.com/symless/synergy-core/wiki/Autostarting) [Ref3](https://web.archive.org/web/20150511090759/http://synergy2.sourceforge.net/autostart.html) [Ref4](https://help.ubuntu.com/community/SynergyHowto#On_the_Client-1)
Author
Owner

@mgorbet commented on GitHub (Feb 8, 2019):

Any tips or links on how to get a raspberry pi to launch Barrier on startup would be very helpful. I tried cron @reboot but so far can't seem to get the syntax right ... or something.

What's the 'accepted wisdom' on this?

<!-- gh-comment-id:461813658 --> @mgorbet commented on GitHub (Feb 8, 2019): Any tips or links on how to get a raspberry pi to launch Barrier on startup would be very helpful. I tried cron @reboot but so far can't seem to get the syntax right ... or something. What's the 'accepted wisdom' on this?
Author
Owner

@AdrianKoshka commented on GitHub (Feb 8, 2019):

I know I used systemd user services.

<!-- gh-comment-id:461845070 --> @AdrianKoshka commented on GitHub (Feb 8, 2019): I know I used systemd user services.
Author
Owner

@mgrant0 commented on GitHub (Jul 28, 2020):

To get Barrier to launch at startup on MacOS:

image

But it always comes up like this:

image

Is it possible to get it to start in client mode with a pre-configured IP address?

<!-- gh-comment-id:665049696 --> @mgrant0 commented on GitHub (Jul 28, 2020): To get Barrier to launch at startup on MacOS: ![image](https://user-images.githubusercontent.com/4175366/88673453-89b7d780-d0e0-11ea-9c38-5d1a35891b1c.png) But it always comes up like this: ![image](https://user-images.githubusercontent.com/4175366/88673720-db606200-d0e0-11ea-9cad-260c4aa99041.png) Is it possible to get it to start in client mode with a pre-configured IP address?
Author
Owner

@shymega commented on GitHub (Jul 28, 2020):

To get Barrier to launch at startup on MacOS:

image

But it always comes up like this:

image

Is it possible to get it to start in client mode with a pre-configured IP address?

Hm.. you might be able to use barrierc directly.

<!-- gh-comment-id:665277847 --> @shymega commented on GitHub (Jul 28, 2020): > To get Barrier to launch at startup on MacOS: > > ![image](https://user-images.githubusercontent.com/4175366/88673453-89b7d780-d0e0-11ea-9c38-5d1a35891b1c.png) > > But it always comes up like this: > > ![image](https://user-images.githubusercontent.com/4175366/88673720-db606200-d0e0-11ea-9cad-260c4aa99041.png) > > Is it possible to get it to start in client mode with a pre-configured IP address? Hm.. you might be able to use `barrierc` directly.
Author
Owner

@abudiar commented on GitHub (Nov 25, 2020):

To get Barrier to launch at startup on MacOS:

image

But it always comes up like this:

image

Is it possible to get it to start in client mode with a pre-configured IP address?

I've been able to get it to launch with a preconfigured ip address by:

  1. Setting the ip address, connect to server
  2. Quit Barrier through the top bar icon
  3. Relaunch Barrier
  4. Set Barrier to launch at login

Then once I restart it launches with the ip address already saved.

<!-- gh-comment-id:733888667 --> @abudiar commented on GitHub (Nov 25, 2020): > To get Barrier to launch at startup on MacOS: > > ![image](https://user-images.githubusercontent.com/4175366/88673453-89b7d780-d0e0-11ea-9c38-5d1a35891b1c.png) > > But it always comes up like this: > > ![image](https://user-images.githubusercontent.com/4175366/88673720-db606200-d0e0-11ea-9cad-260c4aa99041.png) > > Is it possible to get it to start in client mode with a pre-configured IP address? I've been able to get it to launch with a preconfigured ip address by: 1. Setting the ip address, connect to server 2. Quit Barrier through the top bar icon 3. Relaunch Barrier 4. Set Barrier to launch at login Then once I restart it launches with the ip address already saved.
Author
Owner

@oppalla commented on GitHub (Jul 5, 2021):

I'm also trying to set Barrier to start as a service, like VNC server, in order to log in on macOS from my Windows host keyboard/mouse.
unfortunately even clicking on Options > Open at login, I can't use my Windows Keyboard and Mouse to put my login credentials when I turn my iMac on.
I'm running High Sierra 10.13.6.

any help will be appreciated!

<!-- gh-comment-id:874281326 --> @oppalla commented on GitHub (Jul 5, 2021): I'm also trying to set Barrier to start as a service, like VNC server, in order to log in on macOS from my Windows host keyboard/mouse. unfortunately even clicking on Options > Open at login, I can't use my Windows Keyboard and Mouse to put my login credentials when I turn my iMac on. I'm running High Sierra 10.13.6. any help will be appreciated!
Author
Owner

@xrpdevs commented on GitHub (Jul 5, 2021):

I run MacOS in a Proxmox/KVM instance with it's own GPU. Barrier server is on Manjaro (also KVM guest with own GPU) which is where the USB ports are plugged in.

I'm wondering if it would be possible to run barrierc as root pre-login via SSH with a hook script at VM launch time..

<!-- gh-comment-id:874363440 --> @xrpdevs commented on GitHub (Jul 5, 2021): I run MacOS in a Proxmox/KVM instance with it's own GPU. Barrier server is on Manjaro (also KVM guest with own GPU) which is where the USB ports are plugged in. I'm wondering if it would be possible to run barrierc as root pre-login via SSH with a hook script at VM launch time..
Author
Owner

@xrpdevs commented on GitHub (Jul 5, 2021):

Have you seen https://web.archive.org/web/20150511090759/http://synergy2.sourceforge.net/autostart.html ?

<!-- gh-comment-id:874367627 --> @xrpdevs commented on GitHub (Jul 5, 2021): Have you seen https://web.archive.org/web/20150511090759/http://synergy2.sourceforge.net/autostart.html ?
Author
Owner

@xrpdevs commented on GitHub (Jul 5, 2021):

Thinking this could be used for running barrier pre-login, if we modify the "KeepAlive" part to the StartupItems script to check for the presence of a file in say /tmp then we can tell the script to kill barrier once we're running barrier as our logged-in user (so clipboard works) then, assuming there are "OnLogOut" scripts for MacOS then remove the /tmp file so the StartupItems script re-launches barrierc (as root again)

OR, in the KeepAlive, look for a second barrier PID that isn't root's copy, if found, terminate, not found, restart.. this seems like a more practical/elegant solution.

<!-- gh-comment-id:874369241 --> @xrpdevs commented on GitHub (Jul 5, 2021): Thinking this could be used for running barrier pre-login, if we modify the "KeepAlive" part to the StartupItems script to check for the presence of a file in say /tmp then we can tell the script to kill barrier once we're running barrier as our logged-in user (so clipboard works) then, assuming there are "OnLogOut" scripts for MacOS then remove the /tmp file so the StartupItems script re-launches barrierc (as root again) OR, in the KeepAlive, look for a second barrier PID that isn't root's copy, if found, terminate, not found, restart.. this seems like a more practical/elegant solution.
Author
Owner

@xrpdevs commented on GitHub (Jul 5, 2021):

It is annoying having to do the USB swap on boot. Will try to write this up and chuck it on my github tomorrowe if I get time.

<!-- gh-comment-id:874369906 --> @xrpdevs commented on GitHub (Jul 5, 2021): It _is_ annoying having to do the USB swap on boot. Will try to write this up and chuck it on my github tomorrowe if I get time.
Author
Owner

@oppalla commented on GitHub (Jul 6, 2021):

Have you seen https://web.archive.org/web/20150511090759/http://synergy2.sourceforge.net/autostart.html ?

I'll be trying this right now! it's really annoying to have to use batteries on my keyboard and touchpad if I just use them to log in.

<!-- gh-comment-id:874439597 --> @oppalla commented on GitHub (Jul 6, 2021): > Have you seen https://web.archive.org/web/20150511090759/http://synergy2.sourceforge.net/autostart.html ? I'll be trying this right now! it's really annoying to have to use batteries on my keyboard and touchpad if I just use them to log in.
Author
Owner

@oppalla commented on GitHub (Jul 6, 2021):

Unfortunately, I followed the steps below and didn't make any difference on how Barrier starts. It just opens up after logging my user in.

1 - Opened a terminal window and become root:
$ sudo su -

2 - Created a folder like this:
# mkdir -p /Library/StartupItems/Barrier

3 - Created a file without extension in this folder with this text:

#!/bin/sh
. /etc/rc.common
 
run=(/usr/local/bin/barrierc -n $(hostname -s) -1 -f 192.168.2.2)
 
KeepAlive ()
{
    proc=${1##*/}
 
    while [ -x "$1" ]
    do
        if ! ps axco command | grep -q "^${proc}\$"
        then
           "$@"
        fi
 
        sleep 3
    done
}
 
StartService ()
{
    ConsoleMessage "Starting Barrier"
    KeepAlive "${run[@]}" &
}
 
StopService ()
{
    return 0
}
 
RestartService ()
{
    return 0
}
 
RunService "$1"

4 - Made the script executable with this command:
# chmod 755 /Library/StartupItems/Barrier/Barrier
5 - Created a file named StartupParameters.plist under the same folder containing:

{
    Description      = "Barrier Client";
    Provides         = ("Barrier");
    Requires         = ("Network");
    OrderPreference  = "None";
}

6 - Executed the startup script from the terminal without any errors or advice with this command:
# /Library/StartupItems/Barrier/Barrier start

7 - Turned off my iMac and my PC

8 - Turned on my iMac till it gets to log in screen, then turned on my PC

9 - Nothing happened at all, I must log through VNC or use the iMac native keyboard to log in.

Any idea on what I'm missing? Or this can't be used on High Sierra? Any help will be really appreciated!
Something I noted, is that if I open terminal and go to/usr/local/bin/and give an ls command, it don't show any barrierc folder.
Maybe is this? Any idea on where should I point this path on macOS for it to work?

<!-- gh-comment-id:874459059 --> @oppalla commented on GitHub (Jul 6, 2021): Unfortunately, I followed the steps below and didn't make any difference on how Barrier starts. It just opens up after logging my user in. **1 - Opened a terminal window and become root:** `$ sudo su -` **2 - Created a folder like this:** `# mkdir -p /Library/StartupItems/Barrier` **3 - Created a file without extension in this folder with this text:** ``` #!/bin/sh . /etc/rc.common run=(/usr/local/bin/barrierc -n $(hostname -s) -1 -f 192.168.2.2) KeepAlive () { proc=${1##*/} while [ -x "$1" ] do if ! ps axco command | grep -q "^${proc}\$" then "$@" fi sleep 3 done } StartService () { ConsoleMessage "Starting Barrier" KeepAlive "${run[@]}" & } StopService () { return 0 } RestartService () { return 0 } RunService "$1" ``` **4 - Made the script executable with this command:** `# chmod 755 /Library/StartupItems/Barrier/Barrier ` **5 - Created a file named StartupParameters.plist under the same folder containing:** ``` { Description = "Barrier Client"; Provides = ("Barrier"); Requires = ("Network"); OrderPreference = "None"; } ``` **6 - Executed the startup script from the terminal without any errors or advice with this command:** `# /Library/StartupItems/Barrier/Barrier start` **7 - Turned off my iMac and my PC** **8 - Turned on my iMac till it gets to log in screen, then turned on my PC** **9 - Nothing happened at all, I must log through VNC or use the iMac native keyboard to log in.** **Any idea on what I'm missing? Or this can't be used on High Sierra? Any help will be really appreciated!** **Something I noted, is that if I open terminal and go to` /usr/local/bin/ `and give an `ls `command, it don't show any barrierc folder.** **Maybe is this? Any idea on where should I point this path on macOS for it to work?**
Author
Owner

@xrpdevs commented on GitHub (Jul 6, 2021):

I'm running Big Sur. Had a late start today so have yet to take a look at it properly.

Would suggest checking your syslog to see if there is a "Starting Barrier" message recorded, and doing a "ps aux | grep barrierc" (as root) via ssh to see if it's running or not.

<!-- gh-comment-id:874712068 --> @xrpdevs commented on GitHub (Jul 6, 2021): I'm running Big Sur. Had a late start today so have yet to take a look at it properly. Would suggest checking your syslog to see if there is a "Starting Barrier" message recorded, and doing a "ps aux | grep barrierc" (as root) via ssh to see if it's running or not.
Author
Owner

@xrpdevs commented on GitHub (Jul 6, 2021):

Oh and you want to replace /usr/local/bin/ with /Applications/Barrier.app/Contents/MacOS/ (or wherever your barrierc binary is stored)

<!-- gh-comment-id:874712951 --> @xrpdevs commented on GitHub (Jul 6, 2021): Oh and you want to replace /usr/local/bin/ with /Applications/Barrier.app/Contents/MacOS/ (or wherever your barrierc binary is stored)
Author
Owner

@oppalla commented on GitHub (Jul 6, 2021):

@xrpdevs thanks for troubleshooting this with me, I really appreciate your efforts.

I have before going to sleep set the /usr/local/bin/ with /Applications/Barrier.app/Contents/MacOS/Barrierc, but unfortunately it's not working yet.

I'm taking a look at the macOS Console right now, but I'm not sure about what should I search for.

I've put Barrier on the search box, surfed between the folders on the left, there are a few logs, anything much explanatory.

can you keep with me on this? I'm using barrier for a year more or less, and since then, I'm using a second keyboard just to log in to my mac, every day by the morning. it will improve a lot the usability, and maybe help users in further times. thanks!

<!-- gh-comment-id:874843402 --> @oppalla commented on GitHub (Jul 6, 2021): @xrpdevs thanks for troubleshooting this with me, I really appreciate your efforts. I have before going to sleep set the /usr/local/bin/ with /Applications/Barrier.app/Contents/MacOS/Barrierc, but unfortunately it's not working yet. I'm taking a look at the macOS Console right now, but I'm not sure about what should I search for. I've put Barrier on the search box, surfed between the folders on the left, there are a few logs, anything much explanatory. can you keep with me on this? I'm using barrier for a year more or less, and since then, I'm using a second keyboard just to log in to my mac, every day by the morning. it will improve a lot the usability, and maybe help users in further times. thanks!
Author
Owner

@xrpdevs commented on GitHub (Jul 6, 2021):

Yeah I'll have a go at getting it working later, I'm not really a Mac person per se, but extensive experience with *nix systems in general so hopefully be able to get to the bottom of this.

<!-- gh-comment-id:874868113 --> @xrpdevs commented on GitHub (Jul 6, 2021): Yeah I'll have a go at getting it working later, I'm not really a Mac person per se, but extensive experience with *nix systems in general so hopefully be able to get to the bottom of this.
Author
Owner

@xrpdevs commented on GitHub (Jul 6, 2021):

So got the switching between root and user version of barrierc working, only problem is, that (at least on Big Sur) A) /Library/StartupItems is deprecated, and B) To run GUI apps pre-login requires privelege (see https://apple.stackexchange.com/questions/372933/execute-a-script-with-gui-access-before-login )

Appears the way to start barrierc pre-login is to use launchd, going to look into how to do that in combination with B)

Gist of what I've done so far: https://gist.github.com/xrpdevs/b53c9962dd72ffce2cdd6bd9d4d87f28

<!-- gh-comment-id:874994852 --> @xrpdevs commented on GitHub (Jul 6, 2021): So got the switching between root and user version of barrierc working, only problem is, that (at least on Big Sur) A) /Library/StartupItems is deprecated, and B) To run GUI apps pre-login requires privelege (see https://apple.stackexchange.com/questions/372933/execute-a-script-with-gui-access-before-login ) Appears the way to start barrierc pre-login is to use launchd, going to look into how to do that in combination with B) Gist of what I've done so far: https://gist.github.com/xrpdevs/b53c9962dd72ffce2cdd6bd9d4d87f28
Author
Owner

@xrpdevs commented on GitHub (Jul 6, 2021):

The install instructions may or may not work for you as you are not using Big Sur. I have another VM running catalina but I expect it will behave much the same as BS. Got other stuff to do now but probably take another look tomorrow. I guess if I manage to get this working can always submit it as a PR.

<!-- gh-comment-id:874997449 --> @xrpdevs commented on GitHub (Jul 6, 2021): The install instructions may or may not work for you as you are not using Big Sur. I have another VM running catalina but I expect it will behave much the same as BS. Got other stuff to do now but probably take another look tomorrow. I guess if I manage to get this working can always submit it as a PR.
Author
Owner

@oppalla commented on GitHub (Jul 6, 2021):

So got the switching between root and user version of barrierc working, only problem is, that (at least on Big Sur) A) /Library/StartupItems is deprecated, and B) To run GUI apps pre-login requires privelege (see https://apple.stackexchange.com/questions/372933/execute-a-script-with-gui-access-before-login )

Appears the way to start barrierc pre-login is to use launchd, going to look into how to do that in combination with B)

Gist of what I've done so far: https://gist.github.com/xrpdevs/b53c9962dd72ffce2cdd6bd9d4d87f28

I'm trying your instructions right now. Just have two questions:

1 - Is it necessary to CHMOD 755 the Barrier file?

2 - Am I supposed to create a launchd script? which will create the file /tmp/barrierc_user_running when logging in? how do I do it?

<!-- gh-comment-id:875124642 --> @oppalla commented on GitHub (Jul 6, 2021): > So got the switching between root and user version of barrierc working, only problem is, that (at least on Big Sur) A) /Library/StartupItems is deprecated, and B) To run GUI apps pre-login requires privelege (see https://apple.stackexchange.com/questions/372933/execute-a-script-with-gui-access-before-login ) > > Appears the way to start barrierc pre-login is to use launchd, going to look into how to do that in combination with B) > > Gist of what I've done so far: https://gist.github.com/xrpdevs/b53c9962dd72ffce2cdd6bd9d4d87f28 I'm trying your instructions right now. Just have two questions: 1 - Is it necessary to CHMOD 755 the Barrier file? 2 - Am I supposed to create a launchd script? which will create the file /tmp/barrierc_user_running when logging in? how do I do it?
Author
Owner

@oppalla commented on GitHub (Jul 18, 2021):

Create a launchd script which creates the file /tmp/barrierc_user_running when you log in.

mate @xrpdevs, how do I create this launchd script?

<!-- gh-comment-id:882007190 --> @oppalla commented on GitHub (Jul 18, 2021): > Create a launchd script which creates the file /tmp/barrierc_user_running when you log in. mate @xrpdevs, how do I create this launchd script?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#148
No description provided.