Fan control script not working anymore

achmetinternet

Explorer
Joined
Jun 13, 2018
Messages
50
I have moved from TrueNAS Core to Scale. One thing I noticed was, how loud my server became all of a sudden. And after a bit of digging around I figured it must be the Fan Control Script I got here, that is not working anymore. Maybe because ipmitool has moved from /usr/local/bin/ipmitool to somewhere else or maybe it is not included anymore.

Any suggestions how I can get that script running again to cool my Node 304?
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
Just to be clear: FreeBSD scripts are NOT compatible with Linux in a LOT of cases.

It's basically the same reason why linux install scripts cannot be easily ported to FreeBSD jails either...
 

otpi

Contributor
Joined
Feb 23, 2017
Messages
117
I used ipmitool from shell on my system to set fan speed.
 

c77dk

Patron
Joined
Nov 27, 2019
Messages
468
I was using the "spinpid" script on CORE and I'm trying to make that work in SCALE, so not the same script, but I figure a lot of changes has to be the same in your script.
I had to do the following:

* make sure all paths are correct
* make sure all binaries are present / act the same ("bc" isn't in base)
* change from camcontrol to lsblk + some grep (might make changes to this part)

I'm not done yet, but it looks like it's progressing in the right direction :smile:
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
I was using the "spinpid" script on CORE and I'm trying to make that work in SCALE, so not the same script, but I figure a lot of changes has to be the same in your script.
I had to do the following:

* make sure all paths are correct
* make sure all binaries are present / act the same ("bc" isn't in base)
* change from camcontrol to lsblk + some grep (might make changes to this part)

I'm not done yet, but it looks like it's progressing in the right direction :smile:

Precisely, it's not (always) the lack of software that's the issue.
One just cannot copy paste complete scripts.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
I adapted my script which is based on those spinpid scripts... (it's all Perl, so is for the most part actually quite easy to make cross platform).


And maybe useful to note that the SCALE version I posted should actually work on both SCALE and CORE (if you set the OS appropriately in the config)
 
Last edited:

c77dk

Patron
Joined
Nov 27, 2019
Messages
468
I adapted my script which is based on those spinpid scripts... (it's all Perl, so is for the most part actually quite easy to make cross platform).
Guess I know what to have a look at later :smile:
 

achmetinternet

Explorer
Joined
Jun 13, 2018
Messages
50
Has anyone looked at the script I posted initially? It has been working flawlessly when I was still on CORE but re-writing a whole script is not my strong suit and the script linked by sretalla hasn't worked for me :( So far that is...
 

dak180

Patron
Joined
Nov 22, 2017
Messages
310
FanControl.tool is very flexible but you will need to provide it with the correct commands to read and write the appropriate fan and temp values for your board (this is all done in the config file) FanControl.tool -c <config-file> will create one for you to be able to edit. One thing to keep in mind is that it is set by default for an Asrock Rack board which allows for individual control of each fan header separately.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Has anyone looked at the script I posted initially? It has been working flawlessly when I was still on CORE but re-writing a whole script is not my strong suit and the script linked by sretalla hasn't worked for me :( So far that is...
Happy to help you get it going... please share what you did so far and what's not working.

Did you put in place the script, making changes to conform to your system and also the ini file you want to represent the target temp and number of disks?

Can you manually run the ipmitool commands from the script to change fan speeds on your board? (I assume we're talking supermicro?)

Just to note that the script you posted is the one from @Stux ... mine is based on a variant of that which was extended by @Kevin Horton and further extended by me. You could take the settings you have at the top of that file and share them and I can help you put them into mine.
 
Last edited:

Ixian

Patron
Joined
May 11, 2015
Messages
218
Hey Sretalla, thanks so much for the porting work. I had forked your version of this last year and hacked together a solution that worked with SCALE but your changes are cleaner overall.

I've made a few changes to your new _SCALE.pl file - my repo: https://github.com/Ixian/nas_fan_control/blob/master/MASTER_PID_fan_control_SCALE.pl

Two main things I addressed are:

1) Newer ASRock boards (server and otherwise) use a different BMC, and long story short it changes how fans are accessed, the raw commands to change speeds, and other breaking changes. The X570D4U is one such board that is fairly popular.

I changed several bits of the script to account for the new board types (headers now called FAN 4_1 vs. FAN 4, etc., and the ipmitool command is significantly different vs. older boards). The better solution would be to add in another set of conditionals (asrock2, perhaps) so end users could have the option of both types; at the moment I just have my new subroutine hacked in.

2) For AMD CPUs, the current code (and previous, for that matter) won't work. Like you, I had switched to leveraging sensors and created a new sub called get_cpu_temp_sensors that pulls the TDie temp (that's the temp sensor AMD recommends be used for fan curves, etc. as it's closest to a "core average temp"). Looking at how you constructed your own sensor-based routine I think it would be simple to integrate this support in, forgoing the need for a new sub - probably with another conditional (triggered by a new variable CPU_type) I just haven't gotten around to it.

I made various other small changes. It works and the debug logs output clean, but I will be the first to admit my Perl skills are very rusty these days so undoubtedly there are cleaner ways to do these things.

If you get a chance to take a look please tell me what you think and if it's worth trying to wrap all this up in to one master script anyone could use just by changing a few variables.

P.S. did you ever re-work the spinpid.sh, etc. scripts? I'm still using values from when I used the same drives in FreeNAS/BSD.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
For AMD CPUs, the current code (and previous, for that matter) won't work. Like you, I had switched to leveraging sensors and created a new sub called get_cpu_temp_sensors that pulls the TDie temp (that's the temp sensor AMD recommends be used for fan curves, etc. as it's closest to a "core average temp"). Looking at how you constructed your own sensor-based routine I think it would be simple to integrate this support in, forgoing the need for a new sub - probably with another conditional (triggered by a new variable CPU_type) I just haven't gotten around to it.
Sounds good, let's do it.

Newer ASRock boards (server and otherwise) use a different BMC, and long story short it changes how fans are accessed, the raw commands to change speeds, and other breaking changes. The X570D4U is one such board that is fairly popular.

I changed several bits of the script to account for the new board types (headers now called FAN 4_1 vs. FAN 4, etc., and the ipmitool command is significantly different vs. older boards). The better solution would be to add in another set of conditionals (asrock2, perhaps) so end users could have the option of both types; at the moment I just have my new subroutine hacked in.
Also great, will look at putting that in too.

I was also thinking of using some startup check of uname -a to eliminate the need for the user selection of OS, but that's low priority.

did you ever re-work the spinpid.sh, etc. scripts? I'm still using values from when I used the same drives in FreeNAS/BSD.
I never had the time to spend on tweaking the PID values much, so have largely left it at the provided defaults from @Kevin Horton 's originally provided ones.

I made various other small changes. It works and the debug logs output clean, but I will be the first to admit my Perl skills are very rusty these days so undoubtedly there are cleaner ways to do these things.
Any help is good help... I'm certainly no Perl master either (I'm a Visual Basic 6 guy, but I can muddle my way through any language if suitably motivated).

If you get a chance to take a look please tell me what you think and if it's worth trying to wrap all this up in to one master script anyone could use just by changing a few variables.
I'm a fan of the "better together" concept... if we can make a "one stop shop" for all needs and maybe clean up the headers for people to be able to follow it better I think we'll have a compelling product for people to implement.
 
Last edited:
Joined
Jan 27, 2020
Messages
577
Is there any new on this? Firing up the script from you is throwing lots of errors. Been trying SCALE for a moment and missing a decent fan script option so far...
 
Joined
Jan 27, 2020
Messages
577
FanControl.tool is very flexible but you will need to provide it with the correct commands to read and write the appropriate fan and temp values for your board (this is all done in the config file) FanControl.tool -c <config-file> will create one for you to be able to edit. One thing to keep in mind is that it is set by default for an Asrock Rack board which allows for individual control of each fan header separately.
This is not working because bz is missing from the host system, installing packages on the host is not possible on SCALE.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
If you can share which version of the script you are using (where did you get it from) and what the errors are, maybe we can get somewhere.

I have provided a SCALE version of my script already that was working for me on my system when I last ran it.
 

dak180

Patron
Joined
Nov 22, 2017
Messages
310
This is not working because bc is missing from the host system, installing packages on the host is not possible on SCALE.
Vote for this issue (10 votes required before ix looks at it) to get it added to the base system.
 

achmetinternet

Explorer
Joined
Jun 13, 2018
Messages
50
Happy to help you get it going... please share what you did so far and what's not working.

Did you put in place the script, making changes to conform to your system and also the ini file you want to represent the target temp and number of disks?

Can you manually run the ipmitool commands from the script to change fan speeds on your board? (I assume we're talking supermicro?)

Just to note that the script you posted is the one from @Stux ... mine is based on a variant of that which was extended by @Kevin Horton and further extended by me. You could take the settings you have at the top of that file and share them and I can help you put them into mine.
Hi @sretalla

As I have the same fans, MoBo and case as @Stux I did the following (in bold) according to his post here:

The X10SDV v2.0 boards supports 4 fans and has 2 fan zones. Fans 1-3 are Fan Zone 0 and Fan 4 is Fan Zone 1. From the factory, the CPU fan is connected to Fan 1. This means all your HD and Exhaust fans need to be ganged off of Fan 4. Or alternatively, you can extend the CPU fan with one of the Noctua fan extension leads to Fan 4, and then connect the HD fans to Fan 1 and 3 and the Exhaust fan to Fan 2.

This leads me to several questions:
  1. Now in the script I downloaded from here, I got a bit confused because I have two fan zones but the script says that all FAN1+ are in Zone 0.
    I found here that FAN 4 might actually be FAN A:
    I take that quote to mean that only the later version 2.00 system boards have two zones, with FAN-4 serving as what's usually called FAN-A on Supermicro systems.
    But then @Stux replies here that it wouldn't power auxiliary items and that You just need to change the 'FANA' setting to 'FAN4'.
    How am I supposed to handle that?
  2. And in addition I have the two HD fans that are in the same Fan Zone (0) as the Exhaust fan, which is bigger, but have different max. speeds (2000 vs. 1300). What should I put in line 403?
  3. Do I really need a config if I just edit the values in the script? I guess it is to make changes on the fly, but what values could I enter in that config? Like temperature thresholds?
  4. In my IPMI the fans are called "FAN1" etc. but in the your script they are "Fan 1" etc. What is the correct naming or will it work with both?
Thanks for your help!
 
Last edited:

dak180

Patron
Joined
Nov 22, 2017
Messages
310
Top