ASRock Rack BMC Fan Control?

IamSpartacus

Well-Known Member
Mar 14, 2016
2,462
613
113
I have an ASRock Rack EPYCD8 motherboard and I'm not seeing anyway to control the fans via IPMI. Am I missing something? I'm not seeing my CPU fan ramp up at all when my CPU gets warmer.
 
  • Like
Reactions: Bradford

IamSpartacus

Well-Known Member
Mar 14, 2016
2,462
613
113
What do you get from the output of: ipmitool sdr ?
Code:
root@BEAST:/dev# ipmitool sdr
3VSB             | 3.40 Volts        | ok
5VSB             | 5.13 Volts        | ok
VCPU             | 1.12 Volts        | ok
VSOC             | 0.85 Volts        | ok
VCCM ABCD        | 1.21 Volts        | ok
VCCM EFGH        | 1.22 Volts        | ok
BAT              | 3.04 Volts        | ok
3V               | 3.32 Volts        | ok
5V               | 5.04 Volts        | ok
12V              | 12.30 Volts       | ok
MB Temp          | 32 degrees C      | ok
Card Side Temp   | 45 degrees C      | ok
CPU Temp         | 42 degrees C      | ok
TR1 Temp         | no reading        | ns
DDR4_A Temp      | 43 degrees C      | ok
DDR4_B Temp      | 46 degrees C      | ok
DDR4_C Temp      | 46 degrees C      | ok
DDR4_D Temp      | 46 degrees C      | ok
DDR4_E Temp      | 40 degrees C      | ok
DDR4_F Temp      | 42 degrees C      | ok
DDR4_G Temp      | 44 degrees C      | ok
DDR4_H Temp      | 42 degrees C      | ok
CPU1_FAN1        | 1700 RPM          | ok
FRNT_FAN1        | 600 RPM           | ok
FRNT_FAN2        | 600 RPM           | ok
FRNT_FAN3        | 600 RPM           | ok
FRNT_FAN4        | no reading        | ns
REAR_FAN1        | 700 RPM           | ok
REAR_FAN2        | 600 RPM           | ok
CPU1_FAN1_2      | no reading        | ns
FRNT_FAN1_2      | no reading        | ns
FRNT_FAN2_2      | no reading        | ns
FRNT_FAN3_2      | no reading        | ns
FRNT_FAN4_2      | no reading        | ns
REAR_FAN1_2      | no reading        | ns
REAR_FAN2_2      | no reading        | ns
PSU1 PIN         | no reading        | ns
PSU2 PIN         | no reading        | ns
PSU1 POUT        | no reading        | ns
PSU2 POUT        | no reading        | ns
PSU1 VIN         | no reading        | ns
PSU2 VIN         | no reading        | ns
PSU1 IOUT        | no reading        | ns
PSU2 IOUT        | no reading        | ns
ChassisIntr      | 0x00              | ok
CPU_PROCHOT      | 0x00              | ok
CPU_THERMTRIP    | 0x00              | ok
PSU1 Status      | 0x00              | ok
PSU1 AC lost     | Not Readable      | ns
PSU2 Status      | 0x00              | ok
PSU2 AC lost     | Not Readable      | ns
The CPU fan speed doesn't budge no matter what the CPU temp goes to. And I know the fan works because it's only 2 months old and just worked perfectly on a supermicro board I was previously using a few weeks ago.
 

IamSpartacus

Well-Known Member
Mar 14, 2016
2,462
613
113
Have you tried adjusting the fan thresholds as shown in ipmitool sensor ?
Oh strange, looks like they're not completely set at all. Never seen that before. I guess I'm just used to SuperMicro.

Code:
CPU Temp         | 40.000     | degrees C  | ok    | na        | na        | na        | 95.000    | na        | na      
CPU1_FAN1        | 1700.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na      
FRNT_FAN1        | 600.000    | RPM        | ok    | na        | na        | 100.000   | na        | na        | na      
FRNT_FAN2        | 600.000    | RPM        | ok    | na        | na        | 100.000   | na        | na        | na      
FRNT_FAN3        | 600.000    | RPM        | ok    | na        | na        | 100.000   | na        | na        | na      
REAR_FAN1        | 700.000    | RPM        | ok    | na        | na        | 100.000   | na        | na        | na      
REAR_FAN2        | 600.000    | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
Now I need to figure out what to set these to...
 

IamSpartacus

Well-Known Member
Mar 14, 2016
2,462
613
113
Even when you (factory) reset the ipmi/bmc?
I guess I can try that. I've upgraded the BMC firmware since I got the board so I assumed it was wiped but I'll try and manually wipe it and see what happens.
 

vanfawx

Active Member
Jan 4, 2015
370
68
28
43
Vancouver, Canada
And if the thresholds still aren't there, you should contact support from your board vendor. Hopefully an IPMI config reset will get you right again though.
 

IamSpartacus

Well-Known Member
Mar 14, 2016
2,462
613
113
Well I've done a factory reset, a re-flash to the latest firmware and a flash to the previous version. No dice. Guess I'll have to contact support.
 

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,395
504
113
IamSpartacus - suspect that if your fans aren't ramping up with increased load/temps it might be a bug (there was a bug in the beta BIOS for my board that stopped the sensors working properly) but just in case you find it useful I've been using the following ipmitool raws to manually set the fan duty cycles on my X470D4U. I've just replaced the ~7000rpm NPM fans in my case with Noctuas but at default smart fan settings they were running at ~900-1000rpm which wasn't shifting enough air to keep the HDDs cool so I finally had a dig in to tweaking the ASRock IPMI manually.

The duty cycle thresholds can usually be tweaked in the BIOS but of curse much more convenient to be able to do it from within the OS.

See the available fan channels in IPMI:
Code:
effrafax@wug:~$ ipmitool sensor|grep -i fan
FAN1             | 1000.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
FAN2             | 1000.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
FAN3             | 1000.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
FAN4             | na         | RPM        | na    | na        | na        | 100.000   | na        | na        | na
FAN5             | na         | RPM        | na    | na        | na        | 100.000   | na        | na        | na
FAN6             | na         | RPM        | na    | na        | na        | 100.000   | na        | na        | na
This raw should tell you the current duty cycle for each of the above six fan channels (plus two extra numbers at the end, possibly for boards with 8 fan headers):
Code:
effrafax@wug:~$ ipmitool raw 0x3a 0x02
 00 00 00 00 00 00 00 00
Those first six numbers directly correlate to each of the FANx channels seen in the IPMI sensors, i.e. FAN1 = 1st hex, FAN2 = 2nd hex, etc. I haven't figured out what the last two hex numbers represent. As you can see from above they're all currently set to zero; 0x00 refers to the default "smart fan" setting, 0x04 through to 0x64 represent the duty cycle with 0x04 meaning minimum rpm and 0x64 meaning maximum rpm.

As such, you can use the following raw command to set the duty cycle of each of those fans individually using the prefix 0x3a 0x01 (as opposed to 0x3a 0x02 for reading). The below command sets FAN1 (the CPU fan) to max duty cycle, FAN2 to ~50% duty cycle, FAN3 to ~90% duty cycle, FAN4 to Smart Fan and FAN5 and 6 to max duty cycle. I've left the last two octets at 0 but changing them to other values didn't seem to make any difference.
Code:
ipmitool raw 0x3a 0x01 0x64 0x32 0x56 0x00 0x64 0x64 0x00 0x00
The results should take effect immediately; re-read to check and the fan speeds should have changed accordingly:
Code:
effrafax@wug:~$ ipmitool raw 0x3a 0x02
 64 32 56 00 64 64 00 00
effrafax@wug:~$ ipmitool sensor|grep -i fan
FAN1             | 2600.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
FAN2             | 1100.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
FAN3             | 2000.000   | RPM        | ok    | na        | na        | 100.000   | na        | na        | na
FAN4             | na         | RPM        | na    | na        | na        | 100.000   | na        | na        | na
FAN5             | na         | RPM        | na    | na        | na        | 100.000   | na        | na        | na
FAN6             | na         | RPM        | na    | na        | na        | 100.000   | na        | na        | na
These speeds aren't persistent so for the time being I've chucked a command in my rc.local to load on boot.

I'm still experimenting with the granularity of this but on my board at least it gives me a lot of scope for quite fine-grained control over the fans depending on temperature in various zones, much more flexible than the Supermicro route for my purposes. Hope they fix your BIOS soon and that this'll be useful in the interim.

P.S. I've not had cause to tinker with it yet but the setting of the sensor thresholds seems to work the same way as for other IPMI implementations, e.g.
Code:
ipmitool sensor thresh FAN1 lower 100 200 3000
 

brewmonkey

New Member
Feb 26, 2020
13
1
3
My E3C246D4U does the same thing with latest BIOS/BMC firmware - fans do not seem to ramp with CPU load even though BIOS setting of "AUTO" seems to suggest it will do just that. Hard to believe they let such a fundamental function get so screwed up.
 

tinfoil3d

QSFP28
May 11, 2020
525
189
43
Japan
Absolutely saved me. Thank you. Thanks for this research and knowledge share, the thing is I've just upgraded into BIOS 2.60 that supports EPYC ROME on my EPYCD8-2T, and all the fan control options disappeared from BIOS. Noctua PWM fans weren't creating any airflow at all, and this solved it. Absolutely amazing! I can control my fans live and script it now. Was about to call my rep to look into this. I'm still waiting for an answer by email, maybe he'll share more ways but this is very much sufficient.
 

IamSpartacus

Well-Known Member
Mar 14, 2016
2,462
613
113
Absolutely saved me. Thank you. Thanks for this research and knowledge share, the thing is I've just upgraded into BIOS 2.60 that supports EPYC ROME on my EPYCD8-2T, and all the fan control options disappeared from BIOS. Noctua PWM fans weren't creating any airflow at all, and this solved it. Absolutely amazing! I can control my fans live and script it now. Was about to call my rep to look into this. I'm still waiting for an answer by email, maybe he'll share more ways but this is very much sufficient.
Contact ASRock support. Fan control disappeared on BIOS update for me as well and they provided me a beta bios that brought them back.
 

tinfoil3d

QSFP28
May 11, 2020
525
189
43
Japan
Contact ASRock support. Fan control disappeared on BIOS update for me as well and they provided me a beta bios that brought them back.
I did. But BIOS requires me to reboot the machine to change anything, while ipmitool provides live tweaks, which is much better.
This forum is really a gold stash of knowledge.
 

bellss

New Member
Jun 23, 2021
2
4
1
Hi. Can anyone add to the stash of gold by updating on the ipmi raw magic to control fans on an AsrockRack X570D4U-2L2T?

It seems the raw commands may have changed from the X470D4U:

$ sudo ipmitool raw 0x3a 0x02
Unable to send RAW command (channel=0x0 netfn=0x3a lun=0x0 cmd=0x2 rsp=0xc1): Invalid command
Thank you.
 
  • Like
Reactions: Bradford

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,395
504
113
That's a bit odd; ASRR don't make any mention of changes on their FAQ page (stupid JS so you need to find the section "How to modify the mainboard/system fan control?"). But it's certainly not the first time documentation might not have been in step with code.

I assume you're using the 01.10.00 BMC and not any weird beta releases? Do any of the other commands work on your IPMI? These three should show you your NIC settings, your eth0 MAC address and your IPMI bonding status.
Code:
ipmitool lan print 1
ipmitool raw 0x3a 0xa1 0x00
ipmitool raw 0x32 0x72 0x01 0x00 0x00
FWIW when I was looking for the IPMI raws, last time I opened up a ticket from their support page and one of their chaps from the Netherlands furnished me with an answer within a few days.
 
  • Like
Reactions: Borromini

bellss

New Member
Jun 23, 2021
2
4
1
Thank you EffrafaxOfWug. Yes, I'm running the 01.10.00 BMC. For the record, I have this for controlling the X570D4U-2L2T (courtesy of ASRock support and a post on unraid):


Code:
Set all fans to automatic mode
sudo ipmi-raw 00 3a d8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Set all fans to manual mode
sudo ipmi-raw 00 3a d8 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
Set all fans to custom mode
sudo ipmi-raw 00 3a d8 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
Set all fans to 20%
sudo ipmi-raw 00 3a d6 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14
Set all fans to full
sudo ipmi-raw 00 3a d6 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64
read fan speeds:
sudo ipmi-sensors -t fan
get fan mode (0=auto, 1=manual, 2=custom curve)
sudo ipmitool raw 0x3a 0xd9
get fan duty for manual mode
sudo ipmitool raw 0x3a 0xd7
You can do this remotely too, of course:
Code:
ipmitool -H 192.168.1.2 -U admin -P 12345678 -I lanplus raw 0x3a 0xd8 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01

I would love to see the full handbook of hex codes. However, this information does not appear to be easily accessible. I would welcome more information on this.
 

Borromini

New Member
Aug 25, 2021
12
1
3
Hey guys!

I got an Asrock 1U4LW-X570/2L2T RPSU recently, with the X570D4U-2L2T onboard. I have scripted most of the commands shared here and in the Unraid thread. Might have a few rough edges but it works. Hope someone finds it useful!

Bash:
#!/bin/env bash

# Script to manipulate fan speeds on Asrock Rack X570D4U-2L2T. See [1] and [2].

SCRIPTVERSION="2021-11-17"

/usr/bin/echo -e ":: Server board:$(dmidecode -qt2|awk -F: '/^\tProduct Name:/ {print $2}') :|: Script version: $SCRIPTVERSION\n"

case "$1" in
    duty)
    # Store hex value and uppercase it, since bc doesn't like the lowercase values IPMI puts out.
    HEXVAL1="$(/usr/bin/ipmitool raw 0x3a 0xd7 | cut -d ' ' -f2|tr [:lower:] [:upper:])"
    if [ "$HEXVAL1" = "00" ]
    then
        /usr/bin/echo -e "Fan duty: \e[32mauto\e[0m\n"
    else
        /usr/bin/echo -e Fan duty: $(/usr/bin/echo "obase=10; ibase=16; $HEXVAL1" | /usr/bin/bc)%
    fi
    ;;
    mode)
    /usr/bin/ipmitool raw 0x3a 0xd9 > /tmp/ipmi_fan_mode
    if grep -q 01 /tmp/ipmi_fan_mode
    then
        /usr/bin/echo "Fan mode: manual"
    else
        /usr/bin/echo -e "Fan mode: \e[32mauto\e[0m\n"
    fi
    ;;
    rpm)
    # Report actual speeds.
    /usr/sbin/ipmi-sensors -t fan
    ;;
    speed)
    [ -z $2 ] && /usr/bin/echo -e "\e[31mERROR\e[0m: No fan speed defined. Aborting." && exit
    if [ "$2" = auto ]
    then
        # Reset to factory defaults.
        /usr/bin/echo "Resetting to factory defaults."
        /usr/sbin/ipmi-raw 00 3a dc 2>&1 > /dev/null
    elif [ "$2" -ge 20 -a "$2" -le 100 ]
    then
        HEXVAL2=$(/usr/bin/echo "ibase=10; obase=16; $2" | /usr/bin/bc)
        # Set fan mode to manual first, otherwise speed settings won't take effect.
        /usr/bin/echo -e "Setting fan speed to $2%..."
        /usr/sbin/ipmi-raw 00 3a d8 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 2>&1 > /dev/null
        /usr/sbin/ipmi-raw 00 3a d6 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 $HEXVAL2 2>&1 > /dev/null
        /usr/bin/echo -e "Done"
    else
        /usr/bin/echo -e "\e[31mERROR\e[0m: Minimum value is 20, maximum 100." && exit
    fi
    ;;
    *)
    /usr/bin/echo -e ":: This script allows you to set and read out fan settings.

  Valid arguments are:
   + duty        Get current fan duty.
   + mode        Get fan mode.
   + rpm         Report actual fan speeds.
   + speed       Set fan duty percentage. Takes a number from 20 to 100,
                 or 'auto' to reset to defaults.
    ;;
esac


#References
#==========
# [1]    https://forums.servethehome.com/index.php?threads/asrock-rack-bmc-fan-control.26941/post-307956
# [2]    https://forums.unraid.net/topic/38108-plugin-ipmi-for-unraid-61/page/54/?tab=comments
 
  • Like
Reactions: nasi

Bradford

Active Member
May 27, 2016
214
42
28
I have a server in my office that I can keep quiet with a windows task that is run every time I login or unlock the computer. I have a Supermicro 846 with SM fans except for the CPU fan, so when I login I sending the ssh command that keeps my CPU fan at max (1400 RPM) and the chassis fans as low as it can go (1300-1600RPM):

ipmitool raw 0x3a 0x01 0x64 0x01 0x01 0x01 0x01 0x01 0x01 0x01

When I log out it sends this command to return the chassis fans to auto:

ipmitool raw 0x3a 0x01 0x64 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Yesterday I saw there was a new BMC firmware (03.02.00), so I ignored the warning to not upgrade if I don't have a reason to and spent a few hours getting the new BMC to upgrade and be accessible over the web. It was a pain in the ass, and others have experienced the same problems.

I noticed that the new fan control commands were different, significantly that it seems that the lowest I can manually set the fans is 20%, any lower and I get an error. @Borromini above has a comment in his script that there's an error if it's below 20, which I confirmed in my own testing.
Well, 20% is a lot louder than 1%. Here are the commands I used to set the chassis fans to manual and as low as I could go:

ipmitool raw 0x3a 0xd8 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
ipmitool raw 0x3a 0xd6 0x64 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14 0x14

To reset them to auto, I used

ipmitool raw 0x3a 0xdc

After a few hours of loud fans I flashed the 2.20 BMC back, I don't know if I'm missing something or they really did limit how low you could set the fans to 20%. Posting this here for posterity.