logiops icon indicating copy to clipboard operation
logiops copied to clipboard

[Ubuntu] Could not create evdev device: Permission denied

Open JCQuintas opened this issue 5 years ago • 10 comments
trafficstars

When I run logid it logs the following error:

[ERROR] Could not create evdev device: Permission denied

It works when I use sudo though, so I wanted to know if there is any way for me to bypass having to use sudo

JCQuintas avatar Mar 20 '20 17:03 JCQuintas

Try adding the user to the plugdev group and logging back in.

# usermod -a -G plugdev username

PixlOne avatar Mar 20 '20 23:03 PixlOne

Doesn't seem to have any effect.

JCQuintas avatar Mar 21 '20 12:03 JCQuintas

I have the same problem, the usermod command does not seem to have an effect at my system (Ubuntu 19.10) either. Is there something else that might work?

MatthijsvE avatar Apr 20 '20 18:04 MatthijsvE

Similar Error, mine says: [ERROR] Could not create evdev device: No such file or directory. Sudo doesn't help

pascal-mack avatar May 29 '20 12:05 pascal-mack

same problem of @pascal-mack on manjaro linux

nylon86 avatar Jul 03 '20 15:07 nylon86

Same on Pop!_OS 20.04. Works fine with sudo

maxikd avatar Jul 20 '20 01:07 maxikd

From my understanding of linux so far, what you want to do is to check the permissions on the devices that are used, in my case:

WARN] Error adding device /dev/hidraw0: open failed: Permission denied
[WARN] Error adding device /dev/hidraw1: open failed: Permission denied
[WARN] Error adding device /dev/hidraw3: open failed: Permission denied
[WARN] Error adding device /dev/hidraw2: open failed: Permission denied
[WARN] Error adding device /dev/hidraw5: open failed: Permission denied
[WARN] Error adding device /dev/hidraw6: open failed: Permission denied
^C
➜  ~ ls -ashl /dev/hidraw*
0 crw------- 1 root root 237, 0 24. Okt 10:58 /dev/hidraw0
0 crw------- 1 root root 237, 1 24. Okt 10:58 /dev/hidraw1
0 crw------- 1 root root 237, 2 24. Okt 10:58 /dev/hidraw2
0 crw------- 1 root root 237, 3 24. Okt 10:58 /dev/hidraw3
0 crw------- 1 root root 237, 5 24. Okt 10:58 /dev/hidraw5
0 crw------- 1 root root 237, 6 24. Okt 10:58 /dev/hidraw6

You can see that the devices are owned by root and the group root. You will have to change something about this to allow non-root users to access those devices. I will check the wiki of ddcutil what the common way to change this is.

StefanLobbenmeier avatar Oct 24 '20 09:10 StefanLobbenmeier

So using https://www.ddcutil.com/config/#grant-readwrite-permission-for-the-devi2c-n-devices-representing-monitors as a reference what you want to do is:

How to resolve permission denied for non-root users

  1. Add a file with the following line to /etc/udev/rules.d (in case of manjaro / arch you want to create a new file in /etc/udev/rules.d) sudo nano /etc/udev/rules.d/46-logiops-hidraw.rules
  2. content:
# Assigns the hidraw devices to group hidraw, and gives that group RW access:
KERNEL=="hidraw[0-9]*", GROUP="hidraw", MODE="0660"
  1. Add the group hidraw if it does not already exist: sudo groupadd --system hidraw
  2. Add the users who will run logid to that group: sudo usermod -G hidraw -a $USER
  3. Restart

StefanLobbenmeier avatar Oct 24 '20 09:10 StefanLobbenmeier

Afterwards you should see that the devices have the correct group and you no longer get permission denied:

➜  ~ ls -ashl /dev/hidraw*
0 crw-rw---- 1 root hidraw 237, 0 24. Okt 11:32 /dev/hidraw0
0 crw-rw---- 1 root hidraw 237, 1 24. Okt 11:32 /dev/hidraw1
0 crw-rw---- 1 root hidraw 237, 2 24. Okt 11:32 /dev/hidraw2
0 crw-rw---- 1 root hidraw 237, 3 24. Okt 11:32 /dev/hidraw3
0 crw-rw---- 1 root hidraw 237, 5 24. Okt 11:32 /dev/hidraw5
0 crw-rw---- 1 root hidraw 237, 6 24. Okt 11:32 /dev/hidraw6
0 crw-rw---- 1 root hidraw 237, 7 24. Okt 11:32 /dev/hidraw7
0 crw-rw---- 1 root hidraw 237, 8 24. Okt 11:32 /dev/hidraw8
➜  ~ logid
[ERROR] I/O Error while reading /etc/logid.cfg: FileIOException
[INFO] Detected receiver at /dev/hidraw2
[INFO] Device Wireless Mouse MX Master not configured, using default config.
[INFO] Device found: Wireless Mouse MX Master on /dev/hidraw2:1
[INFO] Device Logitech Gaming Keyboard G610 not configured, using default config.
[INFO] Device found: Logitech Gaming Keyboard G610 on /dev/hidraw1:255
[WARN] Error adding device /dev/hidraw3: std::exception
^C

@JCQuintas please let us know if that fixed you issue @PixlOne please consider adding this somewhere in the wiki / readme

StefanLobbenmeier avatar Oct 24 '20 09:10 StefanLobbenmeier

In case someone else stumbles on this issue with the same problem: the logid process also needs write access to /dev/uinput. I'm not sure if this is documented anywhere else, but I found it here.

My complete udev config now looks like this:

KERNEL=="uinput", GROUP="input", MODE:="0660", OPTIONS+="static_node=uinput"
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="046d", MODE="0660", GROUP="input"

I'm using the input group instead of hidraw, as Stefan did. Also it might be worth noting that I don't use Ubuntu, so it may have worked for the previous commenters because Ubuntu could already be shipping something like the first rule.

yrd avatar Sep 26 '21 12:09 yrd