waycrate / swhkd

Sxhkd clone for Wayland (works on TTY and X11 too)
https://git.sr.ht/~shinyzenith/swhkd
BSD 2-Clause "Simplified" License
679 stars 47 forks source link

systemd service not starting on startup altough is enabled #202

Open RusticCraftsman opened 1 year ago

RusticCraftsman commented 1 year ago

Version Information:

Describe the bug: Swhkd service does not start correctly on startup altough i have the service enabled, so every time i log in i have to manually restart it

Expected behavior: the service starting correctly on startup

Actual behavior: the service not starting correctly on startup

To Reproduce: install the git version via aur and follow the systemd guide in this repo but specifying some devices

Additional information: Anything else you'd like us to know ? yes, here is the output of systemctl --user status hotkeys.service or by using journalctl, is the same

Apr 25 11:03:32 arch systemd[994]: Started swhkd hotkey daemon.
Apr 25 11:03:32 arch pkexec[1017]: arcus: Error executing command as another user: Not authorized [USER=root] [TTY=unknown] [CWD=/home/arcus] [COMMAND=/usr/bin/swhkd --device Video Bus --device AT Translated Set 2 keyboard]
Apr 25 11:03:32 arch hotkeys.sh[1017]: Error executing command as another user: Not authorized
Apr 25 11:03:32 arch hotkeys.sh[1017]: This incident has been reported.
RusticCraftsman commented 1 year ago

this is the output after running systemctl --user restart hotkeys.service

Apr 25 11:26:05 arch systemd[994]: Started swhkd hotkey daemon.
Apr 25 11:26:05 arch hotkeys.sh[14097]: swhks: no process found
Apr 25 11:26:05 arch pkexec[14099]: pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)

I will upgrade to last version and write if it fixed itself or if something is different in the latest git version

RusticCraftsman commented 1 year ago

Ok, no changes after upgrade, i also see what happened if i restarted 2 times in a row without intevention, but same error as first message, if you guys need more info about the service, here is the service itself located at /etc/systemd/user/hotkeys.service

[Unit]
Description=swhkd hotkey daemon
BindsTo=default.target

[Service]
Type=simple
ExecStart=/home/arcus/scripts/system/hotkeys.sh

[Install]
WantedBy=default.target

And here is the script itself

#!/usr/bin/env bash

killall swhks

swhks & pkexec swhkd --device 'Video Bus' --device 'AT Translated Set 2 keyboard'
RusticCraftsman commented 1 year ago

i realized im also not being able to start the system again, here are the journalctl logs

Apr 25 13:45:22 arch pkexec[16177]: pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Main process exited, code=exited, status=1/FAILURE
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/hotkeys.service, ignoring: Operation not permitted
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Killing process 15134 (swhkd) with signal SIGKILL.
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/hotkeys.service, ignoring: Operation not permitted
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/hotkeys.service, ignoring: Operation not permitted
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Killing process 15134 (swhkd) with signal SIGKILL.
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/hotkeys.service, ignoring: Operation not permitted
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Failed with result 'exit-code'.
Apr 25 13:45:22 arch systemd[985]: hotkeys.service: Unit process 15134 (swhkd) remains running after unit stopped.

so i tried killing swhkd with sudo and also killed swhks and restart the service again, got a different behaviour It does start, but for some reason it does not work, it does not take my shortcuts and execute the commands

Apr 25 13:52:29 arch systemd[985]: Started swhkd hotkey daemon.
Apr 25 13:52:29 arch hotkeys.sh[19425]: swhks: no process found
Apr 25 13:52:29 arch pkexec[19427]: pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
RusticCraftsman commented 1 year ago

so i tried killing swhkd with sudo and also killed swhks and restart the service again, got a different behaviour It does start, but for some reason it does not work, it does not take my shortcuts and execute the commands

Apr 25 13:52:29 arch systemd[985]: Started swhkd hotkey daemon.
Apr 25 13:52:29 arch hotkeys.sh[19425]: swhks: no process found
Apr 25 13:52:29 arch pkexec[19427]: pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)

I realized why, idk what happened but my swhkd config file /etc/swhkd/swhkdrc was erased from existence, putting it back seems to make it work, i now shall see if with some tweaking i can make it work properly on startup

RusticCraftsman commented 1 year ago

i havent seem to find a way to make it work on startup, i dont even know what could work tbh