| 1 |
intel-microcode for Debian |
| 2 |
-------------------------- |
| 3 |
|
| 4 |
Introduction: |
| 5 |
|
| 6 |
IntelĀ® 64 and IA-32 processors (x86_64 and i686 processors) are capable of |
| 7 |
field-upgrading their control program (microcode) as well as parameters |
| 8 |
for other on-chip subsystems (power management, interconnects, etc). |
| 9 |
These microcode updates correct processor errata, and are important for |
| 10 |
safe, stable and correct system operation. |
| 11 |
|
| 12 |
While most of the microcode updates fix problems that happen extremely |
| 13 |
rarely, they also fix high-profile, high-hitting issues. There are enough |
| 14 |
microcode updates fixing processor errata that would cause system lockup, |
| 15 |
memory corruption, or unpredictable system behavior, to warrant taking |
| 16 |
firmware updates and microcode updates seriously. |
| 17 |
|
| 18 |
Microcode updates are ephemeral: they will be lost after a processor hard |
| 19 |
reset or after the processor is powered off. They must be reapplied at |
| 20 |
every boot, as well as after the system wakes up from suspend to RAM or |
| 21 |
disk. |
| 22 |
|
| 23 |
Updating the processor microcode is the responsibility of the system |
| 24 |
firmware (BIOS, UEFI). However, not all vendors will release timely |
| 25 |
updates for their firmware when Intel releases updated microcode, and most |
| 26 |
users don't update their system firmware in a timely fashion (or at all) |
| 27 |
anyway. |
| 28 |
|
| 29 |
The end result is that, unless the operating system picks up the slack and |
| 30 |
tries to deliver microcode updates, the processor in many systems will be |
| 31 |
running with outdated microcode, increasing the chances of incorrect |
| 32 |
system operation. |
| 33 |
|
| 34 |
|
| 35 |
Using Debian to apply microcode updates: |
| 36 |
|
| 37 |
Debian can apply microcode updates to the system processors during the |
| 38 |
operating system boot when a correctly configured Linux kernel (such as |
| 39 |
the standard Debian Linux kernels), and a small set of extra packages from |
| 40 |
"non-free" and "contrib" are installed. |
| 41 |
|
| 42 |
You must have "contrib" and "non-free" repositories enabled in apt's |
| 43 |
sources list (either in /etc/apt/sources.list, or in a file inside |
| 44 |
/etc/apt/sources.list.d/). |
| 45 |
|
| 46 |
On a default Debian system (which uses a Debian kernel, the grub |
| 47 |
bootloader, and initramfs-tools to create the initramfs for the kernel), |
| 48 |
install the "intel-microcode" package and its dependencies, and reboot. |
| 49 |
|
| 50 |
Users of custom configurations should note that microcode update support |
| 51 |
for Debian 8 "Jessie" changed from previous Debian stable releases. |
| 52 |
|
| 53 |
Custom Linux kernels must be built with initramfs support enabled (Kconfig |
| 54 |
option CONFIG_BLK_DEV_INITRD=y), as well as early microcode support |
| 55 |
enabled (Kconfig options CONFIG_MICROCODE=y, CONFIG_MICROCODE_INTEL=y, |
| 56 |
CONFIG_MICROCODE_INTEL_EARLY=y). An initramfs image *must* be used. |
| 57 |
|
| 58 |
The use of "dracut" to generate the initramfs is not yet supported, but it |
| 59 |
should work if you have a new enough version of dracut that is compatible |
| 60 |
with the kernel you are using (i.e. it might require the use of |
| 61 |
backports). Dracut will have to be manually configured to enable early |
| 62 |
microcode updates. Better dracut support is planned for a future version |
| 63 |
of the intel-microcode package. |
| 64 |
|
| 65 |
NOTE: It is not impossible for an operating-system supplied microcode |
| 66 |
update to cause boot issues. Should that happen, please refer to the |
| 67 |
"RECOVERY PROCEDURE" section of this document. |
| 68 |
|
| 69 |
|
| 70 |
Caveats: |
| 71 |
|
| 72 |
Please keep your UEFI/BIOS up-to-date. Assuming your motherboard vendor |
| 73 |
does a good job of updating system firmware components, an up-to-date |
| 74 |
version of the firmware will negate most of the caveats listed here. |
| 75 |
|
| 76 |
Some features added to the processor post-launch, such as Intel SGX for |
| 77 |
"Skylake", are likely to require a full firmware update to work. Some |
| 78 |
issues and errata can only be fixed by a full firmware update should they |
| 79 |
require fixes and workarounds outside of the processor microcode update |
| 80 |
(typically: ME firmware, SMM code, platform MSR setup, ACPI data, Intel |
| 81 |
TXT/SGX modules). |
| 82 |
|
| 83 |
A microcode update may enable functionality or change the behavior of |
| 84 |
weakly-defined functionality (such as the effect of model-dependent CPU |
| 85 |
power-management MSRs). This can (very rarely) interact badly with |
| 86 |
outdated BIOS/UEFI. |
| 87 |
|
| 88 |
A microcode update can revoke the signatures of vulnerable Intel TXT ACMs |
| 89 |
(refer to security advisory INTEL-SA-00035) and Intel SGX system modules. |
| 90 |
This will disable Intel TXT and Intel SGX in a system that still has the |
| 91 |
vulnerable components in firmware (the only way to really fix the |
| 92 |
vulnerabilities is to update the firmware). |
| 93 |
|
| 94 |
Microcode updates often do not go well with overclocking and similar |
| 95 |
tuning (such as underclocking, "undervolting", etc). Reset the system to |
| 96 |
Intel's *up-to-date* recommended values should a microcode update seem to |
| 97 |
be causing trouble, and search for a less aggressive, stable operating |
| 98 |
point for the new microcode. |
| 99 |
|
| 100 |
A microcode update can (very rarely) interact badly with, or expose |
| 101 |
software bugs in the kernel and on frequency/thermal control daemons. |
| 102 |
|
| 103 |
|
| 104 |
RECOVERY PROCEDURE: |
| 105 |
|
| 106 |
It is possible for a microcode update to not work well, or to not work at |
| 107 |
all on specific system models. This is very rare when using early |
| 108 |
microcode updates, but it has happened at least once. |
| 109 |
|
| 110 |
Should you experience problems because of the microcode update, you will |
| 111 |
have to bypass the microcode update process that happens during operating |
| 112 |
system startup (boot), and remove (or install an older version of) the |
| 113 |
intel-microcode package. |
| 114 |
|
| 115 |
To bypass the microcode update during system startup, you must instruct the |
| 116 |
boot loader (grub, lilo, etc) to pass the "dis_ucode_ldr" parameter |
| 117 |
(without the quotes) to the kernel. |
| 118 |
|
| 119 |
If your system uses grub (the default bootloader in Debian): |
| 120 |
|
| 121 |
1. Access the grub menu during boot (press and hold the left "Shift" |
| 122 |
key right after starting the system up if you don't see a grub menu |
| 123 |
during boot); |
| 124 |
|
| 125 |
2. Move the highlight/cursor to the kernel/boot option you want to |
| 126 |
use, and press the "e" key to edit it; |
| 127 |
|
| 128 |
3. Locate the line that starts with "linux" using the cursor |
| 129 |
keys. You must add the word "dis_ucode_ldr" (without the quotes) to |
| 130 |
the end of that line; |
| 131 |
|
| 132 |
4. Press "Ctrl+X" to start (boot) the system. The microcode updates |
| 133 |
will be skipped. |
| 134 |
|
| 135 |
After the system is running, remove or purge the intel-microcode package, |
| 136 |
or alternatively install an older version of the intel-microcode package. |
| 137 |
|
| 138 |
If removing or purging the intel-microcode package fails to do it for some |
| 139 |
reason, please refresh the initramfs using the "update-initramfs -u" |
| 140 |
command (as the root user), and possibly "update-initramfs -u -k <desired |
| 141 |
kernel version>" or "update-initramfs -u -k all". |
| 142 |
|
| 143 |
Please report any issues caused by microcode updates to the Debian bug |
| 144 |
tracker, e.g. using the "reportbug" tool. |
| 145 |
|
| 146 |
|
| 147 |
Microcode update details: |
| 148 |
|
| 149 |
The "early mode" of the Linux kernel microcode update driver will apply |
| 150 |
the microcode updates as soon as possible, before making use of the more |
| 151 |
complex modes and functionality of the system processors. This greatly |
| 152 |
reduces the chances of system malfunction due to any issues that are |
| 153 |
corrected by the microcode update. |
| 154 |
|
| 155 |
It will update the CPU core that boots the system (known as BSP, for |
| 156 |
"bootstrap processor") as one of the first things it does. It will also |
| 157 |
update the microcode on the other CPU cores (known as AP, for "application |
| 158 |
processor") while enabling them, before they can be used. |
| 159 |
|
| 160 |
In some cases, early microcode updates will allow the kernel to sidestep |
| 161 |
the need to disable functionality, as an example, there's the "Atom PSE |
| 162 |
erratum". |
| 163 |
|
| 164 |
In other cases, it will be the only safe way to apply a microcode update. |
| 165 |
For example, the Intel TSX errata in Intel Haswell and Broadwell processors |
| 166 |
required a microcode update that entirely disables Intel TSX. Applying the |
| 167 |
microcode update will crash anything that might be using Intel TSX at that |
| 168 |
time. |
| 169 |
|
| 170 |
The initramfs helpers will attempt to restrict the number of microcode |
| 171 |
updates added to the initramfs to the bare minimum through the use of |
| 172 |
iucode_tool. This behavior can be changed and fine-tuned through the |
| 173 |
/etc/default/intel-microcode file. |
| 174 |
|
| 175 |
Also, microcode from files matching /usr/share/misc/intel-microcode* will |
| 176 |
be considered. This allows the easy use of microcode.dat files distributed |
| 177 |
directly by Intel. Be careful to not leave old files there, or you may end |
| 178 |
up using microcode that Intel stopped distributing on purpose for unknown |
| 179 |
reasons. |
| 180 |
|
| 181 |
|
| 182 |
Downloading new microcode data from Intel: |
| 183 |
|
| 184 |
A new version of the microcode bundle can be downloaded directly from |
| 185 |
Intel (through their GitHub project): |
| 186 |
https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files |
| 187 |
|
| 188 |
|
| 189 |
To manually install the downloaded microcode bundle, unpack the archive you |
| 190 |
got from Intel and copy the microcode-*.dat file from the archive to |
| 191 |
/usr/share/misc/intel-microcode.dat. |
| 192 |
|
| 193 |
You should make sure the microcode data file is owned by root, and that it |
| 194 |
can only be written to by root (e.g. mode 0644) for security reasons: |
| 195 |
|
| 196 |
chown root:root /usr/share/misc/intel-microcode.dat |
| 197 |
chmod 0644 /usr/share/misc/intel-microcode.dat |
| 198 |
|
| 199 |
After you install the updated intel-microcode.dat file, run as root: |
| 200 |
|
| 201 |
update-initramfs -u |
| 202 |
|
| 203 |
The intel-microcode package supports "extra" microcode data in the |
| 204 |
following files (and will warn you if it detects and use them): |
| 205 |
|
| 206 |
/usr/share/misc/intel-microcode* |
| 207 |
|
| 208 |
both .dat and .bin formats are supported. |
| 209 |
|
| 210 |
|
| 211 |
Triggering an immediate microcode update (without a reboot): |
| 212 |
|
| 213 |
**** WARNING **** **** WARNING **** **** WARNING **** **** WARNING **** |
| 214 |
|
| 215 |
This procedure used to be safe before microcode update 20140913. |
| 216 |
It is not safe anymore in the general case. |
| 217 |
|
| 218 |
While it is likely to continue to be safe for the Intel micro- |
| 219 |
architectures that preceded Haswell and Silvermont, this is not |
| 220 |
in any way assured. |
| 221 |
|
| 222 |
You have been warned. Do not do this unless you really know |
| 223 |
what you are doing. |
| 224 |
|
| 225 |
**** WARNING **** **** WARNING **** **** WARNING **** **** WARNING **** |
| 226 |
|
| 227 |
The microcode kernel module will attempt to apply a microcode update when |
| 228 |
loaded by "modprobe". If the module is already loaded or compiled-in (it |
| 229 |
cannot be a module anymore in recent Linux kernels), run this command (as |
| 230 |
root): |
| 231 |
|
| 232 |
echo -n 1 >/sys/devices/system/cpu/microcode/reload |
| 233 |
|
| 234 |
For kernels before Linux v3.6, refer to the iucode_tool(8) manpage. |
| 235 |
|
| 236 |
|
| 237 |
* Note: Intel is a registered trademark of Intel Corporation. |
| 238 |
|
| 239 |
-- Henrique de Moraes Holschuh <[email protected]> Sun, 10 Apr 2016 16:32:09 -0300 |