More
referral
Increase your income with Hive. Invite your friends and earn real cryptocurrency!

Case fan control with lm-sensor and fancontrol - no gpu temp?

Hello,

I have installed lm-sensor and fancontrol. With fancontrol, I can configure the case fans. Unfortunately, I cannot set the GPU temperature as the target value, as lm-sensor does not read the graphics card temperatures. This only works with nvidia-smi. How can I make the GPU temperatures show up in lm-sensors so I can configure them with fancontrol?

Thank you!

While i dont have an answer to your exact question, you could use something like a coolbox ii (~$30) that has full integration into hive to control case fans

I found a solution! Here’s my workaround:

Instructions for Displaying GPU Temperatures and Names using lm-sensors

  1. Install nvidia-settings (if not already installed)
    Make sure the NVIDIA driver package is installed since nvidia-settings is part of it. On most Linux distributions, you can install it with the package manager:
sudo apt install nvidia-settings
  1. Load the nvidia module
    Ensure the nvidia kernel module is loaded. This is usually done automatically if you are using the proprietary NVIDIA driver. Otherwise, you can load it manually:
sudo modprobe nvidia
  1. Create an Alias for sensors
    To combine the output of sensors and nvidia-smi, add an alias that displays both sensors and GPU information in the desired format.Open your shell configuration file (e.g., ~/.bashrc or ~/.zshrc) and add the following alias:
alias sensors="sensors && nvidia-smi --query-gpu=name,temperature.gpu --format=csv,noheader | awk -F ',' '{printf \"GPU: %s - Temperature: %s°C\\n\", \$1, \$2}'"

This command queries the GPU name and temperature and formats the output to show the GPU name and temperature.

  1. Reload the Shell Configuration
    Save the changes and reload the configuration file:
source ~/.bashrc  # or source ~/.zshrc
  1. Use the New sensors Command
    Now, when you run the sensors command, it will display the standard lm-sensors output along with your GPUs’ names and temperatures in the format GPU: <Name> - Temperature: <Value>°C.
1 Like

Add Alias Permanently to ~/.bashrc

Ensure that the alias command is included in the ~/.bashrc file, as this file is loaded with each new interactive session:

alias sensors="sensors && nvidia-smi --query-gpu=name,temperature.gpu --format=csv,noheader | awk -F ',' '{printf \"GPU: %s - Temperature: %s°C\\n\", \$1, \$2}'"

This step is already set, but we will make some additional adjustments to ensure the alias truly loads on each startup.

Ensure Loading of ~/.bashrc in All Environments

The ~/.bashrc file may not be loaded in every new session. However, we can make sure it is included in all shell sessions:

Open ~/.bash_profile (or create it if it doesn’t exist):

nano ~/.bash_profile

Add the following lines to ensure that ~/.bashrc is loaded every time you log in:

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

This will ensure that ~/.bashrc is loaded in new sessions or after a reboot.

1 Like