Skip to content

Custom sensors in sensors.d/ can never pass the -x check because the directory lives on the flash boot device #9

Description

@shomilsaini

Custom sensors in sensors.d/ can never pass the -x check because the directory lives on the flash boot device

Description

aux_sensors.sh reads custom sensor scripts from fcp_custom_sensor_dir, which defaults to /boot/config/plugins/fanctrlplus2/sensors.d:

fcp_custom_sensor_dir="${fcp_custom_sensor_dir:-/boot/config/plugins/fanctrlplus2/sensors.d}"

Before running a candidate script, it gates on a real executable bit:

[[ "${BASH_REMATCH[1]}" == .* || ! -x "$script" ]] && return 0

Unraid's flash boot device is FAT32, and since ~2020 Unraid has deliberately disabled setting the execute permission on files stored there as a flash-drive security hardening measure (chmod +x reports success but is silently a no-op; ls -la confirms the file stays -rw-------). This means [[ -x "$script" ]] will always evaluate false for any file placed in the documented sensors.d/ path, so custom sensors can never appear as selectable, regardless of what the user does with permissions.

Steps to reproduce

  1. Place an executable shell script in /boot/config/plugins/fanctrlplus2/sensors.d/ per the plugin's own docs.
  2. chmod +x the file (reports no error).
  3. ls -la the directory — permissions show -rw-------, not -rwxr-xr-x.
  4. The sensor never appears as selectable in the plugin UI, and [[ -x "$script" ]] in aux_sensors.sh will always be false for this path.

Expected

A correctly-written script dropped in sensors.d/ per the documented contract (prints Celsius, exits non-zero on error) becomes a selectable sensor.

Actual

The sensor never appears, silently, with no error surfaced to the user — because the exec-bit test can never pass on a flash-resident file.

Suggested fix

Either:

  • (a) drop the -x requirement and just attempt to run the file directly with bash "$script" / sh "$script" regardless of its permission bits, since the shebang/interpreter can be invoked without an exec bit, or
  • (b) have the plugin sync sensors.d/ into a writable runtime location (e.g. under /usr/local/emhttp/plugins/fanctrlplus2/, where the rest of the plugin's scripts already live with real -rwxr-xr-x permissions) at service start, and read from there instead of directly off /boot.

Environment

  • Unraid version: [v7.3.2]
  • FanCtrl Plus 2 version: [v1.8.3]
  • Custom sensor script location: /boot/config/plugins/fanctrlplus2/sensors.d/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions