7

I have been trying to get a FreeBSD box (running FreeNAS) to control its fans. It wants to just run them at high speed even though the system temperatures are quite low. The lm-sensors package can do this on Linux, but it's not available on FreeBSD.

I found this similar question here, but there has been no response.

Is there a kernel module I can load to do this on FreeBSD?

3 Answers 3

7

ACPI

Yes. If your hardware supports Advanced Configuration and Power Interface (ACPI) then there are loadable modules for ACPI support.

Unfortunately most (if not all) modules are targetting laptops.

You can see if you have any settings related to fans using sysctl:

# sysctl hw.acpi

But rather than manually tweaking the fan speed it should autoadjust according to temperature and load. In FreeBSD this is handled by powerd which is disabled by default.

So even if the fans are not directly exposed then you might be able to adjust them but adjusting the CPU frequency. Some BIOSes then adjust the fan speed accordingly (if within reasonable temperature range as well).

Example setting in /etc/rc.conf

powerd_enable="YES"
powerd_flags="-a adaptive"
performance_cx_lowest="C2"      # Online CPU idle state
performance_cpu_freq="1399"     # Online CPU frequency
economy_cx_lowest="C3"          # Offline CPU idle state
economy_cpu_freq="NONE"         # Offline CPU frequency

The sysctl hw.acpi will also show if any of the above settings can take effect.

IPMI

If you have no luck going the ACPI route then maybe the Intelligent Platform Management Interface (IPMI) can be helpful to you. This is however normally only available on serverclass motherboards with a BMC.

When the server boots up the fans runs at BIOS default speeds until the OS takes over. If the OS does not take over (ie. using ACPI) then the CPU and fans often runs at full throttle. Even though the thresholds are not directly available in the BIOS configuration screen in several cases this can then be set using IPMI.

FreeBSD does have an IPMI driver and you can install sysutils/ipmitool to play with the settings.

The following snippet from servethehome.com should work for some SuperMicro boards (X9/X10/X11):

#set fan mode to "full"
ipmitool raw 0x30 0x45 0x01 0x01
#set fans in "system" zone to 37.5%
ipmitool raw 0x30 0x70 0x66 0x01 0x00 0x24
#set fans in "peripheral" zone to 25%
ipmitool raw 0x30 0x70 0x66 0x01 0x01 0x16

NOTE: The fan mode is set to full at first as the BMC does not seem to change the fan speed if not.

The link above states:

but the magic numbers are the same

Please do note that the magic numbers are the same for a SuperMicro board no matter the IPMI tool used. They might be different for Tyan. The hard part is the figuring that out. It seems SuperMicro uses 0x30 but IBM might use 0x3a.

If you have setup username/password then supply them as well:

ipmitool -H HOST_IP -U USERNAME -P PASSWORD raw 0x3a 0x07 0x01 0x50 0x01

You might not have made a bad choice. Some really like Tyan. But beware that their implementation might be a little wonky. This is really important if you try to guess the magic numbers. This experience from 2020 might be better with an updates BIOS:

Definitely the Tyan board has some rough spots around the IPMI since it's not as well used and polished as the SM implementation. I'm seeing things like the KVM connection will drop even though timeout is 1800 seconds. I have to reload the IPMI webpage, log back in and start KVM again. Once, the IPMI completely rejected my root logon even though I am sure of my password. I just pulled power to the server, plugged it back in and waited for IPMI and I was in again. My conclusion is the IPMI lost itself.

Maybe you instead could set the duty cycle in BIOS. That seems to be available on some Tyan board but not obvious in the settings.

it can be set to one of two values - MANUAL and FULL SPEED. That's it. Right now all the temps you see above were with the fan duty cycle set to the default of 30%. I am going to create a support ticket and ask Tyan how to get the fan to vary with CPU or SYS temps

UPDATE: thanks to @jpmomo pointing out that the fan control works - in a fashion - I set the duty cycle to 15 and load tested the motherboard. The winner here is clearly the Supermicro SNK-P0064AP4 heatsink. At the default 30% duty cycle, it does 1600RPM and is super quiet. The heatsink also ensures that the CPU doesn't cross 68C under load. That is an amazing result. Pushing the duty cycle down to 15% makes the CPU fan spin at 1300RPM but it will spin up - once the CPU crosses 75C. I can't believe how good this heatsink is. Of course the 7302P is "only" a 180W processor so there's that

Hardware

If everything else fails then get a cheap hardware fan controller :-).

Or if you do not mind tinkering a little yourself then try 7VDC for fan

You would need a 4 pin molex connector to 3 pin fan connector and if more than one fan, more Y harnesses. Take the black wire and move it to the far end of the connector. This would end up moving the ground wire to the +5VDC line and you would have basically 7VDC (12VDC minus 5VDC equals 7VDC). It's safe providing you do it right and the fans would run at a slower speed. If they still spin too fast for you, you could only move the yellow (may be red on your adapter) to the opposite side. This would make it +5VDC but some fans will not work because that may not be enough voltage to start the fan turning.

3
  • 1
    This is a server class motherboard (Tyan dual processors), but the impitool raw command fails with "Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x45 rsp=0xc1): Invalid command" . I tried the powerd setting but that didn't help. I think this is just what i get for buying a cheap server on ebay.
    – dwilliss
    Commented Sep 22, 2017 at 17:20
  • Having gotten no more answers, I'm going to mark this one as the answer. It didn't work for me because the motherboard just doesn't support it. But it will hopefully help others.
    – dwilliss
    Commented Oct 4, 2017 at 22:36
  • This popped up in my notifications today. I never saw the update regarding a Tyan board. Maybe not that interesting 7 years later. :-) Commented Mar 22 at 16:08
1

It sounds what you are looking at is the result of a different BMC being used in the X9 vs. X10/X11. The X9 can only issue raw commands to change fan mode - a 4 value string (as summarized below); whereas the X10/11 boards can take a 6 value string to control additionally fan zone and duty cycle.

# Set fan mode: raw 0x30 0x45 0x01 [x]
# [x] Modes:      CPU Zone  Peripheral Zone
#                 Target    Target 
# -------------   --------  ---------------
# 00  Standard    50%      50%
# 01  Full        100%     100%
# 02  Optimal     30%      30%
# 04  Heavy I/O   50%      75%
1

Traditional fan control is generally not supported on any BSD systems. FreeBSD 12 (2019) doesn't have a sensors framework, and even though NetBSD and OpenBSD both do, they don't support fan control on it, either. Linux does support fan control with lm-sensors, as you point out, but, indeed, it's not available on the BSDs.

As mentioned in the other answers, you could try ipmitool if you have server-grade software with IPMI.

Else, realistically, the best course of action might be to see if BIOS has an option for fan control. Another hack is to configure the chip with another operating system, then warm-reboot back into FreeBSD, hoping that the settings don't get reset in the meantime. Finally, you could also try hacking a solution yourself; in fact, this is what I've done with my fan control patchset for OpenBSD/DragonFly when I wanted to quiet down my server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .