[GH-ISSUE #29] Barriers works stand-alone, but when ran as systemd user unit, fails to start. #19

Closed
opened 2026-05-05 04:44:33 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @AdrianKoshka on GitHub (Apr 21, 2018).
Original GitHub issue: https://github.com/debauchee/barrier/issues/29

Operating Systems

Server: Linux

Client: Linux

Server linux version: Fedora 27

Client linux version: Debian stretch

Barrier Version

barriers 2.0.0-RELEASE, protocol version 1.6

Steps to reproduce bug

  1. plop systemd user unit in ~/.config/systemd/user/barriers@.service
[Unit]
Description=Barrier keyboard & mouse sharing software
After=network.target

[Service]
PassEnvironment=DISPLAY
ExecStart=%h/.local/bin/barriers --address %i --no-restart --no-daemon --config %h/.config/Synergy/desktops.conf
Type=simple
ProtectHome=read-only
ProtectSystem=true
ReadWritePaths=%h/.config/Synergy
Restart=always
RestartSec=10

[Install]
WantedBy=alc.target # not really important or needed for debugging

1.5. supply your own config
2. run systemctl --user daemon-reload
3. run systemctl --user start barriers@::1.service
4. it will fail with (code=exited, status=4) when checking systemctl --user status barriers@::1.serivce

Other info

If I run barriers stand-alone, outside of a systemd user unit, it just works. Also unrelated to this issue, but barrierc happily runs as a systemd user unit.

Originally created by @AdrianKoshka on GitHub (Apr 21, 2018). Original GitHub issue: https://github.com/debauchee/barrier/issues/29 ### Operating Systems ### Server: Linux Client: Linux Server linux version: Fedora 27 Client linux version: Debian stretch ### Barrier Version ### barriers 2.0.0-RELEASE, protocol version 1.6 ### Steps to reproduce bug ### 1. plop systemd user unit in `~/.config/systemd/user/barriers@.service` ```ini [Unit] Description=Barrier keyboard & mouse sharing software After=network.target [Service] PassEnvironment=DISPLAY ExecStart=%h/.local/bin/barriers --address %i --no-restart --no-daemon --config %h/.config/Synergy/desktops.conf Type=simple ProtectHome=read-only ProtectSystem=true ReadWritePaths=%h/.config/Synergy Restart=always RestartSec=10 [Install] WantedBy=alc.target # not really important or needed for debugging ``` 1.5. supply your own config 2. run `systemctl --user daemon-reload` 3. run `systemctl --user start barriers@::1.service` 4. it will fail with `(code=exited, status=4)` when checking `systemctl --user status barriers@::1.serivce` ### Other info ### If I run `barriers` stand-alone, outside of a systemd user unit, it just works. Also unrelated to this issue, but `barrierc` happily runs as a systemd user unit.
Author
Owner

@AdrianKoshka commented on GitHub (Apr 21, 2018):

False alarm... desktops.conf is supopsed to be desktops.config from my old synergy config, solved this myself.

<!-- gh-comment-id:383268871 --> @AdrianKoshka commented on GitHub (Apr 21, 2018): False alarm... `desktops.conf` is supopsed to be `desktops.config` from my old synergy config, solved this myself.
Author
Owner

@ghost commented on GitHub (Jun 7, 2018):

@AdrianKoshka Thanks for that service file! Can you tell me what that alc.target is? I can't find anything about. Also what is the reason to use --no-restart and --no-daemon flag?

<!-- gh-comment-id:395532630 --> @ghost commented on GitHub (Jun 7, 2018): @AdrianKoshka Thanks for that service file! Can you tell me what that `alc.target` is? I can't find anything about. Also what is the reason to use `--no-restart` and `--no-daemon` flag?
Author
Owner

@AdrianKoshka commented on GitHub (Jun 7, 2018):

Oh, alc.target is a custom systemd target I wrote. the --no-restart flag means barrier won't try to restart itself, and the --no-daemon flag means it won't fork itself into the background.

<!-- gh-comment-id:395557791 --> @AdrianKoshka commented on GitHub (Jun 7, 2018): Oh, `alc.target` is a custom systemd target I wrote. the `--no-restart` flag means barrier won't try to restart itself, and the `--no-daemon` flag means it won't fork itself into the background.
Author
Owner

@AdrianKoshka commented on GitHub (Jun 7, 2018):

@glumanda99 if you're interested, all my unit files are in this repo: https://github.com/adriankoshka/config

<!-- gh-comment-id:395557917 --> @AdrianKoshka commented on GitHub (Jun 7, 2018): @glumanda99 if you're interested, all my unit files are in this repo: https://github.com/adriankoshka/config
Author
Owner

@AdrianKoshka commented on GitHub (Jun 7, 2018):

Here's the documentation for how I have barrier seutp: https://github.com/AdrianKoshka/config/wiki/My-barrier-setup

<!-- gh-comment-id:395558049 --> @AdrianKoshka commented on GitHub (Jun 7, 2018): Here's the documentation for how I have barrier seutp: https://github.com/AdrianKoshka/config/wiki/My-barrier-setup
Author
Owner

@ghost commented on GitHub (Jun 7, 2018):

@AdrianKoshka Thanks for your fast response and detailed descriptions! It works great and was one of the reasons I switched to barrier as the 1.8 branch of synergy won't fix running it from systemd service.

<!-- gh-comment-id:395575015 --> @ghost commented on GitHub (Jun 7, 2018): @AdrianKoshka Thanks for your fast response and detailed descriptions! It works great and was one of the reasons I switched to barrier as the 1.8 branch of synergy won't fix running it from systemd service.
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#19
No description provided.