AMD GPU Fan Control On Ubuntu 16.04: A Comprehensive Guide

by Kenji Nakamura 59 views

Hey everyone! 👋 Today, we're diving deep into a common issue faced by many AMD GPU users on Ubuntu 16.04: fan control. Specifically, we're addressing the situation where the GPU fan doesn't spin, which can lead to overheating and performance throttling. If you've got an R9 380X or a similar card and you're running the AMDGPU driver, this guide is for you. We'll explore the reasons behind this behavior and, more importantly, provide you with effective solutions to regain control over your GPU fan. Let's get started!

Understanding the Issue: Why Isn't My AMD GPU Fan Spinning?

Okay, guys, let's break down why your AMD GPU fan might be stubbornly refusing to spin. The first thing to understand is that modern GPUs are designed with power efficiency and noise reduction in mind. This means the fan won't always be spinning at full speed, or even at all! Many cards have a zero-RPM mode, where the fans remain inactive until the GPU temperature reaches a certain threshold. This threshold is usually around 60°C (140°F). So, before you panic, make sure your GPU is actually getting hot enough to warrant fan activity.

However, if you're playing a demanding game or running a graphically intensive application, and your GPU temperature is clearly rising, the fan should kick in. If it's not, that's when we have a problem. There are a few potential culprits here:

  1. Driver Issues: This is a big one. The AMDGPU driver, while generally reliable, can sometimes have hiccups with fan control. It might not be properly detecting the temperature sensors or sending the correct signals to the fan controller.
  2. Configuration Problems: Sometimes, the fan control settings aren't configured correctly within the operating system. This could be due to a missing configuration file or incorrect parameters.
  3. Hardware Problems: While less common, there's always a chance of a hardware issue. The fan itself could be faulty, or there might be a problem with the fan controller on the GPU.
  4. Ubuntu 16.04 Specifics: Ubuntu 16.04, while a solid operating system, is a bit older now. Newer GPUs and drivers might not always play perfectly with it, leading to compatibility issues.

Now that we've identified the potential causes, let's move on to the solutions!

Solutions for AMD GPU Fan Control on Ubuntu 16.04

Alright, let's get our hands dirty and try some solutions to get that fan spinning! We'll start with the most common and easiest fixes and then move on to more advanced techniques if needed.

1. Checking GPU Temperature and Fan Speed

Before we start tweaking things, let's confirm that the fan isn't spinning and that the GPU temperature is indeed high. We can use a few command-line tools for this. Open your terminal (Ctrl+Alt+T) and let's get started.

  • aticonfig (if you have the legacy AMD drivers): This command can give you a basic overview of your GPU. However, it's less relevant for the AMDGPU driver.
  • rocm-smi (if you have ROCm installed): If you're using ROCm for compute workloads, this tool provides detailed GPU information, including temperature and fan speed.
  • sensors (from the lm-sensors package): This is a more general hardware monitoring tool that can often detect GPU temperatures. You might need to run sudo apt install lm-sensors first and then sudo sensors-detect to configure it.

The most reliable method for users of the AMDGPU driver is often checking files directly in the /sys/class/drm/card0/device directory (replace card0 with the appropriate card number if you have multiple GPUs). Here's how:

cd /sys/class/drm/card0/device
cat hwmon/hwmon0/temp1_input # GPU temperature in millidegrees Celsius
cat hwmon/hwmon0/pwm1 # Fan speed control value (0-255, 0 is off)
cat hwmon/hwmon0/pwm1_enable # Fan control mode (0: automatic, 1: manual)
cat hwmon/hwmon0/fan1_input # Fan speed in RPM

If the temperature is high (above 60°C) and the fan speed (fan1_input) is 0, or the pwm1 value is low while pwm1_enable is not set to manual, then we know we have a fan control issue.

2. Manually Controlling the Fan with echo

Okay, let's try manually controlling the fan. This is a temporary solution to test if fan control is possible at all. We'll use the echo command to write values directly to the fan control files.

Warning: Incorrectly setting fan speeds can damage your GPU. Be cautious and monitor temperatures closely.

First, we need to switch to manual fan control mode:

sudo sh -c 'echo 1 > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable'

This sets the pwm1_enable file to 1, which means manual control. Now, we can set the fan speed using the pwm1 file. The value range is typically 0-255, where 0 is off and 255 is full speed. Let's try setting it to a moderate speed, like 128:

sudo sh -c 'echo 128 > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1'

Now, check the fan speed again using the cat hwmon/hwmon0/fan1_input command. If the fan is spinning, great! This confirms that the fan hardware is working, and the issue is likely software-related. If the fan still isn't spinning, try a higher value like 200. If it still doesn't spin, there might be a hardware problem or a deeper driver issue.

To revert to automatic fan control, simply run:

sudo sh -c 'echo 0 > /sys/class/drm/card0/device/hwmon/hwmon0/pwm1_enable'

Important: This manual control is temporary. It will reset when you reboot. We'll look at more permanent solutions later.

3. Creating a Custom Fan Control Script with fancontrol

Manually echoing values is a good test, but it's not practical for everyday use. We need a more automated solution. This is where the fancontrol package comes in. fancontrol is a command-line tool that automatically adjusts fan speeds based on temperature sensors. It's a bit more complex to set up, but it provides a much more robust solution.

First, install fancontrol:

sudo apt install fancontrol

During the installation, you'll be asked if you want to configure fancontrol. Choose <No> for now. We'll configure it manually. Next, run the pwmconfig tool to detect your fan controllers and temperature sensors:

sudo pwmconfig

pwmconfig will probe your system and ask a series of questions. Follow the prompts carefully. It will ask you to stop each fan for a few seconds to identify the correct PWM control. Be sure to monitor your GPU temperature during this process to prevent overheating. If you're unsure about any question, it's generally safe to answer