Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically start Barrier on boot in Raspbian Buster #508

Open
ElnuDev opened this issue Nov 22, 2019 · 25 comments
Open

Automatically start Barrier on boot in Raspbian Buster #508

ElnuDev opened this issue Nov 22, 2019 · 25 comments
Labels
enhancement New feature or request linux Related to Linux windows Related to Microsoft Windows

Comments

@ElnuDev
Copy link

ElnuDev commented Nov 22, 2019

Operating Systems

Server: Windows 10

Client: Raspbian Buster

Barrier Version

Server: 2.3.2-snapshot-210c2b70

Client: 2.3.2-snapshot-36ed253e

Problem

I would like to make Barrier automatically start on boot on my Raspberry Pi 4 running Raspbian Buster. Currently, I have to connect a second mouse/keyboard pair to my Raspberry Pi in order to start up Barrier, which kind of defeats the purpose. 🙃 Is this possible? I tried adding barrier & to etc/rc.local and rebooting the Pi, but that didn't work.

@shymega shymega added linux Related to Linux windows Related to Microsoft Windows labels Nov 29, 2019
@shymega
Copy link

shymega commented Nov 29, 2019

I don't believe that Debian Buster uses sysvinit, and since Debian Jessie, it now uses systemd.

#36 would have fulfilled this requirement, and I will make a PR soon to provide these units for a systemd user service, and possibly a systemd system service, but I'm not really convinced we need a systemd system service.

Could you confirm that Raspbian Buster uses systemd or sysvinit? You can check for systemd by running systemctl, and seeing if returns an error.

Thanks for the report!

@candeira
Copy link

@shymega, wouldn't a systemd system service allow users to use barrier for accessing client computers' display manager/login?

@shymega
Copy link

shymega commented Dec 29, 2019

@candeira Not sure. It could potentially work, but it wouldn't be per-user, and only for the root user, I'd imagine - so you'd need two Barrier configs.. on the same system. At least, that's how I understand it. I'd personally stick with a user service, but I can see the appeal of Barrier being available on the DM.

@mirh
Copy link

mirh commented Jan 7, 2020

My personal situation is a PC where I don't have physical keyboards attached, and in come cases I find myself having to switch to TTY.
If the thing is running as a normal user.. Of course I cannot login into the console to begin with.

@dayne
Copy link

dayne commented Jan 17, 2020

My solution for this is a set of scripts used on my Raspberry Pi 4 and couple another Linux boxes that I revision control in a gist over here:

https://gist.github.com/dayne/e3a7f31f0624bf299faf9fadfe510322

I see I have a note about fixing up my bash script stuff to make it work correctly in a mac... I'll loop back to that in the future but what I've linked above works for me on my RPi.

@detly
Copy link

detly commented Feb 3, 2020

Before I go off and try to configure this from scratch, what is the expected way to initiate a Barrier connection with a headless client?

@rebroad
Copy link

rebroad commented May 12, 2020

Adding:-

barrier &

to the end of /home/pi/.profile was enough to get it running automatically upon boot up into desktop mode for me

@detly
Copy link

detly commented May 12, 2020

@rebroad In this context, "at boot" means before logging in.

@detly
Copy link

detly commented May 27, 2020

@lornix This will start Barrier on login, not on boot. This issue is about starting Barrier before any user is logged in, so that on multi-user systems someone can enter credentials at the login screen.

@simons-public
Copy link

@detly I put in a PR #694 that has systemd services if you want to give that a try.

@detly
Copy link

detly commented May 28, 2020

@simons-public Amazing! I left a review comment, I hope you don't mind me jumping in.

@Zazaaaa
Copy link

Zazaaaa commented Jun 10, 2020

Adding:-

barrier &

to the end of /home/pi/.profile was enough to get it running automatically upon boot up into desktop mode for me

I am sorry, but could someone please explain to me how I am supposed to do this? I am completely starting from scratch with my Raspberry Pi and I want to connect my keyboard and mouse first. I don't have any other users but the main one so I don't need to log on. I just need to run Barrier on startup so I don't have to plug in my keyboard first. Can somebody please help me? Thanks in forward.

@lachlanshanks
Copy link

lachlanshanks commented Jun 12, 2020

Adding:-
barrier &
to the end of /home/pi/.profile was enough to get it running automatically upon boot up into desktop mode for me

I am sorry, but could someone please explain to me how I am supposed to do this? I am completely starting from scratch with my Raspberry Pi and I want to connect my keyboard and mouse first. I don't have any other users but the main one so I don't need to log on. I just need to run Barrier on startup so I don't have to plug in my keyboard first. Can somebody please help me? Thanks in forward.

If you visit the /home/pi folder in the file explorer and in the drop down menu beside the address bar select to show hidden files, you'll see the ".profile" file. You just need to add "barrier &" to the end of that.

EDIT: This is working for me now.

@julio8a
Copy link

julio8a commented Jun 25, 2020

Thank you! adding barrier & to the end of the /home/pi/.profile file worked for me.

@Sk8wine
Copy link

Sk8wine commented Jun 25, 2020

Adding:-

barrier &

to the end of /home/pi/.profile was enough to get it running automatically upon boot up into desktop mode for me

Thank you! Was forever changing dongle to boot Barrier - worked perfectly

@LRC32901
Copy link

I've added "barrier & to the end of my " .profile" file
When screen boots I get a screen looking for Server IP: .
Is there a way to pass it the ip or did I miss something on setuo.
Thanks

@skorokithakis
Copy link

@LRC32901 You may be able to change the line to barrierc <server ip> & but I haven't tested that.

@ed-puckett
Copy link

This is working for me:

  1. create a script (below) to start barrierc and connect to the local barrier server.
  2. call that script from the end of ~/.profile

The script (change barrier_host to the correct ip address for your barrier server, i.e., the one with the keyboard and mouse):

#!/bin/bash
export barrier_host=192.168.1.1 # CHANGE ME
export barrier_port=24800
export barrier_logfile="${HOME}/barrier.log"
if ! pgrep -af /usr/bin/barrierc; then
nohup /usr/bin/barrierc --no-tray --debug INFO --name raspberrypi --enable-crypto "[${barrier_host}]:${barrier_port}" <&- > "${barrier_logfile}" 2>&1 &
fi

@DanielGlaas
Copy link

Hi guys, here is my solution to have the client automatically running on my raspberry pi:

edit file
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
and add this line
@barrierc -f --name raspberrypi --enable-crypto 192.168.0.2

The standard user "pi" is automatically loged in, this means that on the monitor already the desktop is visible. As soon as I start barrier server on my Laptop with Ubuntu 20.04, the connection establishes within seconds.

Maybe this helps someone!

@Kingo71
Copy link

Kingo71 commented Jan 22, 2021

Hi guys, here is my solution to have the client automatically running on my raspberry pi:

edit file
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
and add this line
@barrierc -f --name raspberrypi --enable-crypto 192.168.0.2

The standard user "pi" is automatically loged in, this means that on the monitor already the desktop is visible. As soon as I start barrier server on my Laptop with Ubuntu 20.04, the connection establishes within seconds.

Maybe this helps someone!

This worked like a charm for me, thanks!

@1oh1
Copy link

1oh1 commented Mar 29, 2021

Hi guys, here is my solution to have the client automatically running on my raspberry pi:

edit file
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
and add this line
@barrierc -f --name raspberrypi --enable-crypto 192.168.0.2

The standard user "pi" is automatically loged in, this means that on the monitor already the desktop is visible. As soon as I start barrier server on my Laptop with Ubuntu 20.04, the connection establishes within seconds.

Maybe this helps someone!

If you use Dynamic DNS providers like No-IP, DuckDNS or similar, you can replace the IP address in the command with the your DDNS hostname (eg. my-awesome-pc.duckdns.org) as long as the hostname points to your computer's local IP and not public IP.

@ericlowry
Copy link

Hi guys, here is my solution to have the client automatically running on my raspberry pi:

edit file
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
and add this line
@barrierc -f --name raspberrypi --enable-crypto 192.168.0.2

The standard user "pi" is automatically loged in, this means that on the monitor already the desktop is visible. As soon as I start barrier server on my Laptop with Ubuntu 20.04, the connection establishes within seconds.

Maybe this helps someone!

@DanielGlaas, I cam looking for exactly this - worked like a charm! Thanks for saving hours of digging.

@Lazuli360
Copy link

This is working for me:

  1. create a script (below) to start barrierc and connect to the local barrier server.
  2. call that script from the end of ~/.profile

The script (change barrier_host to the correct ip address for your barrier server, i.e., the one with the keyboard and mouse):

#!/bin/bash export barrier_host=192.168.1.1 # CHANGE ME export barrier_port=24800 export barrier_logfile="${HOME}/barrier.log" if ! pgrep -af /usr/bin/barrierc; then nohup /usr/bin/barrierc --no-tray --debug INFO --name raspberrypi --enable-crypto "[${barrier_host}]:${barrier_port}" <&- > "${barrier_logfile}" 2>&1 & fi

Thank you! Spent at least 2-3 hours just going through GitHub and google search results trying to find a way to automate it and tried like 5-6 different solutions, and this is the only one that worked. Once again, thanks!

@KryptoOwl
Copy link

now everyone is posting solutions here is mine because yaall`s didn't work for me lmao

I installed Putty.org and made 2 scripts one for the pi and 1 for windows to ssh and run the script onto the pi

" plink -ssh [email protected] -pw Password -m C:\barrier.sh " < Turn this into a .bat file in windows

and put the barrier.sh in your C:\

Barrier.sh script: " barrierc --name raspberrypi --no-restart --no-daemon 192.168.X.X "

now you got yourself a button on your windows machine to ssh into your pi and launch barrier on your pi

use the IP address of your keyboard and mouse host

@p6002
Copy link

p6002 commented Feb 26, 2023

Adding:-

barrier &

to the end of /home/pi/.profile was enough to get it running automatically upon boot up into desktop mode for me

Thanks, works for me, Raspberry 3B. Shows some errors after loging via SSH, but barrier works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linux Related to Linux windows Related to Microsoft Windows
Projects
None yet
Development

No branches or pull requests