cyber-sushi / makima

Linux daemon to remap and create macros for keyboards, mice and controllers
GNU General Public License v3.0
145 stars 1 forks source link

Permission Denied on VirtualDeviceBuilder::new().unwrap() #4

Closed agoodshort closed 10 months ago

agoodshort commented 10 months ago

Description

When starting makima I receive the following error message:

    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/makima`
Parsing config file:
"/home/abiencourt/.config/makima/Keychron Keychron Q10.toml"

Running on sway, active window detection enabled.
thread 'tokio-runtime-worker' panicked at src/udev_monitor.rs:131:52:
called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Steps to reproduce

  1. Create config file .config/makima/Keychron Keychron Q10.toml
  2. Run sudo usermod -aG input <username>
  3. Logout / login
  4. Clone the repo
  5. cargo run

Troubleshooting steps so far

cyber-sushi commented 10 months ago

When a new instance of VirtualDeviceBuilder is created, it first makes sure that you have both read and write permissions on /dev/uinput, can you check if you have those?

It could also be possible that the uinput kernel module isn't loaded, what if you use sudo modprobe uinput and then try running Makima again?

agoodshort commented 10 months ago

Thanks so much for the quick response.

sudo modprobe uinput does the trick. I'm fairly new to kernel stuff, I guess I have some reading to do on these topics :laughing:

Is there anything that could be done on the app to avoid this or should I just load uinput on my own?

cyber-sushi commented 10 months ago

Makima can't load kernel modules since it doesn't have sudo privileges, but if you want you can automatically load uinput on boot.

Create /etc/modules-load.d/uinput.conf and inside that file just write uinput, then save and reboot.

Let me know if this works; if it does, I'll add it to the docs tomorrow.

agoodshort commented 10 months ago

So I did a bit more testing:

  1. I did not update my modules-load.d and simply rebooted my machine
  2. lsmod | grep uiput returns nothing
  3. Start makima
  4. lsmod | grep uinput shows that the module is now loaded

I'm not sure what happened earlier, but it looks like everything works as expected now. Maybe sudo usermod -aG input <username> requires a reboot instead of a logout / login. I could try to investigate a bit and reproduce if you want me to, but otherwise I'd leave this issue as a one-off and close.

cyber-sushi commented 10 months ago

I don't think usermod -aG input <username> needs a reboot because you were able to use evtest which requires you to be in the input group to work, but maybe loading uinput requires a reboot? In any case, I'm adding it to the docs, it could be useful to other users

And thank you a lot for your cooperation!