Kernel mode setting

Kernel Mode Setting (KMS) is a method for setting display resolution and depth in the kernel space rather than user space.

The Linux kernel's implementation of KMS enables native resolution in the framebuffer and allows for instant console (tty) switching. KMS also enables newer technologies (such as DRI2) which will help reduce artifacts and increase 3D performance, even kernel space power-saving.

Note: The proprietary NVIDIA driver (since 364.12) also implements kernel mode-setting, but it does not use the built-in kernel implementation and it lacks an fbdev driver for the high-resolution console.


Previously, setting up the video card was the job of the X server. Because of this, it was not easily possible to have fancy graphics in virtual consoles. Also, each time a switch from X to a virtual console was made (Ctrl+Alt+F2), the server had to give control over the video card to the kernel, which was slow and caused flickering. The same "painful" process happened when the control was given back to the X server (Alt+F7 when X runs in VT7).

With Kernel Mode Setting (KMS), the kernel is now able to set the mode of the video card. This makes fancy graphics during bootup, virtual console and X fast switching possible, among other things.


At first, note that for any method you use, you should always disable:

  • Any vga= options in your bootloader as these will conflict with the native resolution enabled by KMS.
  • Any video= lines that enable a framebuffer that conflicts with the driver.
  • Any other framebuffer drivers (such as uvesafb).

Late KMS start

Intel, Nouveau, ATI and AMDGPU drivers already enable KMS automatically for all chipsets, so you need not install it manually.

The proprietary NVIDIA driver supports KMS (since 364.12), which has to be manually enabled.

Early KMS start

KMS is typically initialized after the initramfs stage. However, it is possible to enable KMS already during the initramfs stage. Add the required module for the video driver to the initramfs configuration file:

  • for Matrox graphics.
  • Depending on QEMU graphics in use (qemu option or libvirt ):
    • for (qemu) and / (libvirt),
    • for virtio,
    • for ,
    • vmwgfx for (qemu) and (libvirt),
    • for .
  • Depending on VirtualBox graphics controller:
    • vmwgfx for VMSVGA,
    • for VBoxVGA or VBoxSVGA.

Initramfs configuration instructions are slightly different depending on the initramfs generator you use.


For in-tree modules, add to the HOOKS array in .

For out-of-tree modules, place the module names in the MODULES array. For example, to enable early KMS for the NVIDIA graphics driver:

If you are using the #Forcing modes and EDID method, you should embed the custom file into initramfs as well:


Then regenerate the initramfs.


If you use Booster, you can load required modules with this config change:

To add extra files to the image:

Then regenerate the booster images.


My fonts are too tiny

See Linux console#Fonts for how to change your console font to a large font. The Terminus font (terminus-font) is available in many sizes, such as which is larger.

Alternatively, disabling modesetting might switch to lower resolution and make fonts appear larger.

Problem upon bootloading and dmesg

Polling for connected display devices on older systems can be quite expensive. Poll will happen periodically and can in worst cases take several hundred milliseconds, depending on the hardware. This will cause visible stalls, for example in video playback. These stalls might happen even when your video is output to a sophisticated high end HDP device, but you have other non HDP devices in your hardware configuration. If you experience stalls in display output occurring every 10 seconds, disabling polling might help.

If you see an error code of while booting up, (you will get about 10 lines of text, the last part denoting that error code), use:

Forcing modes and EDID

If your native resolution is not automatically configured or no display at all is detected, then your monitor might send none or just a skewed EDID file. The kernel will try to catch this case and will set one of the most typical resolutions.

In case you have the EDID file for your monitor, you merely need to explicitly enforce it (see below). However, most often one does not have direct access to a sane file and it is necessary to either extract an existing one and fix it or to generate a new one.

Generating new EDID binaries for various resolutions and configurations is possible during kernel compilation by following the upstream documentation (also see here for a short guide). Other solutions are outlined in details in this article. Extracting an existing one is in most cases easier, e.g. if your monitor works fine under Windows, you might have luck extracting the EDID from the corresponding driver, or if a similar monitor works which has the same settings, you may use from the package. You can also try looking in .

After having prepared your EDID, place it in a directory, e.g. called edid under and copy your binary into it.

To load it at boot, specify the following in the kernel command line:


For kernels older than 4.13, use this line instead:


In order to apply it only to a specific connector, use:


For the built-in resolutions, refer to the table below. The Name column specifies the name which one is supposed to use in order to enforce its usage.

1600x1200 (kernel 3.10 or higher)edid/1600x1200.bin

If you are doing early KMS, you must include the custom EDID file in the initramfs, otherwise you will run into problems.

The value of the parameter may also be altered after boot by writing to :

# echo edid/your_edid.bin > /sys/module/drm/parameters/edid_firmware

This will only take affect for newly plugged in displays, already plugged-in screens will continue to use their existing EDID settings. For external displays, replugging them is sufficient to see the effect however.

Since kernel 3.15, to load an EDID after boot, you can use debugfs instead of a kernel command line parameter if the kernel is not in lockdown mode. This is very useful if you swap the monitors on a connector or just for testing. Once you have an EDID file as above, run:

# cat correct-edid.bin > /sys/kernel/debug/dri/0/HDMI-A-2/edid_override

And to disable:

# echo -n reset > /sys/kernel/debug/dri/0/HDMI-A-2/edid_override

Forcing modes

From the nouveau wiki:

A mode can be forced on the kernel command line. Unfortunately, the command line option video is poorly documented in the DRM case. Bits and pieces on how to use it can be found in

The format is:

  • : Connector, e.g. DVI-I-1, see /sys/class/drm/ for available connectors
  • : resolution
  • : compute a CVT mode?
  • : reduced blanking?
  • -<bpp>: color depth
  • : refresh rate
  • : interlaced (non-CVT mode)
  • : margins?
  • : output forced to on
  • : output forced to off
  • D: digital output forced to on (e.g. DVI-I connector)

You can override the modes of several outputs using video= several times, for instance, to force to 1024x768 at 85 Hz and off:

video=DVI-I-1:1024x768@85 video=TV-1:d

To get the name and current status of connectors, you can use the following shell oneliner:

Disabling modesetting

You may want to disable KMS for various reasons. To disable KMS, add as a kernel parameter. See Kernel parameters for more info.

Along with the kernel parameter, for an Intel graphics card, you need to add i915.modeset=0, and for an Nvidia graphics card, you need to add . For Nvidia Optimus dual-graphics system, you need to add all the three kernel parameters (i.e. ).

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.