Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have Linux Mint 17 on my laptop. Also I have 22'' monitor connected to laptop using HDMI cable. My disk if fully encrypted with LUKS and LVM. On boot I get graphical prompt to enter password for encrypted partitions. Screen resolution on on both laptop and external monitor is wrong when asking for password. Graphical prompt and linux mint logo is moved to top left corner on both monitors and rest of space is black. Resolution is correct only after I log in to my profile. This is what xrandr shows when I'm logged in:

Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 32767 x 32767
LVDS1 connected 1366x768+1920+312 (normal left inverted right x axis y axis) 344mm x 194mm
   1366x768       60.1*+   40.1
   1360x768       59.8     60.0
   1024x768       60.0
   800x600        60.3     56.2
   640x480        59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 298mm
   1920x1080      60.0*+
   1680x1050      59.9
   1600x900       60.0
   1280x1024      75.0     60.0
   1280x800       59.9
   1152x864       75.0
   1280x720       60.0
   1024x768       75.1     60.0
   832x624        74.6
   800x600        75.0     60.3
   640x480        75.0     60.0
   720x400        70.1
DP1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

After mounting encrypted disk I can change resolution on monitors using xrandr command. But this command is unavailable with initramfs.

I was recently fixing another laptop screen brightness on boot using initramfs script and it worked. This script was setting brightness by echoing correct value to to /sys/class/backlight/acpi_video0/brightness. Can I also use something similar to change screen resolution somehow?

UPDATE

I've tried @mikeserv solution:

  1. EDID files from monitors (not sure if they are correct):

    # cat /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/edid > /lib/firmware/edid/1366x768.bin
    # cat /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1/edid > /lib/firmware/edid/1920x1080.bin
    
    # hexdump /lib/firmware/edid/1366x768.bin
    0000000 ff00 ffff ffff 00ff e430 033b 0000 0000
    0000010 1600 0401 2290 7813 610a 9ed5 5b5e 269a
    0000020 501a 0054 0000 0101 0101 0101 0101 0101
    0000030 0101 0101 0101 1de2 b456 0050 3038 3024
    0000040 0035 c258 0010 1900 13ec c656 0050 302e
    0000050 3024 0035 c258 0010 1900 0000 fe00 3500
    0000060 4833 3935 3180 3635 4857 0a34 0000 0000
    0000070 0000 3141 0096 0000 0100 0a01 2020 ac00
    0000080
    
    # hexdump /lib/firmware/edid/1920x1080.bin 
    0000000 ff00 ffff ffff 00ff d109 78a5 5445 0000
    0000010 1626 0301 3580 781e b72e a4d5 5456 279f
    0000020 500c a554 806b 0081 c081 8081 c0a9 00b3
    0000030 c0d1 0101 0101 3a02 1880 3871 402d 2c58
    0000040 0045 2a13 0021 1e00 0000 ff00 4c00 4339
    0000050 3030 3537 3039 3931 200a 0000 fd00 3200
    0000060 1e4c 1153 0a00 2020 2020 2020 0000 fc00
    0000070 4200 6e65 2051 4c47 3432 3035 200a d900
    0000080
    
  2. Hook script for initramfs, loads i915 module and include EDID files into /lib/firmware/edid/ directory inside initramfs (I've checked and EDID files are inside initramfs)

    # cat /etc/initramfs-tools/hooks/include-edid-data 
    #!/bin/sh
    
    PREREQ="udev"
    prereqs()
    {
       echo "$PREREQ"
    }
    
    case $1 in
    prereqs)
       prereqs
       exit 0
       ;;
    esac
    
    . /usr/share/initramfs-tools/hook-functions
    # Begin real processing below this line
    
    if [ ! -e "${DESTDIR}/lib/firmware/edid" ]; then
        mkdir -p "${DESTDIR}/lib/firmware/edid"
    fi
    
    if [ -r "/lib/firmware/edid/1366x768.bin" ]; then
       cp "/lib/firmware/edid/1366x768.bin" "${DESTDIR}/lib/firmware/edid/"
    fi
    
    if [ -r "/lib/firmware/edid/1920x1080.bin" ]; then
       cp "/lib/firmware/edid/1920x1080.bin" "${DESTDIR}/lib/firmware/edid/"
    fi
    
    manual_add_modules i915
    
    exit 0
    
    # chmod a+rx /etc/initramfs-tools/hooks/include-edid-data
    # update-initramfs -u
    
  3. On reboot I've added boot parameter (not sure if it should be HDMI-1 or HDMI1 or something else)

    drm_kms_helper.edid_firmware=HDMI1:/lib/firmware/edid/1920x1080.bin
    
  4. It didn't change anything. So I also tried:

    drm_kms_helper.edid_firmware=HDMI-1:/lib/firmware/edid/1920x1080.bin
    drm_kms_helper.edid_firmware=HDMI1:edid/1920x1080.bin
    drm_kms_helper.edid_firmware=HDMI-1:edid/1920x1080.bin
    

No luck at all. Everything is like it was before I took steps from above.

I also want to add that when HDMI monitor id disconnected resolution on laptop monitor is correct.

What am I doing wrong?

UPDATE 2

Still not working. Steps I took:

  1. Found out correct names for my monitors:

    $ for p in /sys/class/drm/*/status; do if [ "$(cat "$p")" == "connected" ]; then echo -n "$p" | awk -F '/' '{print $5}'; fi; done
    card0-HDMI-A-1
    card0-LVDS-1
    
  2. Install linux-doc (to get docs describing creation of custom EDID), dos2unix, make (for compiling EDID files) packages

    $ sudo apt-get install linux-doc dos2unix make
    
  3. Create temporary directory for compilation and copy source files for EDID

    $ mkdir ~/Tmp/edid
    $ cd ~/Tmp/edid
    $ cp /usr/share/doc/linux-doc/EDID/* .
    $ rm *.S
    $ cp /usr/share/doc/linux-doc/EDID/1920x1080.S .
    $ cp /usr/share/doc/linux-doc/EDID/1920x1080.S 1366x768.S
    
  4. Edit file 1366x768.S with correct values, compile, copy to /lib/firmware/edid:

    • Obtain current working modeline for my laptop screen

      $ xvidtune -show
      "1366x768"     76.50   1366 1402 1450 1546    768  771  776  824 -hsync -vsync
      

      They are in turn: resolution, clock MHz, hdisp, hsyncstart, hsyncend, htotal, vdisp, vsyncstart, vsyncend, vtotal

    • Calculate values:

      CLOCK = 76500
      XPIX    = hdisp                               = 1366
      XBLANK  = htotal - hdisp        = 1546 - 1366 = 180
      XOFFSET = hsyncstart - hdisp    = 1402 - 1366 = 36
      XPULSE  = hsyncend - hsyncstart = 1450 - 1402 = 48
      
      YPIX    = vdisp = 768
      YBLANK  = vtotal - vdisp             = 824 - 768      = 56
      YOFFSET = 63 + vsyncstart - vdisp    = 63 + 771 - 768 = 66
      YPULSE  = 63 + vsyncend - vsyncstart = 63 + 776 - 771 = 68
      
      TIMING_NAME "Linux HDR"
      CRC 0xcd
      
    • Final version 1366x768.S:

      $ cat 1366x768.S
      /* EDID */
      #define VERSION 1
      #define REVISION 3
      
      /* Display */
      #define CLOCK 76500 /* kHz */
      #define XPIX 1366
      #define YPIX 768
      #define XY_RATIO XY_RATIO_16_9
      #define XBLANK 180
      #define YBLANK 56
      #define XOFFSET 36
      #define XPULSE 48
      #define YOFFSET 66
      #define YPULSE 68
      #define DPI 96
      #define VFREQ 60 /* Hz */
      #define TIMING_NAME "Linux HDR"
      #define ESTABLISHED_TIMINGS_BITS 0x00 /* none */
      #define HSYNC_POL 1
      #define VSYNC_POL 1
      #define CRC 0xcd
      
      #include "edid.S"
      
    • Compile files and check if no errors using edid-decode (sudo apt-get install edid-decode):

      $ make clean && make
      rm 1920x1080.o 1366x768.o
      
      $ ls -1 *.bin
      1366x768.bin
      1920x1080.bin
      
      $ edid-decode 1366x768.bin
      Extracted contents:
      header:          00 ff ff ff ff ff ff 00
      serial number:   31 d8 00 00 00 00 00 00 05 16
      version:         01 03
      basic params:    6d 23 14 78 ea
      chroma info:     5e c0 a4 59 4a 98 25 20 50 54
      established:     00 00 00
      standard:        8b c0 01 01 01 01 01 01 01 01 01 01 01 01 01 01
      descriptor 1:    e2 1d 56 b4 50 00 38 30 24 30 35 00 63 c8 10 00 00 1e
      descriptor 2:    00 00 00 ff 00 4c 69 6e 75 78 20 23 30 0a 20 20 20 20
      descriptor 3:    00 00 00 fd 00 3b 3d 30 32 08 00 0a 20 20 20 20 20 20
      descriptor 4:    00 00 00 fc 00 4c 69 6e 75 78 20 48 44 52 0a 20 20 20
      extensions:      00
      checksum:        cd
      
      Manufacturer: LNX Model 0 Serial Number 0
      Made week 5 of 2012
      EDID version: 1.3
      Analog display, Input voltage level: 0.7/0.7 V
      Sync: Separate Composite Serration 
      Maximum image size: 35 cm x 20 cm
      Gamma: 2.20
      DPMS levels: Standby Suspend Off
      RGB color display
      First detailed timing is preferred timing
      Established timings supported:
      Standard timings supported:
        1360x816@60Hz
      Detailed mode: Clock 76.500 MHz, 355 mm x 200 mm
                     1366 1402 1450 1546 hborder 0
                      768  771  776  824 vborder 0
                     +hsync +vsync
      Serial number: Linux #0
          Monitor ranges: 59-61HZ vertical, 48-50kHz horizontal, max dotclock 80MHz
      Monitor name: Linux HDR
         Checksum: 0xcd
      
      $ edid-decode 1920x1080.bin
      Extracted contents:
      header:          00 ff ff ff ff ff ff 00
      serial number:   31 d8 00 00 00 00 00 00 05 16
      version:         01 03
      basic params:    6d 32 1c 78 ea
      chroma info:     5e c0 a4 59 4a 98 25 20 50 54
      established:     00 00 00
      standard:        d1 c0 01 01 01 01 01 01 01 01 01 01 01 01 01 01
      descriptor 1:    02 3a 80 18 71 38 2d 40 58 2c 45 00 f4 19 11 00 00 1e
      descriptor 2:    00 00 00 ff 00 4c 69 6e 75 78 20 23 30 0a 20 20 20 20
      descriptor 3:    00 00 00 fd 00 3b 3d 42 44 0f 00 0a 20 20 20 20 20 20
      descriptor 4:    00 00 00 fc 00 4c 69 6e 75 78 20 46 48 44 0a 20 20 20
      extensions:      00
      checksum:        05
      
      Manufacturer: LNX Model 0 Serial Number 0
      Made week 5 of 2012
      EDID version: 1.3
      Analog display, Input voltage level: 0.7/0.7 V
      Sync: Separate Composite Serration 
      Maximum image size: 50 cm x 28 cm
      Gamma: 2.20
      DPMS levels: Standby Suspend Off
      RGB color display
      First detailed timing is preferred timing
      Established timings supported:
      Standard timings supported:
        1920x1152@60Hz
      Detailed mode: Clock 148.500 MHz, 500 mm x 281 mm
                     1920 2008 2052 2200 hborder 0
                     1080 1084 1089 1125 vborder 0
                     +hsync +vsync
      Serial number: Linux #0
          Monitor ranges: 59-61HZ vertical, 66-68kHz horizontal, max dotclock 150MHz
      Monitor name: Linux FHD
         Checksum: 0x5
      
    • Copy files to /lib/firmware/edid

      $ sudo cp *.bin /lib/firmware/edid
      
  5. Update initramfs, hook script should add edid files (they are there, I've checked)

    $ sudo update-initramfs -u
    
  6. On boot, edit grub command line (pressed shift on boot to show grub menu and after press e) from:

    linux   /vmlinuz-3.13.0-24-generic root=/dev/mapper/mint--vg-root ro   quiet splash $vt_handoff
    

    to

    linux   /vmlinuz-3.13.0-24-generic root=/dev/mapper/mint--vg-root ro   quiet splash $vt_handoff drm_kms_helper.edid_firmware=card0-LVDS-1:/lib/firmware/edid/1366x768.bin drm_kms_helper.edid_firmware=card0-HDMI-A-1:/lib/firmware/edid/1920x1080.bin
    

Also I've tried setting it just for one monitor. But no luck at all. I'm starting to think that it is not a problem with resolution but with plymouth image itself. When I see boot image it is not blurred, stretched or anything and Linux mint logo is sharp and clear. It's just smaller than my screen and placed in left top part of my laptop and HDMI screen.

I've found this bug that is really similar to my problem. So I think I must wait for them to fix this.

share|improve this question

1 Answer 1

Your monitor provides information about itself using a digital standard called EDID. The kernel reads this information when detecting a display device and automatically configures its display to match as near as it can the display device's native resolution. LCD devices can, in truth, support only one resolution - their native resolution - and emulate all others. From wikipedia:

Extended display identification data (EDID) is a data structure provided by a digital display to describe its capabilities to a video source (e.g. graphics card or set-top box). It is what enables a modern personal computer to know what kinds of monitors are connected to it. EDID is defined by a standard published by the Video Electronics Standards Association (VESA). The EDID includes manufacturer name and serial number, product type, phosphor or filter type, timings supported by the display, display size, luminance data and (for digital displays only) pixel mapping data.

The problem with this is that very often the provided EDID is wrong or in some way corrupt - this is generally due to lazy or misguided manufacturers that have to program that information into the device's firmware. It may even result from a bad HDMI wire, but the chances of this are much slimmer as a digital cable is much more likely to simply not work at all. But there are other possibilities, if you use KMS you'll likely find this interesting:

Today, with the advent of Kernel Mode Setting, a graphics board is either correctly working because all components follow the standards - or the computer is unusable, because the screen remains dark after booting or it displays the wrong area. Cases when this happens are:

  • The graphics board does not recognize the monitor.

  • The graphics board is unable to detect any EDID data.

  • The graphics board incorrectly forwards EDID data to the driver.

  • The monitor sends no or bogus EDID data.

  • A KVM sends its own EDID data instead of querying the connected monitor.

Adding the kernel parameter "nomodeset" helps in most cases, but causes restrictions later on.

∆That∆ is an excerpt from kernel.org's own HOWTO.txt for KMS EDID's. That text file is located in the same folder as five standard resolution EDID's which you can provide the kernel at boot via a kernel parameter and initramfs in order to bypass your monitor's provided EDID.

If you are using one of the open source display drivers you are using kernel mode setting and can for instance use any of the five KMS EDID resolution bypass presets already mentioned. Alternatively you can provide your own EDID file entirely that the kernel will use instead of the information provided it by the display device.

See this section of the Arch Linux wiki for more information, but probably this AskUbuntu thread would be better targeted toward your distribution.

If you are not using KMS and are instead using either the nvidia or AMD closed-source drivers then, as far as I'm aware, your chances of handling boot-time resolutions reliably are almost nil. It may be possible to configure these in grub or another boot loader before any initramfs image is mounted, but the likelihood that doing so will later interfere with the closed-source drivers' own resolution configuration when X starts is pretty high. If you are very lucky your motherboard manufacturer has kindly provided you a setting in UEFI firmware for configuring boot-time resolution and you can set it there before even any secondary boot-loader such as grub is loaded at all. I've never personally known anyone so lucky as that, though.

share|improve this answer
    
Interesting. I have Intel graphic at work so there should be KMS enabled by default. So all I need to do is enable KMS in intramfs (wiki.archlinux.org/index.php/Intel_Graphics#Kernel_Mode_Setting), find correct EDID files for both monitors, include them to initramfs and add boot parameter drm_kms_helper.edid_firmware=LVDS1:edid/for_LVDS1.bin,HDMI1:edid/for_HDMI1.bin‌​. Is that correct? –  piotrekkr Jun 17 at 19:06
    
@piotrekkr - That should do it, yes. One interesting thing about this is that you can also set them to always be enabled - even when they're not connected - so the X display that would normally be assigned to them when they are can be set to always be enabled whether or not they're there. –  mikeserv Jun 17 at 19:09
    
Thanks for your answer. I'll try it tomorrow. Two more question. Will there be any problems when I disconnect external monitor and use another monitor with different native resolution? Will it try to switch to new resolution or will it stick to old one set by boot option? In your comment you wrote that I can set them to be enabled always. What do you mean by them? EDID files with correct resolutions? –  piotrekkr Jun 17 at 19:25
    
@piotrekkr - Yes, you can configure the display ports that the EDIDs describe to always be active. Regarding the possibility of using other monitors on the same port ... Hmm. I'm not really certain what might happen in that context. I guess the worst case is a reboot to a configuration lacking the kernel parameter would be necessary, but I've never had occasion to find out. –  mikeserv Jun 17 at 19:31
    
I've tried your solution but with no luck. Can you look at my updated question? –  piotrekkr Jun 18 at 8:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.