jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
3.18k stars 130 forks source link

Bug: kanata doesn't work on startup #1207

Closed GrownPlanet closed 3 months ago

GrownPlanet commented 3 months ago

Requirements

Describe the bug

Kanata doesn't start on startup using systemd, when restarting kanata using systemctl --user restart kanata.service it works properly. systemd log:

$ systemctl --user status kanata.service
○ kanata.service - Kanata keyboard remapper
     Loaded: loaded (/home/timod/.config/systemd/user/kanata.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: inactive (dead) since Sat 2024-08-24 20:20:24 CEST; 52min ago
   Duration: 9ms
       Docs: https://github.com/jtroo/kanata
    Process: 2094 ExecStart=/home/timod/.cargo/bin/kanata --cfg /home/timod/.config/kanata/config.kbd (code=exited, status=1/FAILURE)
   Main PID: 2094 (code=exited, status=1/FAILURE)
        CPU: 5ms

Aug 24 20:20:24 fedora systemd[2061]: Started kanata.service - Kanata keyboard remapper.
Aug 24 20:20:24 fedora systemd[2061]: kanata.service: Main process exited, code=exited, status=1/FAILURE
Aug 24 20:20:24 fedora systemd[2061]: kanata.service: Failed with result 'exit-code'.

Relevant kanata config

No response

To Reproduce

  1. use systemd to start kanata (systemd file:
    
    Description=Kanata keyboard remapper
    Documentation=https://github.com/jtroo/kanata

[Service] Environment=PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin Environment=DISPLAY=:0 Environment=HOME=/home/timod Type=simple ExecStart=/home/timod/.cargo/bin/kanata --cfg /home/timod/.config/kanata/config.kbd Restart=never

[Install] WantedBy=default.target


3. reboot pc

### Expected behavior

Kanata starts with my pc/ when I log in and am able to use it without restarting it.

### Kanata version

kanata 1.6.1

### Debug logs

_No response_

### Operating system

Fedora 40

### Additional context

_No response_
jtroo commented 3 months ago

Doesn't seem like a Kanata bug. Is there anything else in system logs suggesting why Kanata exited? Perhaps it's starting up too early and no input devices are found? There should be a defcfg item or CLI argument to control this behaviour if no devices are found IIRC.

Any reason why you're using Restart=never? If you can change it that also seems like a reasonable fix.

GrownPlanet commented 3 months ago

Perhaps it's starting up too early and no input devices are found\ that could definitely be it, but removing Restart=never doesn't fix it, I will try to make it start after input devices are discovered

GrownPlanet commented 3 months ago

I changed Restart=never to Restart=on-failure and that fixed it.