How to set up kernel options

Hi all,

I would like to know how to add a specific kernel option to nixos configuration. More specifically, I have a Ryzen 1700 and apparently there is an issue with these processors:

user@nixos> journalctl  | grep 'Hardware Error'
Aug 25 15:26:13 nixos kernel: mce: [Hardware Error]: Machine check events logged
Aug 25 15:26:13 nixos kernel: mce: [Hardware Error]: CPU 7: Machine Check: 0 Bank 5: bea0000000000108
Aug 25 15:26:13 nixos kernel: mce: [Hardware Error]: TSC 0 ADDR 1ffffac8ff27c MISC d012000101000000 SYND 4d000000 IPID 500b000000000 
Aug 25 15:26:13 nixos kernel: mce: [Hardware Error]: PROCESSOR 2:800f11 TIME 1566739567 SOCKET 0 APIC 7 microcode 800111c

Looking at the AMD and ArchLinux forums (for example [Solved] Random freezes with AMD Ryzen on Linux 5.0 / Kernel & Hardware / Arch Linux Forums), the most easy solution is to add a kernel option like that:

processor.max_cstate=1

which avoids situations where the hardware error might be relevant. Do anyone know the best way to do it on nixos. Sorry, I am still a beginner!

Thanks very much!

1 Like

Hi @RCHG, you should use boot.kernelParams:

        boot.kernelParams
           Parameters added to the kernel command line.

           Type: list of strings

           Default: [ ]

           Declared by:
               <nixpkgs/nixos/modules/system/boot/kernel.nix>

from man configuration.nix.

3 Likes

Thanks! I will try it.

You probably want to look in the file hardware-configuration.nix which sits besides configuration.nix, as likely it already has some kernel params. Your configuration.nix file imports hardware-configuration.nix, so editing that one should be enough.

3 Likes