[GH-ISSUE #508] Automatically start Barrier on boot in Raspbian Buster #395

Open
opened 2026-05-05 06:16:32 -06:00 by gitea-mirror · 25 comments
Owner

Originally created by @ElnuDev on GitHub (Nov 22, 2019).
Original GitHub issue: https://github.com/debauchee/barrier/issues/508

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.

Originally created by @ElnuDev on GitHub (Nov 22, 2019). Original GitHub issue: https://github.com/debauchee/barrier/issues/508 ### 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.
gitea-mirror added the
enhancement
windows
linux
labels 2026-05-05 06:16:32 -06:00
Author
Owner

@shymega commented on GitHub (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!

<!-- gh-comment-id:559857405 --> @shymega commented on GitHub (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!
Author
Owner

@candeira commented on GitHub (Dec 29, 2019):

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

<!-- gh-comment-id:569484097 --> @candeira commented on GitHub (Dec 29, 2019): @Shymega, wouldn't a systemd system service allow users to use barrier for accessing client computers' display manager/login?
Author
Owner

@shymega commented on GitHub (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.

<!-- gh-comment-id:569507287 --> @shymega commented on GitHub (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.
Author
Owner

@mirh commented on GitHub (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.

<!-- gh-comment-id:571619484 --> @mirh commented on GitHub (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.
Author
Owner

@dayne commented on GitHub (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.

<!-- gh-comment-id:575757946 --> @dayne commented on GitHub (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.
Author
Owner

@detly commented on GitHub (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?

<!-- gh-comment-id:581329722 --> @detly commented on GitHub (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?
Author
Owner

@rebroad commented on GitHub (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

<!-- gh-comment-id:627157748 --> @rebroad commented on GitHub (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
Author
Owner

@detly commented on GitHub (May 12, 2020):

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

<!-- gh-comment-id:627160141 --> @detly commented on GitHub (May 12, 2020): @rebroad In this context, "at boot" means before logging in.
Author
Owner

@detly commented on GitHub (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.

<!-- gh-comment-id:634494559 --> @detly commented on GitHub (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.
Author
Owner

@simons-public commented on GitHub (May 28, 2020):

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

<!-- gh-comment-id:635040875 --> @simons-public commented on GitHub (May 28, 2020): @detly I put in a PR #694 that has systemd services if you want to give that a try.
Author
Owner

@detly commented on GitHub (May 28, 2020):

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

<!-- gh-comment-id:635330863 --> @detly commented on GitHub (May 28, 2020): @simons-public Amazing! I left a review comment, I hope you don't mind me jumping in.
Author
Owner

@Zazaaaa commented on GitHub (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.

<!-- gh-comment-id:641847037 --> @Zazaaaa commented on GitHub (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.
Author
Owner

@lachlanshanks commented on GitHub (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.

<!-- gh-comment-id:643198551 --> @lachlanshanks commented on GitHub (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.
Author
Owner

@julio8a commented on GitHub (Jun 25, 2020):

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

<!-- gh-comment-id:649783407 --> @julio8a commented on GitHub (Jun 25, 2020): Thank you! adding `barrier &` to the end of the `/home/pi/.profile` file worked for me.
Author
Owner

@Sk8wine commented on GitHub (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

<!-- gh-comment-id:649837626 --> @Sk8wine commented on GitHub (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
Author
Owner

@LRC32901 commented on GitHub (Jun 28, 2020):

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

<!-- gh-comment-id:650776246 --> @LRC32901 commented on GitHub (Jun 28, 2020): 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
Author
Owner

@skorokithakis commented on GitHub (Jul 19, 2020):

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

<!-- gh-comment-id:660721048 --> @skorokithakis commented on GitHub (Jul 19, 2020): @LRC32901 You may be able to change the line to `barrierc <server ip> &` but I haven't tested that.
Author
Owner

@ed-puckett commented on GitHub (Oct 8, 2020):

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

<!-- gh-comment-id:705785717 --> @ed-puckett commented on GitHub (Oct 8, 2020): 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
Author
Owner

@DanielGlaas commented on GitHub (Dec 11, 2020):

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!

<!-- gh-comment-id:742879959 --> @DanielGlaas commented on GitHub (Dec 11, 2020): 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!
Author
Owner

@Kingo71 commented on GitHub (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!

<!-- gh-comment-id:765674697 --> @Kingo71 commented on GitHub (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!
Author
Owner

@1oh1 commented on GitHub (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.

<!-- gh-comment-id:809063914 --> @1oh1 commented on GitHub (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.
Author
Owner

@ericlowry commented on GitHub (May 23, 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!

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

<!-- gh-comment-id:846575836 --> @ericlowry commented on GitHub (May 23, 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! @DanielGlaas, I cam looking for exactly this - worked like a charm! Thanks for saving hours of digging.
Author
Owner

@Lazuli360 commented on GitHub (Jan 10, 2022):

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!

<!-- gh-comment-id:1008966678 --> @Lazuli360 commented on GitHub (Jan 10, 2022): > 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!
Author
Owner

@KryptoOwl commented on GitHub (Oct 3, 2022):

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 Rpi@192.168.X.X -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

<!-- gh-comment-id:1264859262 --> @KryptoOwl commented on GitHub (Oct 3, 2022): 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 [Rpi@192.168.X.X](mailto:Rpi@192.168.X.X) -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
Author
Owner

@p6002 commented on GitHub (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.

<!-- gh-comment-id:1445354908 --> @p6002 commented on GitHub (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 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#395
No description provided.