Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Invalid sensor entry" on "chip" keyword #229

Open
nozwock opened this issue Jun 15, 2023 · 17 comments
Open

"Invalid sensor entry" on "chip" keyword #229

nozwock opened this issue Jun 15, 2023 · 17 comments
Labels
enhancement Idea for an improvement or a new feature

Comments

@nozwock
Copy link

nozwock commented Jun 15, 2023

ERROR: /etc/thinkfan.yaml:56:
  - chip: thinkpad-isa-0000
    ^
Invalid sensor entry.

Using the sample yaml config.

Installed aur/thinkfan 1.3.1-1

@vmatare
Copy link
Owner

vmatare commented Jun 16, 2023

First thing I'd normally suspect is that USE_LM_SENSORS has been disabled at compile time. But I don't know how to find out if that's the case or not if you're using an arch package.

@vmatare
Copy link
Owner

vmatare commented Jun 16, 2023

I guess I could implement checks for disabled features that would give a more helpful error message in that kind of situation...

@vmatare vmatare added the enhancement Idea for an improvement or a new feature label Jun 16, 2023
@vmatare vmatare changed the title Invalid sensor entry "Invalid sensor entry" on "chip" keyword Jun 16, 2023
@nozwock
Copy link
Author

nozwock commented Jun 16, 2023

First thing I'd normally suspect is that USE_LM_SENSORS has been disabled at compile time. But I don't know how to find out if that's the case or not.

I'll try compiling myself with that flag.

@nozwock
Copy link
Author

nozwock commented Jun 16, 2023

It worked after adding the USE_LM_SENSORS flag. Weird, since this flag is ON by default.
cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_LM_SENSORS:BOOL=ON -DUSE_NVML:BOOL=OFF

AUR PKGBUILD Fix

diff --git a/PKGBUILD b/PKGBUILD
index 3d7eaf2..86cadc6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -24,7 +24,7 @@ install=thinkfan.install
 build() {
   cd "$srcdir/$pkgname-$pkgver"
 
-  cmake . -DCMAKE_INSTALL_PREFIX=/usr -DUSE_ATASMART:BOOL=ON
+  cmake . -DCMAKE_INSTALL_PREFIX=/usr -DUSE_ATASMART:BOOL=ON -DUSE_LM_SENSORS:BOOL=ON
   make
 }
 

I think the flag may not have been available at the time of the latest tag release, hence the issues?

@nozwock
Copy link
Author

nozwock commented Jun 16, 2023

Now I'm getting

ERROR: /etc/thinkfan.yaml:136:
  - hwmon: /sys/class/hwmon/hwmon0/pwm1
  ^
When multiple fans are configured, each must have its own 'levels:' section.

What should I do?

thinkfan.yaml

##############################################################################
# thinkfan Example Config File
# ============================
#
# Please read the config manpage thinkfan.conf(5) before playing around with
# this.
#
# This is NOT a working config file that can just be copied. It is only meant
# to give a rough idea what can be done. In particular, don't copy & paste the
# fan speed config! Think about what you're doing.
#
# If you don't know what temperatures are right for your system, you should
# not be using thinkfan!
##############################################################################


##############################################################################
# Sensor Drivers and Temperature Inputs
# =====================================
#
# ATTENTION: The order in which sensors are specified here is significant when
# specifying the fan speeds further below!
#
# There are multiple ways in which a temperature input can be specified. An
# example for each is given below.
#
# The "correction:" and "optional:" keywords may be specified on any type of
# sensor.

sensors:
  # LM Sensors
  # ==========
  # Temperatures can be read directly from Linux drivers through the LM sensors.
  #
  # To configure this, install "lm-sensors" and "libsensors", then
  # run "sensors-detect", then run "sensors".
  # To build thinkfan from sources, you'll also need to install "libsensors-dev"
  # or equivalent package for your distribution.
  #
  # For example, the following output of "sensors":
  # ...
  # thinkpad-isa-0000
  # Adapter: ISA adapter
  # fan1:        2618 RPM
  # fan2:        2553 RPM
  # CPU:          +63.0 C  
  # GPU 1:        +55.0 C  
  # temp3:        +68.0 C  
  # temp4:         +0.0 C  
  # temp5:        +60.0 C  
  # temp6:        +64.0 C  
  # temp7:        +67.0 C  
  # temp8:         +0.0 C  
  # ...
  # would result in the following configuration:
  - chip: zenpower-pci-00c3
    ids: [ Tctl ]

  # hwmon: Full path to a temperature file (single sensor).
  # =======================================================
  # Disadvantage is that the index in "hwmon0" depends on the load order of
  # the driver modules, which may change across bootups on some systems.
  - hwmon: /sys/class/hwmon/hwmon0/temp1_input

  # hwmon: Path to a complete driver folder
  # =======================================
  # Individual sensors need to be picked out with the "indices:" keyword.
  # This can be used with a stable path that does not depend on driver load
  # order. However certain drivers may not appear under such a stable path.
  - hwmon: /sys/devices/pci0000:00/0000:00:03.1/0000:27:00.0/hwmon
    indices: [1, 2, 5, 6] # adds 4 temperature sensors
    correction: [0, 0, 0, -5] # add -5 °C to temp6_input

  # hwmon: Base path with name-based search
  # =======================================
  # Thinkfan will search under the given path for a hwmon driver that has a
  # file called "name" which contains the given name. This method should work
  # with all hwmon drivers and is robust against driver load order.
  - hwmon: /sys/class/hwmon
    name: k10temp
    indices: [1]

  # Sensors can also be optional, e.g. in case of removable hardware
  - hwmon: /sys/class/block/sdc/device/hwmon
    indices: [1]
    optional: true # don't exit if the sensor can't be read

  # atasmart: Read the temperature from a hard disk via S.M.A.R.T
  # =============================================================
  # Note that this is unreasonably CPU-intensive. Since Linux 5.6, the kernel
  # can report the temperatures of hard disks via the hwmon interface (see the
  # example above), which should be preferred if available.
  #
  # This is only available if thinkfan was compiled with USE_ATASMART enabled.
  # - atasmart: /dev/sda

  # tpacpi: Legacy interface to the thinkpad_acpi driver
  # ====================================================
  # Particularly on older Thinkpad laptops, this interface may give access to
  # 8-16 temperature sensors, but it may be hard to tell where/what exactly
  # they measure.
  # Some documentation for older models may be found at the thinkpad wiki:
  # https://www.thinkwiki.org/wiki/Thermal_Sensors
  #
  # Note that the hwmon interface is to be preferred nowadays.
  - tpacpi: /proc/acpi/ibm/thermal
    # Some of the temperature entries in /proc/acpi/ibm/thermal may be
    # irrelevant or unused, so individual ones can be selected:
    indices: [1, 2, 3, 4]

  # nvml: The proprietary nVidia driver
  # ===================================
  # Temperatures can be read directly from nVidia GPUs that run with the
  # proprietary driver. The "nvml:" entry must specify the PCI bus ID of the
  # GPU (can be found with lspci)
  #
  # Note that this does not work with the open-source "nouveau" driver. Open
  # source drivers should support the hwmon interface instead (see above).
  # - nvml: 27:00.0

##############################################################################


##############################################################################
# Fan Drivers
# ===========
#
# Currently, thinkfan supports only one fan, but support for multiple fans is
# in development and will be released soon. For the time being, the examples
# given below are mutually exclusive.
#
fans:
  # hwmon: Full path to a PWM file
  # ==============================
  # Also subject to the potential problem with driver load order (see above)
  - hwmon: /sys/class/hwmon/hwmon0/pwm1

  # hwmon: Path to a complete driver folder
  # =======================================
  - hwmon: /sys/class/graphics/fb0/device/hwmon
    indices: [1] # Use pwm1

  # hwmon: Base path with name-based search
  # =======================================
  - hwmon: /sys/class/hwmon
    name: amdgpu
    indices: [1]

  # tpacpi: Thinkpad-specific fan interface
  # =======================================
  # Currently, this is the only way to use disengaged and automatic mode on
  # thinkpads.
  - tpacpi: /proc/acpi/ibm/fan

##############################################################################


##############################################################################
# Fan Speeds (simple mode)
# ========================
# 
# In simple mode, each entry is a [FANSPEED, LOWER_LIMIT, UPPER_LIMIT] tuple.
# This is a quick way to configure a small system like a laptop, where the
# temperature ratings for all monitored devices are similar. Only the highest
# temperature found across all sensors will be compared against these limits.
# All other temperatures are ignored.
#
# Correction values on individual sensors (see above) may be used to equalize
# small discrepancies in temperature ratings.
#
# The FANSPEED values in this example are valid for the thinkpad_acpi fan
# driver only (see above)
#
levels:
  - [0, 0, 50]
  - ["level auto", 45, 75]
  - ["level disengaged", 70, 255]

##############################################################################


##############################################################################
# Fan Speeds (detailed mode)
# ==========================
#
# It is generally advisable to configure the temperature limits for each
# sensor individually.
#
# The speed values used here range from 0 to 255, which is valid for the PWM
# control files used by hwmon-based drivers.
#
# The temperatures specified in upper_limit and lower_limit apply to the
# sensors in the same order in which they were specified in the "sensors:"
# section above, and their length must match the total number of sensors that
# have been configured.
#
levels:
  - speed: 0
    upper_limit: [50, 50, 50]

  - speed: 100
    lower_limit: [45, 45, 45]
    upper_limit: [65, 65, 65]

  - speed: 255
    lower_limit: [60, 60, 60]

##############################################################################


@nozwock
Copy link
Author

nozwock commented Jun 16, 2023

But I don't know how to find out if that's the case or not if you're using an arch package.

You could just view the PKGBUILD here https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=thinkfan
But I just realized that the package was not submitted by you, so ye.

@nozwock
Copy link
Author

nozwock commented Jun 16, 2023

Ok, now it's working, but the fans aren't starting above 50c. Am I doing it wrong?

$ sudo thinkfan
[sudo] password for nozwock:

Daemon PID: 194920
thinkfan.yaml

##############################################################################
# thinkfan Example Config File
# ============================
#
# Please read the config manpage thinkfan.conf(5) before playing around with
# this.
#
# This is NOT a working config file that can just be copied. It is only meant
# to give a rough idea what can be done. In particular, don't copy & paste the
# fan speed config! Think about what you're doing.
#
# If you don't know what temperatures are right for your system, you should
# not be using thinkfan!
##############################################################################


##############################################################################
# Sensor Drivers and Temperature Inputs
# =====================================
#
# ATTENTION: The order in which sensors are specified here is significant when
# specifying the fan speeds further below!
#
# There are multiple ways in which a temperature input can be specified. An
# example for each is given below.
#
# The "correction:" and "optional:" keywords may be specified on any type of
# sensor.

sensors:
  # LM Sensors
  # ==========
  # Temperatures can be read directly from Linux drivers through the LM sensors.
  #
  # To configure this, install "lm-sensors" and "libsensors", then
  # run "sensors-detect", then run "sensors".
  # To build thinkfan from sources, you'll also need to install "libsensors-dev"
  # or equivalent package for your distribution.
  #
  # For example, the following output of "sensors":
  # ...
  # thinkpad-isa-0000
  # Adapter: ISA adapter
  # fan1:        2618 RPM
  # fan2:        2553 RPM
  # CPU:          +63.0 C  
  # GPU 1:        +55.0 C  
  # temp3:        +68.0 C  
  # temp4:         +0.0 C  
  # temp5:        +60.0 C  
  # temp6:        +64.0 C  
  # temp7:        +67.0 C  
  # temp8:         +0.0 C  
  # ...
  # would result in the following configuration:
  - chip: zenpower-pci-00c3
    ids: [ Tctl ]

  # hwmon: Full path to a temperature file (single sensor).
  # =======================================================
  # Disadvantage is that the index in "hwmon0" depends on the load order of
  # the driver modules, which may change across bootups on some systems.
  # - hwmon: /sys/class/hwmon/hwmon0/temp1_input

  # hwmon: Path to a complete driver folder
  # =======================================
  # Individual sensors need to be picked out with the "indices:" keyword.
  # This can be used with a stable path that does not depend on driver load
  # order. However certain drivers may not appear under such a stable path.
  # - hwmon: /sys/devices/pci0000:00/0000:00:03.1/0000:27:00.0/hwmon
  #   indices: [1, 2, 5, 6] # adds 4 temperature sensors
  #   correction: [0, 0, 0, -5] # add -5 °C to temp6_input

  # hwmon: Base path with name-based search
  # =======================================
  # Thinkfan will search under the given path for a hwmon driver that has a
  # file called "name" which contains the given name. This method should work
  # with all hwmon drivers and is robust against driver load order.
  # - hwmon: /sys/class/hwmon
  #   name: k10temp
  #   indices: [1]

  # Sensors can also be optional, e.g. in case of removable hardware
  - hwmon: /sys/class/block/sdc/device/hwmon
    indices: [1]
    optional: true # don't exit if the sensor can't be read

  # atasmart: Read the temperature from a hard disk via S.M.A.R.T
  # =============================================================
  # Note that this is unreasonably CPU-intensive. Since Linux 5.6, the kernel
  # can report the temperatures of hard disks via the hwmon interface (see the
  # example above), which should be preferred if available.
  #
  # This is only available if thinkfan was compiled with USE_ATASMART enabled.
  # - atasmart: /dev/sda

  # tpacpi: Legacy interface to the thinkpad_acpi driver
  # ====================================================
  # Particularly on older Thinkpad laptops, this interface may give access to
  # 8-16 temperature sensors, but it may be hard to tell where/what exactly
  # they measure.
  # Some documentation for older models may be found at the thinkpad wiki:
  # https://www.thinkwiki.org/wiki/Thermal_Sensors
  #
  # Note that the hwmon interface is to be preferred nowadays.
  - tpacpi: /proc/acpi/ibm/thermal
    # Some of the temperature entries in /proc/acpi/ibm/thermal may be
    # irrelevant or unused, so individual ones can be selected:
    indices: [1, 2, 3, 4]

  # nvml: The proprietary nVidia driver
  # ===================================
  # Temperatures can be read directly from nVidia GPUs that run with the
  # proprietary driver. The "nvml:" entry must specify the PCI bus ID of the
  # GPU (can be found with lspci)
  #
  # Note that this does not work with the open-source "nouveau" driver. Open
  # source drivers should support the hwmon interface instead (see above).
  # - nvml: 27:00.0

##############################################################################


##############################################################################
# Fan Drivers
# ===========
#
# Currently, thinkfan supports only one fan, but support for multiple fans is
# in development and will be released soon. For the time being, the examples
# given below are mutually exclusive.
#
fans:
  # hwmon: Full path to a PWM file
  # ==============================
  # Also subject to the potential problem with driver load order (see above)
  # - hwmon: /sys/class/hwmon/hwmon0/pwm1

  # hwmon: Path to a complete driver folder
  # =======================================
  # - hwmon: /sys/class/graphics/fb0/device/hwmon
  #   indices: [1] # Use pwm1

  # hwmon: Base path with name-based search
  # =======================================
  # - hwmon: /sys/class/hwmon
  #   name: amdgpu
  #   indices: [1]

  # tpacpi: Thinkpad-specific fan interface
  # =======================================
  # Currently, this is the only way to use disengaged and automatic mode on
  # thinkpads.
  - tpacpi: /proc/acpi/ibm/fan

##############################################################################


##############################################################################
# Fan Speeds (simple mode)
# ========================
# 
# In simple mode, each entry is a [FANSPEED, LOWER_LIMIT, UPPER_LIMIT] tuple.
# This is a quick way to configure a small system like a laptop, where the
# temperature ratings for all monitored devices are similar. Only the highest
# temperature found across all sensors will be compared against these limits.
# All other temperatures are ignored.
#
# Correction values on individual sensors (see above) may be used to equalize
# small discrepancies in temperature ratings.
#
# The FANSPEED values in this example are valid for the thinkpad_acpi fan
# driver only (see above)
#
levels:
  - [0, 0, 50]
  - ["level auto", 45, 75]
  - ["level disengaged", 70, 255]

##############################################################################


##############################################################################
# Fan Speeds (detailed mode)
# ==========================
#
# It is generally advisable to configure the temperature limits for each
# sensor individually.
#
# The speed values used here range from 0 to 255, which is valid for the PWM
# control files used by hwmon-based drivers.
#
# The temperatures specified in upper_limit and lower_limit apply to the
# sensors in the same order in which they were specified in the "sensors:"
# section above, and their length must match the total number of sensors that
# have been configured.
#
# levels:
#   - speed: 0
#     upper_limit: [50, 50, 50]
#
#   - speed: 100
#     lower_limit: [45, 45, 45]
#     upper_limit: [65, 65, 65]
#
#   - speed: 255
#     lower_limit: [60, 60, 60]

##############################################################################

@nozwock
Copy link
Author

nozwock commented Jun 16, 2023

Ok, nvm I manged to make it work.

levels:
  # - [0, 0, 50]
  - ["level 0", 0, 50]
  - ["level 2", 50, 60]
  - ["level 4", 60, 70]
  - ["level disengaged", 70, 255]

Thanks for the project, you can close the issue now if you'd like.

@jpsutton
Copy link

jpsutton commented Sep 17, 2023

It appears that USE_LM_SENSORS wasn't added until after the current release (1.3.1) was tagged. That being said, the fix applied to the AUR PKGBUILD mentioned above doesn't work; you'll see the following during the build process...

CMake Warning:
  Manually-specified variables were not used by the project:

    USE_LM_SENSORS

@vmatare it's been a more than a year since a release. Is there anything holding that up?

@nozwock
Copy link
Author

nozwock commented Sep 17, 2023

@jpsutton The flag was probably added after the latest tagged release. It's available on main.

thinkfan/CMakeLists.txt

Lines 47 to 50 in b1ad819

#
# Defaults to ON.
#
option(USE_LM_SENSORS "Get temperatures from LM sensors" ON)

@jpsutton
Copy link

Yes, that's what I was saying. The question is, is there anything holding up a new release version tag? Having a newer tagged version would cause this feature to make it's way into distro packages (or in my case, at least into AUR), so that we don't have to manually build from main.

@donalffons
Copy link

Thank you for this project! @vmatare it would be great for all arch users if a new tag / minor version could be released including that change.

@donalffons
Copy link

donalffons commented Mar 23, 2024

Just found out that thinkfan-git exists in AUR, which does solve this problem for me. Still, I think it would be great, if this fix would be released.

@techeddie
Copy link

Just found out that thinkfan-git exists in AUR, which does solve this problem for me. Still, I think it would be great, if this fix would be released.

With thinkfan-git it is working for me as well with the thinkfan.yaml file.

@bakkerthehacker
Copy link

Still waiting for a real release for debian/ubuntu. The sources here are still missing lmsensors support.

I did get a .deb built using the following steps:

  • apt-get source thinkfan
  • manually replace the archive with master
  • remove patches 004 through 007
  • dpkg-source --no-check -x thinkfan_1.3.1-4build1.dsc
  • dch -i with a modified version number
  • debuild -us -uc -b

Not great, and its using custom release numbers but it does work with lmsensors now.

@tova-cup
Copy link

Hi @bakkerthehacker

Would you mind sharing your compiled .deb ?

I'm struggling to reproduce your process.

@bakkerthehacker
Copy link

bakkerthehacker commented Sep 3, 2024

https://github.com/bakkerthehacker/thinkfan/releases/tag/1.3.2-custom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea for an improvement or a new feature
Projects
None yet
Development

No branches or pull requests

7 participants