Open hashn0n opened 7 years ago
Maybe there could be a problem if you are using a systemwide unit file and not a --user file?
Do the service unit work without screen?
@hashn0n can you try exporting a DISPLAY
variable by adding this under the [Service]
section in your systemd unit config:
Environment=DISPLAY=:0
(Run echo $DISPLAY
to see if you need to use something other than :0
.)
Commands used:
systemctl --user daemon-reload ; systemctl --user restart an2linux_screen
exporting a DISPLAY:
systemctl --user cat an2linux_screen
Result:
# /home/hash/.config/systemd/user/an2linux_screen.service
[Unit]
Description=AN2Linux server screen
[Service]
Type=forking
Restart=on-failure
Environment=DISPLAY=:0
ExecStart=/usr/bin/screen -dmS an2linux '/opt/bin/an2linuxserver.py'
ExecStop=/usr/bin/screen -X -S an2linux quit
[Install]
WantedBy=default.target
Same error as before and no notifications displayed.
Just a piece of maybe interesting info:
LANG=C systemctl --user status an2linux_screen
LANG=C Because system lang is ru_RU.utf8.
Result:
* an2linux_screen.service - AN2Linux server screen
Loaded: loaded (/home/<USERNAME>/.config/systemd/user/an2linux_screen.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2017-02-27 17:39:57 MSK; 8min ago
Process: 3805 ExecStart=/usr/bin/screen -dmS an2linux /opt/bin/an2linuxserver.py (code=exited, status=0/SUCCESS)
Main PID: 3806 (screen)
CGroup: /user.slice/user-1000.slice/user@1000.service/an2linux_screen.service
|-3806 /usr/bin/SCREEN -dmS an2linux /opt/bin/an2linuxserver.py
`-3807 /usr/lib/python-exec/python3.4/python3 /opt/bin/an2linuxserver.py
Feb 27 17:39:57 <HOSTNAME> systemd[1100]: Starting AN2Linux server screen...
Feb 27 17:39:57 <HOSTNAME> systemd[1100]: Started AN2Linux server screen.
Hey there. I have the same issue. I use i3 with dunst started on the i3 startup. Hit me up please if you have a solution. Thank you.
Just got the same error when starting an2linuxserver.py from inside tmux. No issues when running it outside of tmux though.
I found that, if I ran the server as a user service, it worked only if I add this to the service file:
Environment="DISPLAY=:0" "XAUTHORITY=/home/<my main user>/.Xauthority"
Running the server as a normal program worked. I imagine that running the server as a system service would not work, unless - yes? - one used the above fix.
Strange. Mine is running fine with the below user service file:
[Unit]
Description=AN2Linux
[Service]
Type=simple
StandardOutput=null
Restart=on-failure
ExecStart=/usr/bin/an2linuxserver.py
[Install]
WantedBy=default.target
Hmm. My ExecStart path is to a folder within my home directory. Also, perhaps distro & DE make a difference? I'm on Mint Cinnamon.
I don't think it makes a difference but I'm on Arch running swaywm (Wayland).
What are the file permissions to your ExecStart?
stat -c '%a' /usr/bin/an2linuxserver.py
755
ls -al /usr/bin/an2linuxserver.py
-rwxr-xr-x 1 root root 41077 Dec 24 16:30 /usr/bin/an2linuxserver.py
So here is the problem using proposed in README.md service unit And no notification is displayed, I do not use tmux, so a wrote service unit that used screen:
After that I was able to connect to screen session and what I tried to send test notification that is what I got:
Obviously if same thing executed in any X-term, all works fine. I can see same error in unit without screen usage without StandardOutput=null