Permanently set Linux monitor resolution for headless operation

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

The Linux kernel uses a technology called Kernel Mode Setting for the configuration of the display mode (resolution, color depth, repetition rate) and display controller (graphic card). In the standard configuration, the kernel reads out the Extended Display Identification Data (EDID)[1] of the connected monitor to set the best possible configuration automatically. If a Linux system is started without connected monitor, due to the lack of EDID information during startup, the screen may remain black after connecting a monitor. In this article, we explain how to solve this problem.

Description of problem

The following hardware and software components are used in certain test cases:

  • Product not available anymore (server with 2 display-port connection)
  • Kubuntu 16.04.2

The system is shut down after installation and the monitor is locked. The system is then started (Headless operation). Afterwards, the monitor is connected, but the screen remains black.

Solution

In the graphic settings, you will find information on the display-name and on the resolution ("DP-1" as well as "1680x1050" as in the example). This information is required for the entry in the /etc/default/grub file.

Perform the following steps to ensure that the display works even if the monitor is connected after the system has been started up:[2]

  1. Read out the EDID-files when the monitor is connected.
    sudo get-edid > monitor.edid
    (If desired, the data can be displayed with parse-edid < monitor.edid in readable form.)
  2. Copy the data into the firmware-directory:
    sudo mkdir /lib/firmware/edid
    sudo cp monitor.edid /lib/firmware/edid/
  3. Add a drm_kms_helper.edid_firmware entry to the GRUB_CMDLINE_LINUX_DEFAULT line in the /etc/default/grub file:
    sudo vi /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash drm_kms_helper.edid_firmware=edid/monitor.edid video=DP-1:1680x1050@60D"
    You have to adapt the video= parameter to your harware-configuration. The display-name (in our example "DP-1") and the resolution can be found in the graphic settings (picture above). Alternatively, you will find information on the display-name also via /sys file-system:
    cd /sys
    find -iname *edid*
  4. Update the Grub-configuration
    sudo update-grub
  5. You can shut down the system and disconnect the monitor. If you restart the system and connect the monitor afterwards, the screen display functions.

EDID examples

You will find the EDID of two monitors as example:

iiyama ProLite B2480HS

EDID file: File:Iiyama-ProLite-B2480HS.edid.zip

Output of parse-edid:

$ parse-edid < iiyama-ProLite-B2480HS.edid 
Checksum Correct

Section "Monitor"
	Identifier "PL2480H"
	ModelName "PL2480H"
	VendorName "IVM"
	# Monitor Manufactured week 40 of 2012
	# EDID version 1.3
	# Digital Display
	DisplaySize 520 290
	Gamma 2.20
	Option "DPMS" "true"
	Horizsync 30-83
	VertRefresh 55-76
	# Maximum pixel clock is 170MHz
	#Not giving standard mode: 1920x1080, 60Hz
	#Not giving standard mode: 1280x1024, 60Hz
	#Not giving standard mode: 1440x900, 60Hz
	#Not giving standard mode: 1680x1050, 60Hz
	#Not giving standard mode: 1280x960, 60Hz
	#Not giving standard mode: 1152x864, 75Hz
	#Not giving standard mode: 1440x900, 75Hz
	Modeline 	"Mode 0" 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync 
EndSection

BenQ BL2201

EDID file: File:BenQ-BL2201.edid.zip

Output of parse-edid:

$ parse-edid < BenQ-BL2201.edid 
Checksum Correct

Section "Monitor"
	Identifier "BenQ BL2201"
	ModelName "BenQ BL2201"
	VendorName "BNQ"
	# Monitor Manufactured week 47 of 2013
	# EDID version 1.4
	# Digital Display
	DisplaySize 480 300
	Gamma 2.20
	Option "DPMS" "true"
	Horizsync 30-83
	VertRefresh 50-76
	# Maximum pixel clock is 170MHz
	#Not giving standard mode: 1152x720, 60Hz
	#Not giving standard mode: 1280x800, 60Hz
	#Not giving standard mode: 1280x800, 75Hz
	#Not giving standard mode: 1280x1024, 60Hz
	#Not giving standard mode: 1600x900, 60Hz
	#Not giving standard mode: 1680x1050, 60Hz
	Modeline 	"Mode 0" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync 
EndSection

References

More information


Author: Werner Fischer

Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.


Translator: Alina Ranzinger

Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.


Related articles

ATA exception Emask
Recreate Linux root password
SSD firmware update with storcli