espanso / espanso

Cross-platform Text Expander written in Rust
https://espanso.org
GNU General Public License v3.0
10.09k stars 278 forks source link

Espanso crashes under Hyprland v0.32.3 and above #1768

Closed bkuri closed 8 months ago

bkuri commented 11 months ago

Describe the bug Espanso crashes as soon as the systemd service starts. Running espanso daemon does output an error (see below).

To Reproduce Steps to reproduce the behavior:

  1. Update Hyprland from v0.30.0 to v0.32.3, v0.33.0, or v0.33.1 and restart.

Expected behavior FWIW Hyprland v0.30.0 runs espanso perfectly.

Logs

17:57:29 [daemon(10402)] [INFO] reading configs from: "/home/bk/.config/espanso"
17:57:29 [daemon(10402)] [INFO] reading packages from: "/home/bk/.config/espanso/match/packages"
17:57:29 [daemon(10402)] [INFO] using runtime dir: "/home/bk/.cache/espanso"
17:57:29 [daemon(10402)] [INFO] system info: Arch Linux v - kernel: 6.6.4-AMD-znver2
17:57:29 [daemon(10402)] [WARN] keyboard layout watcher couldn't determine active layout.
17:57:29 [daemon(10402)] [INFO] watching for changes in path: "/home/bk/.config/espanso"
17:57:29 [daemon(10402)] [INFO] espanso version: 2.1.8
17:57:29 [daemon(10402)] [INFO] spawning the worker process...
17:57:29 [daemon(10402)] [INFO] binded to IPC unix socket: /home/bk/.cache/espanso/espansodaemonv2.sock
17:57:29 [worker(10411)] [INFO] reading configs from: "/home/bk/.config/espanso"
17:57:29 [worker(10411)] [INFO] reading packages from: "/home/bk/.config/espanso/match/packages"
17:57:29 [worker(10411)] [INFO] using runtime dir: "/home/bk/.cache/espanso"
17:57:29 [worker(10411)] [INFO] system info: Arch Linux v - kernel: 6.6.4-AMD-znver2
17:57:29 [worker(10411)] [INFO] binded to IPC unix socket: /home/bk/.cache/espanso/espansoworkerv2.sock
17:57:29 [worker(10411)] [INFO] using WaylandAppInfoProvider
17:57:29 [worker(10411)] [INFO] monitoring the status of the daemon process
17:57:29 [worker(10411)] [INFO] detection module will use this keyboard layout: [R=, M=, L=us, V=, O=]
17:57:29 [worker(10411)] [INFO] using EVDEVSource
17:57:30 [worker(10411)] [INFO] Querying modifier status...
17:57:30 [worker(10411)] [ERROR] thread 'detect thread' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 0, kind: Uncategorized, message: "Success" }': espanso-detect/src/evdev/sync/wayland.rs:193
17:57:30 [worker(10411)] [ERROR] thread 'engine thread' panicked at 'unable to receive from the init_rx channel: RecvError': espanso/src/cli/worker/engine/funnel/mod.rs:124
17:57:30 [worker(10411)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
17:57:30 [worker(10411)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160
17:57:30 [daemon(10402)] [ERROR] received unexpected exit code from worker 101, exiting

Setup information

Arch Linux

uname -a:

6.6.4-AMD-znver2 #1 SMP PREEMPT_DYNAMIC Sun Dec  3 08:15:20 CET 2023 x86_64 GNU/Linux

lspci -v:

0b:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev ef) (prog-if 00 [VGA controller])
    Subsystem: Tul Corporation / PowerColor Radeon RX 570 4G [Red Dragon]
    Flags: bus master, fast devsel, latency 0, IRQ 164, IOMMU group 27
    Memory at d0000000 (64-bit, prefetchable) [size=256M]
    Memory at e0000000 (64-bit, prefetchable) [size=2M]
    I/O ports at f000 [size=256]
    Memory at fce00000 (32-bit, non-prefetchable) [size=256K]
    Expansion ROM at fce40000 [disabled] [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: amdgpu
    Kernel modules: amdgpu

espanso --version:

espanso 2.1.8

espanso config:

keyboard_layout: { layout: us }
key_delay: 0
search_shortcut: off
search_trigger: off
show_notifications: false

More info here:

morgan-dgk commented 11 months ago

See my comment on #1750 - I think this is an issue with the smithay-client-toolkit 15.4 dependency in espanso-detect when built for Wayland. I don't know rust, but it may be possible to patch smithay-client-toolkit with the fix included in 16.1 without changing the dependency (which breaks the build).

KAGEYAM4 commented 11 months ago

@morgan-dgk how do we update? will there be a release or use aur/espanso-wayland-git 2.1.5.beta.r17.g930bf80-3?

AucaCoyan commented 11 months ago

Hi! We are still on the run to release a more stable release. We are taking things slowly so we don't break the production code. If you are brave, you can compile the dev branch and it should do all right. Of course we will assist you if you have any trouble compiling! See you on the neighborhood

morgan-dgk commented 11 months ago

@morgan-dgk how do we update? will there be a release or use aur/espanso-wayland-git 2.1.5.beta.r17.g930bf80-3?

@KAGEYAM4 If you do not want to wait for the next release / compile yourself, I have created a patched PKGBUILD.

kaushalyap commented 8 months ago

@morgan-dgk I am still getting the same error regardless being on 2.2.0

$ espanso --version
espanso 2.2.0

Logs

Mar 02 08:26:16 fedora systemd[1925]: Started espanso.service - espanso.
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] reading configs from: "$HOME.config/espanso"
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] reading packages from: "$HOME.config/espanso/match/packages"
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] using runtime dir: "$HOME.cache/espanso"
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] system info: Fedora Linux v39 - kernel: 6.6.14-200.fc39.x86_64
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] watching for changes in path: "$HOME.config/espanso"
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] espanso version: 2.2.0
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] spawning the worker process...
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [INFO] binded to IPC unix socket: $HOME.cache/espanso/espansodaemonv2.sock
Mar 02 08:26:19 fedora espanso[4401]: 08:26:19 [daemon(4401)] [WARN] keyboard layout watcher couldn't determine active layout.
Mar 02 08:26:19 fedora espanso[4408]: 08:26:19 [worker(4408)] [INFO] reading configs from: "$HOME.config/espanso"
Mar 02 08:26:19 fedora espanso[4408]: 08:26:19 [worker(4408)] [INFO] reading packages from: "$HOME.config/espanso/match/packages"
Mar 02 08:26:19 fedora espanso[4408]: 08:26:19 [worker(4408)] [INFO] using runtime dir: "$HOME.cache/espanso"
Mar 02 08:26:19 fedora espanso[4408]: 08:26:19 [worker(4408)] [INFO] system info: Fedora Linux v39 - kernel: 6.6.14-200.fc39.x86_64
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [INFO] binded to IPC unix socket: $HOME.cache/espanso/espansoworkerv2.sock
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [INFO] monitoring the status of the daemon process
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [INFO] using WaylandAppInfoProvider
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [INFO] detection module will use this keyboard layout: [R=evdev, M=pc105, L=us, V=, O=]
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [INFO] using EVDEVSource
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [INFO] Querying modifier status...
Mar 02 08:26:20 fedora espanso[4408]: interface 'wl_surface' has no event 2
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [ERROR] thread 'detect thread' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 0, kind: Uncategorized, message: "Success" }': espanso-detect/src/evdev/sync/wayland.rs:193
Mar 02 08:26:20 fedora espanso[4408]: warning: queue 0x7f856003a880 destroyed while proxies still attached:
Mar 02 08:26:20 fedora espanso[4408]:   wl_buffer@25 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_keyboard@24 still attached
Mar 02 08:26:20 fedora espanso[4408]:   xdg_wm_base@16 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_surface@15 still attached
Mar 02 08:26:20 fedora espanso[4408]:   zwp_primary_selection_device_v1@14 still attached
Mar 02 08:26:20 fedora espanso[4408]:   zwp_primary_selection_device_manager_v1@3 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_data_device@13 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_output@12 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_output@11 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_output@10 still attached
Mar 02 08:26:20 fedora espanso[4408]:   zxdg_decoration_manager_v1@9 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_seat@8 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_data_device_manager@7 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_subcompositor@6 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_compositor@5 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_shm@4 still attached
Mar 02 08:26:20 fedora espanso[4408]:   wl_registry@2 still attached
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [ERROR] thread 'engine thread' panicked at 'unable to receive from the init_rx channel: RecvError': espanso/src/cli/worker/engine/funnel/mod.rs:124
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
Mar 02 08:26:20 fedora espanso[4408]: 08:26:20 [worker(4408)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160
Mar 02 08:26:20 fedora espanso[4401]: 08:26:20 [daemon(4401)] [ERROR] received unexpected exit code from worker 101, exiting
Mar 02 08:26:20 fedora espanso[4373]: thread 'main' panicked at 'failed to launch daemon: unexpected error, 'espanso daemon' returned a non-zero exit code.', espanso/src/cli/launcher/mod.rs:213:45
Mar 02 08:26:20 fedora espanso[4373]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Mar 02 08:26:20 fedora systemd[1925]: espanso.service: Main process exited, code=exited, status=101/n/a
Mar 02 08:26:20 fedora systemd[1925]: espanso.service: Failed with result 'exit-code'.
Mar 02 08:26:23 fedora systemd[1925]: espanso.service: Scheduled restart job, restart counter is at 1.
Mar 02 08:26:23 fedora systemd[1925]: Started espanso.service - espanso.
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] reading configs from: "$HOME.config/espanso"
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] reading packages from: "$HOME.config/espanso/match/packages"
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] using runtime dir: "$HOME.cache/espanso"
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] system info: Fedora Linux v39 - kernel: 6.6.14-200.fc39.x86_64
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] watching for changes in path: "$HOME.config/espanso"
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] espanso version: 2.2.0
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] spawning the worker process...
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [INFO] binded to IPC unix socket: $HOME.cache/espanso/espansodaemonv2.sock
Mar 02 08:26:23 fedora espanso[4518]: 08:26:23 [daemon(4518)] [WARN] keyboard layout watcher couldn't determine active layout.
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] reading configs from: "$HOME.config/espanso"
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] reading packages from: "$HOME.config/espanso/match/packages"
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] using runtime dir: "$HOME.cache/espanso"
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] system info: Fedora Linux v39 - kernel: 6.6.14-200.fc39.x86_64
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] binded to IPC unix socket: $HOME.cache/espanso/espansoworkerv2.sock
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] using WaylandAppInfoProvider
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] detection module will use this keyboard layout: [R=evdev, M=pc105, L=us, V=, O=]
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] monitoring the status of the daemon process
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] using EVDEVSource
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [INFO] Querying modifier status...
Mar 02 08:26:23 fedora espanso[4525]: interface 'wl_surface' has no event 2
Mar 02 08:26:23 fedora espanso[4525]: 08:26:23 [worker(4525)] [ERROR] thread 'detect thread' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 0, kind: Uncategorized, message: "Success" }': espanso-detect/src/evdev/sync/wayland.rs:193
...

I have following in espanso config (default.yml), still I get the warning related to keyboard layout.

keyboard_layout:
  rules: "evdev"
  model: pc105
  layout: us
AucaCoyan commented 8 months ago

Mmmm this is still failing. We need to reopen the issue and investigate what is happening. Personally I can't do this as I currently don't have a PC with walyand and a non nvidia GPU to run hyprland :( Would love to have some help here!

KAGEYAM4 commented 8 months ago

For me its working perfectly, other than this issue - https://github.com/espanso/espanso/issues/1776

[ArchLinux ~]$ uname -a
Linux ArchLinux 6.7.4-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Mon, 05 Feb 2024 22:07:37 +0000 x86_64 GNU/Linux
[ArchLinux ~]$ yay -Q hyprland espanso
hyprland 0.35.0-2
espanso-wayland 2.2.1-4
[ArchLinux ~]$ espanso log
14:49:30 [daemon(154183)] [INFO] reading configs from: "/home/phoenix/.config/espanso"
14:49:30 [daemon(154183)] [INFO] reading packages from: "/home/phoenix/.config/espanso/match/packages"
14:49:30 [daemon(154183)] [INFO] using runtime dir: "/home/phoenix/.cache/espanso"
14:49:30 [daemon(154183)] [INFO] system info: Arch Linux vrolling - kernel: 6.7.4-zen1-1-zen
14:49:30 [daemon(154183)] [WARN] keyboard layout watcher couldn't determine active layout.
14:49:30 [daemon(154183)] [INFO] watching for changes in path: "/home/phoenix/.config/espanso"
14:49:30 [daemon(154183)] [INFO] espanso version: 2.2.1
14:49:30 [daemon(154183)] [INFO] spawning the worker process...
14:49:30 [daemon(154183)] [INFO] binded to IPC unix socket: /home/phoenix/.cache/espanso/espansodaemonv2.sock
14:49:30 [worker(154189)] [INFO] reading configs from: "/home/phoenix/.config/espanso"
14:49:30 [worker(154189)] [INFO] reading packages from: "/home/phoenix/.config/espanso/match/packages"
14:49:30 [worker(154189)] [INFO] using runtime dir: "/home/phoenix/.cache/espanso"
14:49:30 [worker(154189)] [INFO] system info: Arch Linux vrolling - kernel: 6.7.4-zen1-1-zen
14:49:30 [worker(154189)] [INFO] binded to IPC unix socket: /home/phoenix/.cache/espanso/espansoworkerv2.sock
14:49:30 [worker(154189)] [INFO] using WaylandAppInfoProvider
14:49:30 [worker(154189)] [INFO] detection module will use this keyboard layout: [R=, M=, L=us, V=, O=]
14:49:30 [worker(154189)] [INFO] monitoring the status of the daemon process
14:49:30 [worker(154189)] [INFO] using EVDEVSource
14:49:31 [worker(154189)] [INFO] Querying modifier status...
14:49:31 [worker(154189)] [INFO] inject module will use this keyboard layout: [R=, M=, L=us, V=, O=]
14:49:31 [worker(154189)] [INFO] using EVDEVInjector
14:49:31 [worker(154189)] [INFO] using WaylandFallbackClipboard
14:52:51 [service(156552)] [INFO] reading configs from: "/home/phoenix/.config/espanso"
14:52:51 [service(156552)] [INFO] reading packages from: "/home/phoenix/.config/espanso/match/packages"
14:52:51 [service(156552)] [INFO] using runtime dir: "/home/phoenix/.cache/espanso"
14:52:51 [service(156552)] [INFO] system info: Arch Linux vrolling - kernel: 6.7.4-zen1-1-zen
14:52:51 [service(156552)] [INFO] espanso is running
morgan-dgk commented 8 months ago

@kaushalyap have you tried updating to v2.2.1 yet? This should resolve this issue.

@AucaCoyan the reason this happens is explained here in the repo for the client library used under wayland (sctk). In short, prior to v0.16.1 sctk bound the wayland globals to the latest version offered by the display server and not the latest version supported by the client library. It seems that this is not a problem for some compositors, such as mutter (used on wayland under Ubuntu) because there are no incompatabilities in the globals bound.

However, for other compositors where there are differences between the wl_surface global advertised by the display server and the version expected in the client code, issues will occur when using sctk under version v0.16.1 The error interface 'wl_surface' has no event 2 occurs here because there is a mismatch between the version of this interface as bound from the display server and the version of this interface supported by the client library.

kaushalyap commented 8 months ago

@morgan-dgk Thanks Morgan for help, It seems fix is actually in v2.2.0.

morgan-dgk commented 8 months ago

Apologies, you are correct @kaushalyap. Weird that you are still seeing this issue. What compositor are you using? Could you also please run WAYLAND_DEBUG=1 espanso -vvvv worker?

kaushalyap commented 8 months ago

@morgan-dgk sorry for late reply, here is the output for the provided command

❯ WAYLAND_DEBUG=1 espanso -vvvv worker
16:48:01 [worker(158354)] [DEBUG] (1) espanso_path: detected config directory in $HOME/.config/espanso
16:48:01 [worker(158354)] [DEBUG] (1) espanso_path: detected default runtime dir: "$HOME/.cache/espanso"
16:48:01 [worker(158354)] [DEBUG] (1) espanso_path: detected default packages dir: "$HOME/.config/espanso/match/packages"
16:48:01 [worker(158354)] [INFO] reading configs from: "$HOME/.config/espanso"
16:48:01 [worker(158354)] [INFO] reading packages from: "$HOME/.config/espanso/match/packages"
16:48:01 [worker(158354)] [INFO] using runtime dir: "$HOME/.cache/espanso"
16:48:01 [worker(158354)] [INFO] system info: Fedora Linux v39 - kernel: 6.7.6-200.fc39.x86_64
16:48:01 [worker(158354)] [DEBUG] (1) espanso_config::config::store: loaded default config at path: "$HOME/.config/espanso/config/default.yml"
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'alacritty_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'emacs_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'gedit_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'generic_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'kitty_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'konsole_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'libreoffice_writer_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'simple_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'simple_terminal_2_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'terminator_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'termite_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'thunderbird_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'tilix_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'urxvt_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'xterm_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'yakuake_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'virtualbox_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::cli::worker: starting with start-reason = None
16:48:01 [worker(158354)] [DEBUG] (1) espanso::icon: skipping extraction for '"$HOME/.cache/espanso/iconv2.png"', as it's already present
16:48:01 [worker(158354)] [DEBUG] (1) espanso::icon: skipping extraction for '"$HOME/.cache/espanso/search.png"', as it's already present
16:48:01 [worker(158354)] [DEBUG] (1) espanso::icon: skipping extraction for '"$HOME/.cache/espanso/icon_no_background.png"', as it's already present
16:48:01 [worker(158354)] [INFO] using WaylandAppInfoProvider
16:48:01 [worker(158354)] [WARN] EVDEV backend is being used, but without enabling linux capabilities.
16:48:01 [worker(158354)] [INFO] binded to IPC unix socket: $HOME/.cache/espanso/espansoworkerv2.sock
16:48:01 [worker(158354)] [WARN]   Although you CAN run espanso EVDEV backend as root, it's not recommended due
16:48:01 [worker(158354)] [WARN]   to security reasons. Espanso supports linux capabilities to limit the attack surface
16:48:01 [worker(158354)] [WARN]   area by only leveraging on the CAP_DAC_OVERRIDE capability (needed to work with
16:48:01 [worker(158354)] [WARN]   /dev/input/* devices to detect and inject text) and disabling it as soon as the
16:48:01 [worker(158354)] [WARN]   initial setup is completed.
16:48:01 [worker(158354)] [INFO] detection module will use this keyboard layout: [R=evdev, M=pc105, L=us, V=, O=]
16:48:01 [worker(158354)] [INFO] using EVDEVSource
16:48:01 [worker(158354)] [ERROR] Unable to open EVDEV devices, this usually has to do with permissions.
16:48:01 [worker(158354)] [ERROR] You can either add the current user to the 'input' group or run espanso as root
16:48:01 [worker(158354)] [ERROR] thread 'engine thread' panicked at 'failed to initialize detector module: detection source initialization failed': espanso/src/cli/worker/engine/mod.rs:141
16:48:01 [worker(158354)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
16:48:01 [worker(158354)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160

Additionally useful info

❯ uname -a
Linux fedora 6.7.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Feb 23 18:27:29 UTC 2024 x86_64 GNU/Linux

~
❯ espanso --version
espanso 2.2.1

Actually now I notice espanso does not start even in Gnome

❯ espanso start
unable to start service: timed out
Hint: sometimes this happens because another Espanso process is left running for some reason.
      Please try running 'espanso restart' or manually killing all Espanso processes, then try again.

~ took 6s

Adding user to input group did not fixed it.

morgan-dgk commented 8 months ago

@morgan-dgk sorry for late reply, here is the output for the provided command

❯ WAYLAND_DEBUG=1 espanso -vvvv worker
16:48:01 [worker(158354)] [DEBUG] (1) espanso_path: detected config directory in $HOME/.config/espanso
16:48:01 [worker(158354)] [DEBUG] (1) espanso_path: detected default runtime dir: "$HOME/.cache/espanso"
16:48:01 [worker(158354)] [DEBUG] (1) espanso_path: detected default packages dir: "$HOME/.config/espanso/match/packages"
16:48:01 [worker(158354)] [INFO] reading configs from: "$HOME/.config/espanso"
16:48:01 [worker(158354)] [INFO] reading packages from: "$HOME/.config/espanso/match/packages"
16:48:01 [worker(158354)] [INFO] using runtime dir: "$HOME/.cache/espanso"
16:48:01 [worker(158354)] [INFO] system info: Fedora Linux v39 - kernel: 6.7.6-200.fc39.x86_64
16:48:01 [worker(158354)] [DEBUG] (1) espanso_config::config::store: loaded default config at path: "$HOME/.config/espanso/config/default.yml"
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'alacritty_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'emacs_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'gedit_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'generic_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'kitty_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'konsole_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'libreoffice_writer_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'simple_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'simple_terminal_2_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'terminator_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'termite_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'thunderbird_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'tilix_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'urxvt_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'xterm_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'yakuake_terminal_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::patch::config_store: skipping 'virtualbox_x11' patch
16:48:01 [worker(158354)] [DEBUG] (1) espanso::cli::worker: starting with start-reason = None
16:48:01 [worker(158354)] [DEBUG] (1) espanso::icon: skipping extraction for '"$HOME/.cache/espanso/iconv2.png"', as it's already present
16:48:01 [worker(158354)] [DEBUG] (1) espanso::icon: skipping extraction for '"$HOME/.cache/espanso/search.png"', as it's already present
16:48:01 [worker(158354)] [DEBUG] (1) espanso::icon: skipping extraction for '"$HOME/.cache/espanso/icon_no_background.png"', as it's already present
16:48:01 [worker(158354)] [INFO] using WaylandAppInfoProvider
16:48:01 [worker(158354)] [WARN] EVDEV backend is being used, but without enabling linux capabilities.
16:48:01 [worker(158354)] [INFO] binded to IPC unix socket: $HOME/.cache/espanso/espansoworkerv2.sock
16:48:01 [worker(158354)] [WARN]   Although you CAN run espanso EVDEV backend as root, it's not recommended due
16:48:01 [worker(158354)] [WARN]   to security reasons. Espanso supports linux capabilities to limit the attack surface
16:48:01 [worker(158354)] [WARN]   area by only leveraging on the CAP_DAC_OVERRIDE capability (needed to work with
16:48:01 [worker(158354)] [WARN]   /dev/input/* devices to detect and inject text) and disabling it as soon as the
16:48:01 [worker(158354)] [WARN]   initial setup is completed.
16:48:01 [worker(158354)] [INFO] detection module will use this keyboard layout: [R=evdev, M=pc105, L=us, V=, O=]
16:48:01 [worker(158354)] [INFO] using EVDEVSource
16:48:01 [worker(158354)] [ERROR] Unable to open EVDEV devices, this usually has to do with permissions.
16:48:01 [worker(158354)] [ERROR] You can either add the current user to the 'input' group or run espanso as root
16:48:01 [worker(158354)] [ERROR] thread 'engine thread' panicked at 'failed to initialize detector module: detection source initialization failed': espanso/src/cli/worker/engine/mod.rs:141
16:48:01 [worker(158354)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
16:48:01 [worker(158354)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160

Additionally useful info

❯ uname -a
Linux fedora 6.7.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Feb 23 18:27:29 UTC 2024 x86_64 GNU/Linux

~
❯ espanso --version
espanso 2.2.1

Actually now I notice espanso does not start even in Gnome

❯ espanso start
unable to start service: timed out
Hint: sometimes this happens because another Espanso process is left running for some reason.
      Please try running 'espanso restart' or manually killing all Espanso processes, then try again.

~ took 6s

Adding user to input group did not fixed it.

Thanks, have you tried setcap "cap_dac_override+p" $(which espanso)?

kaushalyap commented 8 months ago

Thanks, have you tried setcap "cap_dac_override+p" $(which espanso)?

❯ setcap "cap_dac_override+p" $(which espanso)
unable to set CAP_SETFCAP effective capability: Operation not permitted

After rebooting I am seeing Espanso getting crashed repeatedly on Gnome with following error

Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [INFO] using EVDEVSource
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [INFO] Querying modifier status...
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [WARN] unable to determine keyboard layout automatically, please explicitly specify it in the configuration.
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [INFO] using EVDEVInjector
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [ERROR] Error: could not open uinput device
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [ERROR] This might be due to a recent kernel update, please restart your PC so that the uinput module can be loaded correctly.
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [ERROR] thread 'engine thread' panicked at 'failed to initialize injector module: could not open uinput device': espanso/src/cli/worker/engine/mod.rs:186
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
Mar 16 09:33:33 fedora espanso[14653]: 09:33:33 [worker(14653)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160
Mar 16 09:33:34 fedora espanso[14646]: 09:33:34 [daemon(14646)] [ERROR] received unexpected exit code from worker 101, exiting
Mar 16 09:33:34 fedora espanso[14639]: thread 'main' panicked at espanso/src/cli/launcher/mod.rs:213:45:
Mar 16 09:33:34 fedora espanso[14639]: failed to launch daemon: unexpected error, 'espanso daemon' returned a non-zero exit code.
Mar 16 09:33:34 fedora espanso[14639]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Mar 16 09:33:34 fedora systemd[1894]: espanso.service: Main process exited, code=exited, status=101/n/a
Mar 16 09:33:34 fedora systemd[1894]: espanso.service: Failed with result 'exit-code'.
Mar 16 09:33:37 fedora systemd[1894]: espanso.service: Scheduled restart job, restart counter is at 77.
kaushalyap commented 8 months ago

@morgan-dgk Executing setcap "cap_dac_override+p" $(which espanso) with sudo fixed the issue on Gnome, thanks a lot!

Also clearing out .cache/espanso may also have helped!

morgan-dgk commented 8 months ago

@bkuri are you still experiencing this crash?

bkuri commented 8 months ago

@morgan-dgk everything looks good on my side as of espanso v2.2.1 and hyprland v0.35.0.

AucaCoyan commented 8 months ago

Great! We can close this issue then 😄