z13ctl setup generates a udev rule in /etc/udev/rules.d/99-z13ctl.rules for
the ppt_* TDP power-limit sysfs attributes:
ACTION=="add", SUBSYSTEM=="platform", KERNEL=="asus-nb-wmi", RUN+="/bin/sh -c 'for f in /sys/devices/platform/asus-nb-wmi/ppt_*; do [ -e "$f" ] && chgrp users "$f" && chmod g+w "$f"; done'"
This fires on the add uevent of the asus-nb-wmi platform device itself,
but the ppt_* sysfs attribute files are created by the driver a moment
after that add event — attribute-group creation doesn't emit its own
uevent. So the loop's [ -e "$f" ] check is always false at the moment the
rule runs, the whole script exits 1, and the files are left root:root 644
instead of root:users 664.
Reproduce:
journalctl -b 0 | grep 'asus-nb-wmi.*failed with exit code'
# asus-nb-wmi: Process '/bin/sh -c 'for f in .../ppt_*; ...'' failed with exit code 1.
ls -l /sys/devices/platform/asus-nb-wmi/ppt_*
# -rw-r--r-- 1 root root ... (should be root:users, g+w)
Effect: TDP control via z13ctl silently doesn't work for non-root users
after every boot, since the group/perm rule never actually applies.
Fix that worked for me: poll briefly for the first ppt_ attribute to exist
before doing the chgrp/chmod, e.g.:
RUN+="/bin/sh -c 'i=0; while [ $$i -lt 20 ]; do [ -e /sys/devices/platform/asus-nb-wmi/ppt_apu_sppt ] && break; sleep 0.1; i=$$((i+1)); done; for f in /sys/devices/platform/asus-nb-wmi/ppt_*; do [ -e "$$f" ] && chgrp users "$$f" && chmod g+w "$$f"; done'"
(waits up to 2s for the driver to finish creating the attribute group).
Environment: z13ctl 1.1.6, Debian/Ubuntu-based, ROG Flow Z13.
z13ctl setupgenerates a udev rule in/etc/udev/rules.d/99-z13ctl.rulesforthe
ppt_*TDP power-limit sysfs attributes:This fires on the
adduevent of theasus-nb-wmiplatform device itself,but the
ppt_*sysfs attribute files are created by the driver a momentafter that add event — attribute-group creation doesn't emit its own
uevent. So the loop's
[ -e "$f" ]check is always false at the moment therule runs, the whole script exits 1, and the files are left
root:root 644instead of
root:users 664.Reproduce:
Effect: TDP control via z13ctl silently doesn't work for non-root users
after every boot, since the group/perm rule never actually applies.
Fix that worked for me: poll briefly for the first ppt_ attribute to exist
before doing the chgrp/chmod, e.g.:
(waits up to 2s for the driver to finish creating the attribute group).
Environment: z13ctl 1.1.6, Debian/Ubuntu-based, ROG Flow Z13.