Setting up barrier to run on startup
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.
Solution 2
I was able to do this more simply I think on a Raspberry Pi 4 running Ubuntu 20.04 with barrier version 2.3.3:
- Edit
~/.config/Debauchee/Barrier.conf
- Set the
autoHide
value:autoHide=true
Then you can just add /usr/bin/barrier
(not barrierc) without any arguments into Startup Application preferences.
Related videos on Youtube
Karlovsky120
Updated on September 18, 2022Comments
-
Karlovsky120 over 1 year
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
andbarriers
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
flagbarrierc -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 likesystemd
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?
-
s1mmel over 4 yearsCould be that the program does not like self-signed certificates. Maybe you try to create a certificate with let's encrypt?
-
Karlovsky120 over 4 yearsThe program works fine if I run it directly from the terminal, in foreground, but throws a fit if I run it in the background or if I try to run it as a service. Since it does work, I doubt that certificates are the problem.
-
s1mmel over 4 yearsTry to start it with nohup and take a look into the logs.
-
Karlovsky120 over 4 yearsI got no useful info from it.
-
ttfreeman about 4 years@Karlovsky120 have you solved this problem with barrier?
-
Karlovsky120 about 4 yearsNo, I haven't...
-
Jason Kelley almost 4 yearsI'm having the exact same problem. Anyone solve this yet?
-
EchoMike444 almost 4 years@JasonKelley can you test my Answer
-
-
Jason Kelley almost 4 yearsWhat data would you put in /dev/zero? Barrier doesn't need any input from STDIN.
-
EchoMike444 almost 4 years/dev/zero is a char device , you can read read and it contains only a infinite value of zero . the device is already here .
ls -la /dev/zero
-
EchoMike444 almost 4 years@JasonKelley , i did not dig into the code but barrier ( or ldependencies ) read and one moment STDIN . But i found it by running strace
-
EchoMike444 almost 4 yearsyou can prove by running manually , that barrier will fail if you run
/usr/bin/barrierc -f --enable-crypto 192.168.12.96 </dev/null