[Bug 1711452] Re: grub.cfg falls back to 'text' video mode on UEFI which is not supported

Mathieu Trudel-Lapierre mathieu.tl at gmail.com
Fri Feb 9 18:53:42 UTC 2018


I've been attempting to test this locally on hardware and in a
virtualized environment (Hyper-V to be precise), and I can't reproduce
the failure case. This makes it hard to test that my fix works.

So, what I can tell is that while we can also change the grub config
itself, it looks like 'text' is not being properly skipped in the EFI
case, where it's already known not to be supported. I have an untested
(see above) patch to fix that.

Could you please attach a grub.cfg that is affected, and tell more about
the system on which this is happening?

It looks to me like just forcing 'set gfxpayload=text' does not cause
the warning message to appear (or it shows up and quickly disappears,
too quickly to be noticeable). I have also tried setting console=ttyS2
(some other device I knew would not be connected) to avoid text being
obliterated by kernel messages, but it still does not exhibit the
failure behavior.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1711452

Title:
  grub.cfg falls back to 'text' video mode on UEFI which is not
  supported

Status in grub2 package in Ubuntu:
  Triaged

Bug description:
  The grub.cfg generated by update-grub for both UEFI and BIOS includes
  the following logic:

  ### BEGIN /etc/grub.d/10_linux ###
  function gfxmode {
          set gfxpayload="${1}"
          if [ "${1}" = "keep" ]; then
                  set vt_handoff=vt.handoff=7
          else
                  set vt_handoff=
          fi
  }
  if [ "${recordfail}" != 1 ]; then
    if [ -e ${prefix}/gfxblacklist.txt ]; then
      if hwmatch ${prefix}/gfxblacklist.txt 3; then
        if [ ${match} = 0 ]; then
          set linux_gfx_mode=keep
        else
          set linux_gfx_mode=text
        fi
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=keep
    fi
  else
    set linux_gfx_mode=text
  fi
  export linux_gfx_mode

  [...]

  menuentry [...]
      gfxmode $linux_gfx_mode

  This means that in some cases, we are calling 'set gfxpayload="text"'
  on UEFI systems.

  However, grub-core/loader/i386/linux.c has:

  #ifdef GRUB_MACHINE_EFI
  #include <grub/efi/efi.h>
  #define HAS_VGA_TEXT 0
  #define DEFAULT_VIDEO_MODE "auto"
  #define ACCEPTS_PURE_TEXT 0
  #elif [...]

  and if ACCEPTS_PURE_TEXT is 0, grub_linux_boot() masks
  GRUB_VIDEO_MODE_TYPE_PURE_TEXT out of the allowed set when calling
  grub_video_set_mode().

  So our generated grub.cfg should *never* be setting gfxpayload=text on
  a UEFI system.  If we do, we get the following error message from grub
  at boot:

  error: invalid video mode specification `text'.
  Booting in blind mode

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1711452/+subscriptions



More information about the foundations-bugs mailing list