--- Begin Message ---
Subject: |
Reloading udev rules requires a system restart |
Date: |
Fri, 09 Apr 2021 18:05:37 -0400 |
Hello Guix!
Using Guix System, after adding a new rule to the configuration of their
udev-service-type service, the only ways to get the new rule into effect
are to either:
1. restart udev
(which is almost the same as a reboot, bringing down your graphical session)
2. restart the operating system
Both of which are sub-optimal.
This is caused by the configuration file/rules being made known to udev
via environment variables:
$ sudo cat /proc/$(pgrep udev)/environ | xargs -0 -n1 echo
UDEV_CONFIG_FILE=/gnu/store/7yfpf8acjy884xbwaq5kn9z21irchfaj-udev.conf
EUDEV_RULES_DIRECTORY=/gnu/store/yv58b7rg7dm3191cj6sma896550wgy4v-udev-rules/lib/udev/rules.d
LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
PATH=/run/current-system/profile/bin
For convenience, we should probably have the udev-service-type create a
union of what it needs under /etc/udev/ as on other distributions. udev
could then rely on a fixed location to look things and use its inotify
based mechanism to detect changes and reload automatically when needed.
This could probably fix things such as 'udevadm test' only reading rule
files from under
/gnu/store/svplp9wl0g2ahlv5rf6bhmq3xvp4zzh3-eudev-3.2.9/lib/udev/rules.d,
for example.
Thank you,
Maxim
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#47681: Reloading udev rules requires a system restart |
Date: |
Sun, 20 Feb 2022 20:43:40 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hello,
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
> Fixes <https://issues.guix.gnu.org/47681>.
>
> This change adjusts the location of the udev configuration file and rules
> directory to a fixed location. Since udev relies on inotify to discover
> change to its rules directory (/etc/udev/rules.d), by using a fixed directory
> layout, new udev rules can be automatically picked up without restarting the
> service.
>
> * gnu/services/base.scm (udev-rules-union): Build rules output directly
> in #$output.
> (udev-shepherd-service)[start]: Adjust the UDEV_CONFIG_FILE and
> EUDEV_RULES_DIRECTORY environment variables.
> [actions]: Remove field. The 'rules' action is no longer useful.
> (udev.conf): New variable.
> (udev-etc): New procedure.
> (udev-service-type): Extend the etc-service-type with it.
Pushed with commit e9fa17eb98efbd6211ab44ab49b8c078d4b73e04.
Closing.
Maxim
--- End Message ---