Espanso daemon problem

it isn’t and the code hasn’t seen any updates for quite a while

I just created a temporary workaround for espanso 2.2.1 that works on NixOs wayland. (hope you like it).

3 Likes

Thank you very much! I’ll try that the next time I’ll attempt to move to Wayland!

Your avatar confused the hell out of me :joy:.
I saw your post and thought: “WTF I can’t remember writing this at all and why is my username wrong?”

2 Likes

Hi! Thanks a lot @ingbarrozo to found a workaround for espanso.
I tried your code, but I got an error when switching nixos at this line https://github.com/ingbarrozo/espanso/blob/00c91924ddf91995c05bfad4bd2728482d5a59a4/default.nix#L46

I don’t use home manager.
I don’t know how or by what replacing this line. I’ve you got an idea ?

I think that by replacing line:
home.packages = [ config.programs.espanso.package ];
with line: users.users.“yourusername”.packages = [ config.programs.espanso.package ];
, could solve your problem.

let me know if that works.

3 Likes

hehehe, i think the name of the app is/was Androidify.

I created that avatar many years ago. (maybe 2012)

2 Likes

It works !
Awesome, thanks a lot for your help :smiling_face_with_three_hearts:

1 Like

Hm, for some reason I ran into Error: could not open uinput device, but I set the input group (see Error: could not open uinput device · Issue #1 · ingbarrozo/espanso · GitHub) :thinking:

Hi there. I am trying to use the fix by @ingbarrozo and the build goes without a hitch. But when I try to follow the readme instructions where I register, then start the daemon with espanso start I get:

❯ 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.

Ensured I was in the input group:

❯ getent group input
input:x:174:dustin

Then I check the logs with:

❯ sudo journalctl -xe
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [INFO] using runtime dir: "/home/dustin/.cache/espanso"
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [INFO] system info: NixOS v24.11 - kernel: 6.6.33
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [INFO] binded to IPC unix socket: /home/dustin/.cache/espanso/espansoworkerv2.sock
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [INFO] using WaylandAppInfoProvider
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN] EVDEV backend is being used, but without enabling linux capabilities.
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [INFO] monitoring the status of the daemon process
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN]   Although you CAN run espanso EVDEV backend as root, it's not recommended due
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN]   to security reasons. Espanso supports linux capabilities to limit the attack surface
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN]   area by only leveraging on the CAP_DAC_OVERRIDE capability (needed to work with
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN]   /dev/input/* devices to detect and inject text) and disabling it as soon as the
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN]   initial setup is completed.
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [WARN] unable to determine keyboard layout automatically, please explicitly specify it in the configuration.
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [INFO] using EVDEVSource
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [ERROR] Unable to open EVDEV devices, this usually has to do with permissions.
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [ERROR] You can either add the current user to the 'input' group or run espanso as root
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [ERROR] thread 'engine thread' panicked at 'failed to initialize detector module: detection source initialization failed': espanso/src/cli/worker/engine/mod.rs:140
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160
Jun 19 10:04:27 rembot .espanso-wrapped[158008]: 10:04:27 [daemon(158008)] [ERROR] received unexpected exit code from worker 101, exiting
Jun 19 10:04:27 rembot .espanso-wrapped[158001]: thread 'main' panicked at espanso/src/cli/launcher/mod.rs:213:45:
Jun 19 10:04:27 rembot .espanso-wrapped[158001]: failed to launch daemon: unexpected error, 'espanso daemon' returned a non-zero exit code.
Jun 19 10:04:27 rembot .espanso-wrapped[158001]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Jun 19 10:04:27 rembot systemd[6767]: espanso.service: Main process exited, code=exited, status=101/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit UNIT has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 101.
Jun 19 10:04:27 rembot systemd[6767]: espanso.service: Failed with result 'exit-code'.
░░ Subject: Unit failed

Found this interesting:

Jun 19 10:04:27 rembot .espanso-wrapped[158014]: 10:04:27 [worker(158014)] [ERROR] You can either add the current user to the 'input' group or run espanso as root

Fixed the keyboard warning as well.

But I also confirmed that above already.

So I tried (since espanso.service was referenced in journalctl output:

❯ sudo systemctl status espanso
Unit espanso.service could not be found.
❯ sudo systemctl status espanso --user
Failed to connect to bus: No medium found

Any ideas?

Every time I have an issue with the service (and don’t want to reboot, because that’s fixing the issue most of the time) I just kill every process of it and do a espanso start --unmanaged until the next reboot. :person_shrugging:t2:

yeah, I found that the reboot was the solution. Now I am just trying to figure out why I get an “unknown” app showing (bug report here). It seems to have been fixed.

Now I will have a look at the workaround here to see if I can get a later version of espanso.

I also have a permanently open app (and started to live with it :laughing:).
I even have that on my Wayland build of the latest espanso 2.2.1 (nixcfg/apps/espanso/espanso.nix at 2c678ee8d2e203dd0585d2792269016df9920d0e · pbek/nixcfg · GitHub).

THe app in alt+tab is ok. It is the artifact it leaves on my screen that drives me nuts.

image

I try to put the task on a not so much used desktop. :sweat_smile:

Since this week, with the espanso from nixos-unstable on KDE Plasma 6.1 I don’t get the extra app anymore!

I have tried but I can’t get this to work on wayland…

Tried enabling the options services.espanso.wayland = true, services.espanso.package = pkgs.espanso-wayland and services.espanso.enable = true. And also added espanso-wayland to the environment.systemPackages, nothing worked.

This is the log from espanso log:

$ espanso log
23:44:06 [daemon(449587)] [INFO] reading configs from: "/home/abdulla/.config/espanso"
23:44:06 [daemon(449587)] [INFO] reading packages from: "/home/abdulla/.config/espanso/match/packages"
23:44:06 [daemon(449587)] [INFO] using runtime dir: "/home/abdulla/.cache/espanso"
23:44:06 [daemon(449587)] [INFO] system info: NixOS v24.11 - kernel: 6.6.41
23:44:06 [daemon(449587)] [WARN] keyboard layout watcher couldn't determine active layout.
23:44:06 [daemon(449587)] [INFO] espanso version: 2.2.1
23:44:06 [daemon(449587)] [INFO] spawning the worker process...
23:44:06 [daemon(449587)] [INFO] watching for changes in path: "/home/abdulla/.config/espanso"
23:44:06 [daemon(449587)] [INFO] binded to IPC unix socket: /home/abdulla/.cache/espanso/espansodaemonv2.sock
23:44:06 [worker(449593)] [INFO] reading configs from: "/home/abdulla/.config/espanso"
23:44:06 [worker(449593)] [INFO] reading packages from: "/home/abdulla/.config/espanso/match/packages"
23:44:06 [worker(449593)] [INFO] using runtime dir: "/home/abdulla/.cache/espanso"
23:44:06 [worker(449593)] [INFO] system info: NixOS v24.11 - kernel: 6.6.41
23:44:06 [worker(449593)] [INFO] binded to IPC unix socket: /home/abdulla/.cache/espanso/espansoworkerv2.sock
23:44:06 [worker(449593)] [INFO] using WaylandAppInfoProvider
23:44:06 [worker(449593)] [WARN] EVDEV backend is being used, but without enabling linux capabilities.
23:44:06 [worker(449593)] [WARN]   Although you CAN run espanso EVDEV backend as root, it's not recommended due
23:44:06 [worker(449593)] [WARN]   to security reasons. Espanso supports linux capabilities to limit the attack surface
23:44:06 [worker(449593)] [WARN]   area by only leveraging on the CAP_DAC_OVERRIDE capability (needed to work with
23:44:06 [worker(449593)] [INFO] monitoring the status of the daemon process
23:44:06 [worker(449593)] [WARN]   /dev/input/* devices to detect and inject text) and disabling it as soon as the
23:44:06 [worker(449593)] [WARN]   initial setup is completed.
23:44:06 [worker(449593)] [INFO] detection module will use this keyboard layout: [R=evdev, M=pc105, L=us, V=, O=]
23:44:06 [worker(449593)] [INFO] using EVDEVSource
23:44:06 [worker(449593)] [ERROR] Unable to open EVDEV devices, this usually has to do with permissions.
23:44:06 [worker(449593)] [ERROR] You can either add the current user to the 'input' group or run espanso as root
23:44:06 [worker(449593)] [ERROR] thread 'engine thread' panicked at 'failed to initialize detector module: detection source initialization failed': espanso/src/cli/worker/engine/mod.rs:141
23:44:06 [worker(449593)] [ERROR] Unable to block the LinuxEventLoop: receiving on an empty and disconnected channel
23:44:06 [worker(449593)] [ERROR] thread 'main' panicked at 'unable to run main eventloop: receiving on an empty and disconnected channel': espanso/src/cli/worker/mod.rs:160
23:44:06 [daemon(449587)] [ERROR] received unexpected exit code from worker 101, exiting

Does a espanso stop; espanso start --unmanaged work? That’s what I do when I get any issue…

sadly it didn’t :confused: I had removed espanso for the time being and will try again later someday~

Just as a heads up for anyone stumbling over this discussion and the problem with the DAC_OVERRIDE capability on espanso-wayland: There’s some progress happening on the corresponding nixpkgs issue (#249364) and two PRs (#328890 and #339594) that fix it; we’re still figuring out the pros/cons of both approaches.

In the meantime, a comparatively easy workaround (based on #328890) for flake-based systems is described here.

3 Likes