Setting up barrier to run on startup
Barrier is a free popular KVM software that enables mouse/keyboard sharing across several devices.
I've been fiddling with it for a few hours and I can't seem to get it right.
I have a barrier server running on my Windows machine.
I've downloaded the git repository and built the binaries. I've copied barrier
, barrierc
and barriers
into /usr/bin
.
If I run barrier GUI, specify the server IP and enable the server, it works. I can do it with and without SSL (as long as both the client and the server have the same setting set). I would prefer to use SSL though.
I've then tried running barrierc --enable-crypto <ip>
. The server acknowledges the connection, but says it's not secure and it doesn't work. However, if I run the same command with the -f
flag barrierc -f --enable-crypto <ip>
which makes it run in the foreground, it all works dandy.
Since I'm on Ubuntu 18.04, I've setup a systemd service like so:
[Unit]
Description=Barrier mouse/keyboard share
Requires=display-manager.service
After=display-manager.service
StartLimitIntervalSec=0
[Service]
Type=simple
ExecStart=/usr/bin/barrierc -f --enable-crypto 192.168.12.96
Restart=always
RestartSec=1
User=karlovsky120
[Install]
WantedBy=multi-user.target
I've named it barrier.service
and copied it into /etc/systemd/system/
.
I've tried starting it manually, but it refuses to work. From what I can tell from systemctl
status, it looks like systemd
runs the client, but the client exits immediately and then it restarts it. I've tried with and without the -f
flag, but the result is the same.
The server also complains that the client connection might not be secure, which is the same error you get when you try to connect with a non SSL client to an SSL server. It does so with and without the -f
flag.
I know I have to enable the service to have it run on startup, but how do I get it to work at all?
Solution 1:
I got it working for me on Ubuntu 20.04, but the steps probably will not be different on 18.04
You might want to undo your barrier.service first then do the following
- Get a working setup using keyboard and mouse at your client Ubuntu, note down [name of your client/screen]
- Open terminal and get the full cli commands equivalent of current working setup without using configure file i.e. run "ps aux | grep barrier"
user@hp-eo800-g1-aio-u:~$ ps aux | grep barrier
user 1278 0.0 0.1 98896 10256 ? Sl Nov16 0:29 /usr/bin/barrierc -f --no-tray --debug INFO --name [name of your client/screen] --enable-crypto --log /var/log/barrier.log [SERVER IP ADDRESS]:24800
user 14737 0.0 0.0 9036 668 pts/0 S+ 09:41 0:00 grep --color=auto barrier
user@hp-eo800-g1-aio-u:~$
- Notice the last part of ps output, that'd the full command with all parameters you need run your Ubuntu as a client, copy it
/usr/bin/barrierc -f --no-tray --debug INFO --name [name of your client/screen] --enable-crypto --log /var/log/barrier.log [SERVER IP ADDRESS]:24800
- Create a new entry in the Startup Applications Preferences New entry in Startup Applications Preferences and paste the command to Command section as seen in attached screen cap
- Reboot now to test that it will auto kick off as your Desktop manager is brought up.