Skip Navigation
Linux 101 stuff. Questions are encouraged, noobs are welcome! @lemmy.world squid_slime @lemmy.world

[Resolved (i hope)] in need of help with udev rule

Edit: Go to bottom to read resolution:

am trying to make a stable link to read t-sensor

$ sudo nano /etc/udev/rules.d/t_sensor-temp-stable-path.rules
ACTION=="add", SUBSYSTEM=="hwmon", KERNEL=="hwmon*", ENV{HWMON_NAME}=="asusec", SYMLINK+="t_sensor_temp", RUN+="/bin/sh -c 'ln -s /sys/class/hwmon/%k/temp2_input /dev/t_sensor_temp'"
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger

expected result, t-sensor temp2_input file is now linked in /dev/t_sensor_temp

actual result no link in /dev

 $ cat /dev/t_sensor_temp
cat: /dev/t_sensor_temp: No such file or directory

even after rebooting,and running $ sudo udevadm control --reload-rules $ sudo udevadm trigger its still failing to create link.

i have stable links in /dev for gpu and cpu which work perfectly

Edit: so i may of resolved the issue and am adding this to maybe help others in the future worth noting i preface "may of" as im not sure if when a hardware change acures that udev will continue to link to hwmon* temp2_input

i first changed the rule

 ACTION=="add", SUBSYSTEM=="hwmon", ATTRS{name}=="asusec", SYMLINK+="t_sensor_temp", RUN+="/bin/sh -c 'ln -s /sys/class/hwmon/%k/temp2_input /dev/t_sensor_temp'"

kernel is now not present, "ENV{HWMON}" is now "ATTRS{name}" but with these edits the link still was not created. once i ran the command sudo udevadm trigger --action=add --subsystem-match=hwmon --attr-match=name=asusec then the symbolic link was created. its been frustrating but glad we got the in the end.

if someone can shine a light on the strange behavior that would be great.

6
6 comments
6 comments