ObjectiveMonitor system temperatures and voltage on an AMD Ryzen system running Linux.
DistributionsAll distributions running kernel 4.11 or higher
RequirementsA working Linux install with kernel 4.11 or greater and root privileges.
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ - requires given linux commands to be executed as a regular non-privileged user
IntroductionAMD's Ryzen CPUs have been out for several months now, but AMD still hasn't released any specifications or code to get temperature monitoring support for CPU sensors in Linux. Thankfully, there are fairly accurate sensors on Ryzen motherboards, and they are accessible through Linux. You can only take full advantage of them by using the latest kernel modules, and in some cases, lm_sensors itself.
Install The Build DependenciesFirst, you're going to need to get the build dependencies in line to compile the latest versions of the sensor modules from Git. Assuming you're using a Debian-based distro, install the following.
$ sudo apt install build-essential bison flex linux-headers $ sudo apt build-dep linux $ sudo apt build-dep lm-sensors
Determine Your ModuleThere are two modules that you'll encounter on Ryzen boards. They are
nct6775. Just about every board has one or the other.
it87is more common.
There are a couple of ways to check which one your board has. It might be easiest to do a search online. That might not turn anything up, so you'll have to use
If you compiled your own kernel, make sure that you built both modules. Distribution kernels should have them available. Then, try to load each of the modules. If you receive an error stating that you don't have that hardware, that's the one you don't have. Try the other one. Whichever one is successful is the one you need to build.
The UAF Geophysical Institute, is looking for an experienced Linux Systems Analyst to join their team of research cyber infrastructure analysts and engineers. LOCATION: Fairbanks, Alaska, USA
Get And BuildThis next section is going to refer to the
it87module, but the process is exactly the same for both. Just substitute in
nct6775, if that's the one you have.
Go to the directory you want to build in, and clone the repository from Git.
$ cd Downloads $ git clone https://github.com/groeck/it87.gitRemember: Substitute
Now, change into the cloned directory.
$ cd it87Depending on your distribution, you might need to modify the
Makefile. It needs to point at the actual location of your kernel's source or headers. If you get an error saying that
makecan't find your kernel headers, you need to modify the file.
Open up the
Makefileand look for the following line.
KERNEL_BUILD := /usr/src/linux-headers-$(TARGET)Change it to point at the actual location of your headers or source. The example below works for Gentoo.
KERNEL_BUILD := /usr/src/linuxOnce that's settled, you can actually build your module.
$ make -j5There's not a lot of source, so the build won't take long. Before you install, make sure that your
/bootpartition is mounted. The install needs your
$ sudo mount /dev/sda1 /boot $ sudo make install
Build lm_sensorsYou may or may not need to do this part, but it can't really hurt. So, if you're unsure, do it.
cdback up one level and grab the latest sources with Git.
$ cd .. $ git clone https://github.com/groeck/lm-sensors.gitChange into the new folder and build it.
$ cd lm-sensors $ make -j5 allDon't worry if you see some errors. Make sure that the compile actually completes, though. When it's done, install.
$ sudo make install
Test ItYou can load the modules now. Use
modprobeto do that.
$ sudo modprobe it87You might need to force an id for the module.
$ sudo modprobe it87 force_id=0x8622Some common force id's for it87 are
0x8732. For nct6775, try
0xd352. Start up your lm_sensors daemon(if it isn't already), and try to detect your sensors.
$ sudo systemctl start lm_sensors $ sudo sensors-detectHere's where it might get weird. It might not detect anything in the scan. Don't take it at face value. Run the plain
sensorscommand to see for sure. In many cases, you'll see output from your motherboard sensors.
Some people might not be so lucky. Ryzen's release has been extremely erratic. Minor differences here and there have had a huge impact. If it didn't work for you, check back for updates regularly, and keep your BIOS updated. Eventually,you should see support.
Make It PermanentCongratulations! You've made it this far. It's time to save your progress, so your computer uses it every time it boots.
Create the following files.
$ sudo touch /etc/modules-load.d/it87.conf $ sudo touch /etc/modprobe.d/it87.confIn
/etc/modules-load.d/it87.conf, place the line below.
it87Then, put this line in
options it87 force_id=0x8622Obviously, make sure to use the actual module and force id that got your sensors working.
Closing ThoughtsRyzen's release has been messy, especially on Linux. That doesn't mean that it's a bad platform. Actually, Ryzen is a great option for a multi-threaded Linux workstation. Just be aware of the potential problems.
In this case, these kernel modules will get your temperature sensors working as needed. Eventually, the need to do this will disappear, as support is merged into the kernel.