help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

udev rule only works with sudo


From: Chris Keschnat
Subject: udev rule only works with sudo
Date: Sat, 03 Aug 2024 17:33:57 +0200

Hi,
I'm trying to run Vial[1] and am following their guide[2].
To me it seems as if the permissions of the files in =/dev/=
are not set correctly, but I don't know enough about udev to be certain.

System configuration:
#+begin_src scheme
  (define %vial-udev-rule
    (udev-rule
     "99-vial.rules"
     (string-append "KERNEL==\"hidraw*\", SUBSYSTEM==\"hidraw\", "
                    "ATTRS{serial}==\"*vial:f64c2b3c*\", "
                    "MODE=\"0660\", "
                    "GROUP=\"users\", "
                    "TAG+=\"uaccess\", "
                    "TAG+=\"udev-acl\"")))

  ;; ..........
  ;; services
  (udev-rules-service 'vial-thing %vial-udev-rule)
#+end_src

This results in this and is exactly what the guide says it should be:

#+TITLE:/etc/udev/rules.d/90-usb-thing.rules
#+begin_src conf
  KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", 
MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
#+end_src

Now Vial works when run with ~sudo~ (ignoring the xdg- and font-errors):
#+begin_src sh
  ck@brak ~  $ nix-shell -p vial --run "sudo Vial"
  Password:
  QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
  Fontconfig error: Cannot load default config file: No such file: (null)
#+end_src

Without sudo, the program starts, but I cannot see my device and these messages 
are logged:
#+begin_src sh
  ck@brak ~  $ nix-shell -p vial --run "Vial"
  Fontconfig error: Cannot load default config file: No such file: (null)
  INFO:root:Matching VID=5842, PID=4B50, serial=, path=b'/dev/hidraw10' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw10' does not match - usage_page=0001 
usage=06
  INFO:root:Matching VID=5842, PID=4B50, serial=, path=b'/dev/hidraw11' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw11' does not match - usage_page=0001 
usage=02
  INFO:root:Matching VID=5842, PID=4B50, serial=, path=b'/dev/hidraw11' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw11' does not match - usage_page=0001 
usage=01
  INFO:root:Matching VID=5842, PID=4B50, serial=, path=b'/dev/hidraw11' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw11' does not match - usage_page=0001 
usage=80
  INFO:root:Matching VID=5842, PID=4B50, serial=, path=b'/dev/hidraw11' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw11' does not match - usage_page=000C 
usage=01
  INFO:root:Matching VID=5842, PID=4B50, serial=, path=b'/dev/hidraw11' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw11' does not match - usage_page=0001 
usage=06
  INFO:root:Matching VID=5842, PID=4E75, serial=, path=b'/dev/hidraw8' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw8' does not match - usage_page=0001 
usage=06
  INFO:root:Matching VID=5842, PID=4E75, serial=, path=b'/dev/hidraw9' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw9' does not match - usage_page=0001 
usage=02
  INFO:root:Matching VID=5842, PID=4E75, serial=, path=b'/dev/hidraw9' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw9' does not match - usage_page=0001 
usage=01
  INFO:root:Matching VID=5842, PID=4E75, serial=, path=b'/dev/hidraw9' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw9' does not match - usage_page=0001 
usage=80
  INFO:root:Matching VID=5842, PID=4E75, serial=, path=b'/dev/hidraw9' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw9' does not match - usage_page=000C 
usage=01
  INFO:root:Matching VID=5842, PID=4E75, serial=, path=b'/dev/hidraw9' - VIA 
stack
  WARNING:root:is_rawhid: b'/dev/hidraw9' does not match - usage_page=0001 
usage=06
  INFO:root:Matching VID=16C0, PID=27DB, serial=e7:9b:bc:35:76:1e, 
path=b'/dev/hidraw12' - VIA stack
  WARNING:root:is_rawhid: b'/dev/hidraw12' does not match - usage_page=0001 
usage=06
  INFO:root:Matching VID=16C0, PID=27DB, serial=e7:9b:bc:35:76:1e, 
path=b'/dev/hidraw12' - VIA stack
  WARNING:root:is_rawhid: b'/dev/hidraw12' does not match - usage_page=000C 
usage=01
#+end_src

So, should the devices in =/dev/= have other permissions than this? I assume 
~GROUP="users"~ should give my user permission?
#+begin_src sh
  ck@brak ~  $ ll /dev/hidraw*
  crw------- 1 root root 242,  0 03.08.2024 09:03 /dev/hidraw0
  crw------- 1 root root 242,  1 03.08.2024 09:03 /dev/hidraw1
  crw------- 1 root root 242, 10 03.08.2024 09:03 /dev/hidraw10
  crw------- 1 root root 242, 11 03.08.2024 09:03 /dev/hidraw11
  crw------- 1 root root 242, 12 03.08.2024 09:06 /dev/hidraw12
  crw------- 1 root root 242, 13 03.08.2024 15:33 /dev/hidraw13
  crw------- 1 root root 242,  2 03.08.2024 09:03 /dev/hidraw2
  crw------- 1 root root 242,  3 03.08.2024 09:03 /dev/hidraw3
  crw------- 1 root root 242,  4 03.08.2024 09:03 /dev/hidraw4
  crw------- 1 root root 242,  5 03.08.2024 09:03 /dev/hidraw5
  crw------- 1 root root 242,  6 03.08.2024 09:03 /dev/hidraw6
  crw------- 1 root root 242,  7 03.08.2024 09:03 /dev/hidraw7
  crw------- 1 root root 242,  8 03.08.2024 09:03 /dev/hidraw8
  crw------- 1 root root 242,  9 03.08.2024 09:03 /dev/hidraw9
#+end_src

My user:
#+begin_src sh
  ck@brak ~  $ id
  uid=1000(ck) gid=998(users) 
groups=999(wheel),992(video),991(audio),990(netdev),989(lp),975(libvirt),998(users)
#+end_src

PS:
The documentation[3] says:
"The herd rules udev command, as root, returns the name of the directory 
containing all the active udev rules."

This does not work on my machine. I don't know if the documentation is outdated 
or if there is something wrong on my system:
#+begin_src sh
  ck@brak ~  $ sudo herd rules udev
  herd: error: service 'udev' does not have an action 'rules'
  # same as root
  ck@brak ~  $ sudo su -
  Password:
  root@brak ~# herd rules udev
  herd: error: service 'udev' does not have an action 'rules'
#+end_src


[1] https://get.vial.today/
[2] https://get.vial.today/manual/linux-udev.html
[3] https://guix.gnu.org/manual/en/html_node/Base-Services.html


Thank you
Chris



reply via email to

[Prev in Thread] Current Thread [Next in Thread]