Skip to content

ebruhl/nuclear-fan-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Nuclear Fan Control V2 for ASUS G14

Advanced fan and thermal management script for ASUS G14 laptops with NVIDIA RTX 2060 Max-Q.

Features

  • GPU Runtime Power Management: Automatically removes problematic NVIDIA USB controller to allow GPU suspend
  • Multi-layered thermal control: Temperature-based throttle policy management
  • CPU frequency capping: Prevents unnecessary boost to reduce heat
  • Stuck fan detection: Automatic firmware reset when fans don't respond
  • Wake event monitoring: Logs and responds to GPU wake events

Critical Fix: NVIDIA USB Controller Issue

The Problem

The NVIDIA USB 3.1 Host Controller (PCI device 0000:01:00.2) has a runtime power management bug that prevents it from suspending:

  • Kernel error: xHCI save state timeout
  • Runtime status stuck in "error" state
  • Blocks parent GPU (0000:01:00.0) from entering D3 suspend state
  • Results in: GPU stays active, fans spin up, higher temps and power consumption

The Solution

On startup, the script automatically removes the problematic USB controller device:

echo "1" > /sys/bus/pci/devices/0000:01:00.2/remove

Why this is safe:

  • The NVIDIA USB controller (Bus 001/002) has no devices connected
  • All actual USB devices (keyboard, mouse, storage, Bluetooth) use the AMD controller
  • Change is temporary - device returns after reboot
  • GPU can now properly suspend, reducing temps by ~5-10°C and quieting fans

Installation

  1. Copy nuclear-fan-control-v2.sh to /home/<user>/
  2. Make executable: chmod +x nuclear-fan-control-v2.sh
  3. Create systemd service file at /etc/systemd/system/aggressive-fan-control.service:
    [Unit]
    Description=Nuclear Fan Control V2 for ASUS G14
    After=multi-user.target systemd-modules-load.service
    StartLimitIntervalSec=0
    
    [Service]
    Type=simple
    ExecStart=/home/eric/nuclear-fan-control-v2.sh
    Restart=always
    RestartSec=5
    User=root
    StandardOutput=journal
    StandardError=journal
    
    # NOTE: Do NOT add WatchdogSec - script doesn't send watchdog signals
    # Adding it will cause service to crash every 30 seconds
    
    [Install]
    WantedBy=multi-user.target
  4. Enable and start service:
    sudo systemctl daemon-reload
    sudo systemctl enable aggressive-fan-control.service
    sudo systemctl start aggressive-fan-control.service

Thermal Policies

  • < 60°C: Quiet mode (throttle_policy=2)
  • 60-75°C: Quiet/Balanced hybrid (based on fan speed)
  • > 75°C: Performance mode (throttle_policy=1)

CPU Frequency Control

  • < 70°C: Max frequency capped at 2.1GHz
  • > 70°C: Full frequency range available (up to 4.5GHz)

Monitoring

Check service status and logs:

systemctl status aggressive-fan-control.service
journalctl -u aggressive-fan-control.service -f

Check GPU suspend state:

cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status

Troubleshooting

Service crashing with watchdog timeout (CRITICAL):

  • Symptom: Service restarts every ~30 seconds, fans gradually spin up, core dumps accumulating
  • Cause: WatchdogSec=30 in service file requires systemd-notify calls, which this script doesn't implement
  • Fix: Remove the WatchdogSec=30 line from /etc/systemd/system/aggressive-fan-control.service
  • Verify fix:
    journalctl -u aggressive-fan-control.service --since "1 hour ago" | grep watchdog
    ls /var/lib/systemd/coredump/core.nuclear* | wc -l  # Should not increase over time
  • Note: The service file template below has this issue pre-fixed

GPU won't suspend:

  • Check if NVIDIA USB controller is present: lspci -s 01:00.2
  • Manually remove: echo "1" | sudo tee /sys/bus/pci/devices/0000:01:00.2/remove
  • Verify GPU suspended: cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status

Fans still loud:

  • Check CPU temperature: sensors | grep Tctl
  • Verify throttle policy: cat /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy
  • Check platform profile: cat /sys/firmware/acpi/platform_profile
  • Check for service crashes: systemctl status aggressive-fan-control.service

System Requirements

  • ASUS G14 (2020) with NVIDIA RTX 2060 Max-Q
  • Linux kernel with runtime PM support
  • lm-sensors installed
  • systemd

License

This script is provided as-is for personal use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages