all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* udev rule only works with sudo
@ 2024-08-03 15:33 Chris Keschnat
  2024-08-04  5:51 ` Felix Lechner via
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Keschnat @ 2024-08-03 15:33 UTC (permalink / raw)
  To: help-guix


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udev rule only works with sudo
  2024-08-03 15:33 udev rule only works with sudo Chris Keschnat
@ 2024-08-04  5:51 ` Felix Lechner via
  2024-08-04  7:55   ` Chris Keschnat
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Lechner via @ 2024-08-04  5:51 UTC (permalink / raw)
  To: Chris Keschnat, help-guix

Hi Chris,

On Sat, Aug 03 2024, Chris Keschnat wrote:

>   KERNEL=="hidraw*", SUBSYSTEM=="hidraw",
>   ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users",
>   TAG+="uaccess", TAG+="udev-a

>   crw------- 1 root root 242,  0 03.08.2024 09:03 /dev/hidraw0 

With the group at 'root', are you sure the rule ran at all?

It didn't for me [1] but a one-liner fixed it. [2] Unfortunately, the
patch was not accepted.

I'd be curious to know if the patch works for you.

Kind regards
Felix

[1] https://issues.guix.gnu.org/63787
[2] https://issues.guix.gnu.org/63508#18


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udev rule only works with sudo
  2024-08-04  5:51 ` Felix Lechner via
@ 2024-08-04  7:55   ` Chris Keschnat
  2024-08-05 18:53     ` Felix Lechner via
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Keschnat @ 2024-08-04  7:55 UTC (permalink / raw)
  To: help-guix

Felix Lechner <felix.lechner@lease-up.com> writes:

>>   crw------- 1 root root 242,  0 03.08.2024 09:03 /dev/hidraw0
>
> With the group at 'root', are you sure the rule ran at all?

You are right. It did not occur to me to even try without the udev
rules. I removed them and Vial still works fine as root.

>
> It didn't for me [1] but a one-liner fixed it. [2] Unfortunately, the
> patch was not accepted.
>
> I'd be curious to know if the patch works for you.
>
> Kind regards
> Felix
>
> [1] https://issues.guix.gnu.org/63787
> [2] https://issues.guix.gnu.org/63508#18

I will try, but I have never customized a package.
I think I will need to read through "Package Transformation Options"[1].
Could take a while :)


[1] https://guix.gnu.org/manual/en/html_node/Package-Transformation-Options.html

Thanks
Chris


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udev rule only works with sudo
  2024-08-04  7:55   ` Chris Keschnat
@ 2024-08-05 18:53     ` Felix Lechner via
  0 siblings, 0 replies; 4+ messages in thread
From: Felix Lechner via @ 2024-08-05 18:53 UTC (permalink / raw)
  To: Chris Keschnat, help-guix

Hi Chris,

On Sun, Aug 04 2024, Chris Keschnat wrote:

> I will try, but I have never customized a package.

No need.  Just customize your Guix executable by applying the three
patches.

The 'eudev' package is a prerequsite for many others, so reconfiguring
your system will rebuild a lot.  I wish I could offer you my
substitutes.

Kind regards
Felix


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-05 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-03 15:33 udev rule only works with sudo Chris Keschnat
2024-08-04  5:51 ` Felix Lechner via
2024-08-04  7:55   ` Chris Keschnat
2024-08-05 18:53     ` Felix Lechner via

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.