How to update CPU microcode in Linux

What is microcode ?

Simply for a CPU, microcode could be assumed as firmware of the CPU, which generally adds more functionality to the processor and patches hardware level bugs. Mainly Intel and AMD CPUs need more frequent microcode update.

Microcode is not just CPU specific, most hardware like Graphics cards, Disk drives,  Network cards also contains microcode. It is the underlying very low level software to make the hardware more functional, secure and fix the bugs. Read the wiki article for more detailed information.

Hardware manufacturers stores the CPU microcode data in the BIOS or UEFI firmware, so the CPU could update microcode form the BIOS/UEFI. So when a relatively newer microcode update available, do we have to update the BIOS/UEFI firmware ?

No, the Linux kernel could update the CPU microcode easily at the early stage of boot process, thou this type of update is volatile, i.e. lost after each shutdown. But it’s fairly more simple than updating the BIOS/UEFI.


Installing microcode update packages

For a Debian based system, just install the correct microcode package and reboot the system, that will be enough.

For Inte CPUs,

 sudo apt-get install intel-ucode 


 sudo apt-get install amd64-ucode 

The system will build a new initramfs with the latest microcode to apply it at system startup.


How to know my CPU needs a microcode update ?

It depends on your system, like how much old the CPU is, is there any updated microcode released by the CPU vendor etc. etc. But you cold check it by running the dmesg command, it generally show some helpful information.

 dmesg | grep 'microcode' 

CPU microcode error in Linux

To know the current CPU microcode version, use the command bellow

 grep 'microcode' /proc/cpuinfo 
 Intel CPUs

There is a tool iucode_tool, for Intel CPU only, which could be used to determine if an Intel CPU needs a microcode update or not. Different GNU/Linux distribution handles the microcode update package differently, I’m showing the example for Debian and Debian based distros only.

 sudo apt-get install iucode-tool intel-microcode 
 /usr/sbin/iucode_tool -tb -lS /lib/firmware/intel-ucode/* 

Sample output for a 2nd gen. Intel Core i5 CPU.iucode_tool

If the iucode_tool command returns no selected microcodes: , that means your Intel CPU probably don’t need a microcode update.


Currently the only method to know if the CPU needs a microcode update. First Install the amd64-microcode package

 sudo apt-get install amd64-ucode 

Reboot the system and check it with the dmesg command

 dmesg | grep 'microcode' 


Know If the kernel is configured to apply microcode update at startup

There are few kernel build parameters which enables the boot time microcode update by the kernel. To know if your current Linux kernel is capable of doing so, check it with these commands bellow.

 grep -i 'microcode' /boot/config-4.2.0-1-amd64 

Replace the config-4.2.0-1-amd64 with proper kernel configuration file which math your system. This may not be available for some distro like Arch Linux, Slax, Gentoo, then use the 2nd command  bellow

 zcat /proc/config.gz | grep -i 'microcode' 

Particularly useful if you are using a custom kernel or some other Linux distros like Archlinux or gentoo.


So that’s it . sometime old CPU microcodes could cause system instability, very hard to detect what’s wrong, so it’s better to use updated CPU microcode. Please share your experience here, If you have any suggestion or question just say it 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *