# Read out CPU fan speed?



## The Alchemist (Aug 9, 2017)

Hey all,

After a reboot of my FreeBSD 10.3 system, it seems that the CPU fan speed is a lot higher than before the reboot.

Because I live in a studio apartment, the server is in the same room as my bedroom.
The CPU fan is the boxed one of Intel, so at higher RPM the sound is very noticeable.

I have the idea the CPU fan is constantly wavering it's RPM.
If this would be a constant speed, it wouldn't be as annoying as much as it does now.

I have tried reading out the fan speed using sysctl:

```
$ sysctl -a | grep -i fan
$ sysctl -a | grep -i speed
hw.ix.advertise_speed: 0
dev.est.3.%desc: Enhanced SpeedStep Frequency Control
dev.est.2.%desc: Enhanced SpeedStep Frequency Control
dev.est.1.%desc: Enhanced SpeedStep Frequency Control
dev.est.0.%desc: Enhanced SpeedStep Frequency Control
$ sysctl -a | grep -i temp
dev.cpu.3.temperature: 35.0C
dev.cpu.2.temperature: 35.0C
dev.cpu.1.temperature: 31.0C
dev.cpu.0.temperature: 31.0C
```
Temperature is readable and is way to low for the fan to keep going up and down, so I would like to monitor the fan speed for a while to decide if I am going for an aftermarket (quiet) CPU fan.

I've tried mbmon, but this is not reporting anything:

```
$ mbmon
No Hardware Monitor found!!
InitMBInfo: No such file or directory
```

Is there another way to monitor my CPU fan speed?

I have the following hardware:
- ASRock B150M Pro4S
- Intel Core i3-6100 Boxed


----------



## SirDice (Aug 9, 2017)

The Alchemist said:


> The CPU fan is the boxed one of Intel, so at higher RPM the sound is very noticeable.


The boxed fans are usually pretty crap. I really recommend getting a better one in any case. Preferably one that allows for really low RPMs (that will cut down the noise considerably). 

I have several servers running, all of them in my living room. So noise levels are really important for me. The boxed fans I typically throw out right away and use good, low-noise, aftermarket ones. I would also recommend getting a fan controller, especially if you have a couple of fans in a single machine. A friend came around and brought his water-cooled PC to play some games. His PC made more noise than all my systems running at full speed combined 

Note that depending on the mainboard you may need to load smbus(4) in order for mbmon(1) to work.


----------



## drhowarddrfine (Aug 9, 2017)

Just to ditto the last two posts. My workstation has two fans running at low speed but a large heat sink on the cpu. I can barely hear the fans running. My son once had a water cooled system cause he's a big time gamer but that was far too much trouble than it was worth and he no longer does that. He gets by fine with fans but I don't recall how noisy it is. It's not too noisey for him, though.

My workstation reboots and fans are on high speed till I start i3-wm. Then they go to low speed but I don't recall what I did to make that happen.


----------



## The Alchemist (Aug 9, 2017)

SirDice said:


> The boxed fans are usually pretty crap. I really recommend getting a better one in any case. Preferably one that allows for really low RPMs (that will cut down the noise considerably).
> 
> I have several servers running, all of them in my living room. So noise levels are really important for me. The boxed fans I typically throw out right away and use good, low-noise, aftermarket ones. I would also recommend getting a fan controller, especially if you have a couple of fans in a single machine. A friend came around and brought his water-cooled PC to play some games. His PC made more noise than all my systems running at full speed combined
> 
> Note that depending on the mainboard you may need to load smbus(4) in order for mbmon(1) to work.



I totally agree with you that boxed fans are crap, I was already thinking about searching for a silent aftermarket fan. Any advice for a quiet fan?

Yeah, I think I need the smbus, could you specify exactly what it is and how I could implement it?

There is very little found on it via Google and the documentation is not really helpful to me -,-


----------



## SirDice (Aug 9, 2017)

The Alchemist said:


> Yeah, I think I need the smbus, could you specify exactly what it is and how I could implement it?


It's a kernel module that provides a more or less standard interface (the Systems Management Bus) to talk to various on-board components like temperature and fan sensors. I say more or less standard because there's very little standardized when it comes to reading or controlling sensors. So it's a bit of a hit and miss and you may need to try various different scenarios. 

First load the module: `kldload smbus`. For good measure also `kldload iic` (iic(4) is a common 2 wire protocol). Then run `mbmon -A` and see if that produces anything.


----------



## The Alchemist (Aug 9, 2017)

That got me further, but not much:
`$ sudo mbmon -A
InitMBInfo: No such file or directory
This program needs "setuid root"!!`

I tried setting the setuid on the binary, but to no avail:
`$ sudo chmod u+s /usr/local/bin/mbmon
sudo mbmon -A
InitMBInfo: No such file or directory
This program needs "setuid root"!!`


----------



## ralphbsz (Aug 9, 2017)

I presume we're talking about the mbmon from the xmbmon package?  It does the same thing for me, even when running as root.  I assume that the cause of the "needs setuid" message is just sloppy programming: if it can't open the device, it assumes the problem is lack of setuid, which in reality the problem is that there are no devices for it.  If I had too much spare time, and this were an important problem, I would read and fix the source code - but neither condition is true.

There are other programs that monitor the motherboard sensors.  I've had partial luck with "healthd": it at least doesn't put out error messages and crash.  On the other hand, I have no way to verify that the data it gives has any connection to reality, and I don't know how to calibrate it (that's motherboard specific).  So I stopped using it.


----------



## User23 (Aug 10, 2017)

It should be a BIOS bug or something.
One of Asrocks  BIOS updates for that mainboard has "1.Modify Fan behavior." in the description,
so i would check the used BIOS version first.

http://www.asrock.com/mb/Intel/B150M Pro4S/?cat=Download&os=BIOS


----------

