[Bug 1771651] Re: The installation fails with a "GRUB installation failed" message.

Fred Palmer 1771651 at bugs.launchpad.net
Thu May 17 15:26:53 UTC 2018


Issue is really that to boot in UEFI mode you should have gpt.
And most systems now have gpt as windows in UEFI mode requires gpt. But if installing in BIOS/Legacy/CSM boot mode to gpt drive, you must have a bios_grub partition which is only 1 or 2MB unformatted with bios_grub flag.

Or if installing in UEFI boot mode to gpt drive, you must have an ESP -
efi system partition which is fat32 with boot flag.

If you do not have correct partitions for boot mode, then grub install fails.
Boot-Repair will tell you that you need the correct partition, and grub should at least explain why it is not installing, like Boot-Repair does.

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

Title:
  The installation fails with a "GRUB installation failed" message.

Status in grub-installer package in Ubuntu:
  Confirmed

Bug description:
  Release: Ubuntu 18.04 LTS (Bionic Beaver)
  Summary: The installation fails with a "GRUB installation failed" message. 
           Workaround available, see below.

  Since 16.04 installed fine, you could see this as a regression...

  * System setup (relevant part only)
  - UEFI enabled
  - Secure Boot disabled
  - SSD with a pre-install MBR (msdos) partition layout
  /dev/sda
    /dev/sda1  ext4  /      (format)
    /dev/sda2  ext4  /home  (do NOT format)
    /dev/sda3  swap

  * During the install (relevant part only)
  - Installation type: select "Manual"
  - Prepare partitions: see layout above

  >>> What I expected to happen: installation success!
  >>> What happened instead: (see below)

  After the complete installation is done, an alert box pops up:

  Alert box: GRUB installation failed
  """
  The 'grub-efi-amd64-signed' package failed to install into /
  target/. Without the GRUB boot loader, the installed system will
  not boot.
  """
  Button: OK

  Side note: I think this alert box fails to fill in the "/target/"
  part...

  After clicking on [OK] an "Installer Crashed" window appears. Before I
  can read anything, the window disappears. (This also looks like a
  bug!). Then the installer flips back to the live desktop with the
  "Install" icon on the desktop.

  I reboot the system. The next error appears:

  """
  error: file '/boot/grub/i386-pc/normal.mod' not found.
  Entering rescue mode...
  grub rescue>
  """

  At this point I can't do anything because grub is missing files! I
  consider this also a bug, the installer should always install GRUB
  full because failures are unforeseen by their very nature. You should
  always have a full GRUB installation available when this happens, even
  when the installer assumes(!) it's doing the right thing... Do -not-
  assume Murphy's law doesn't apply to you, because then it will hit you
  even harder...

  My guess on what went wrong:

  The installer detected that UEFI was enabled, then (wrongly)
  assumed/detected that Secure Boot was also enabled. Then logic
  dictates (...) that the HDD/SSD should be a GPT disk with the
  appropriate layout and (wrongly) "thinks" MBR is not an option. Now
  GRUB fails because it encounters a MBR disk.

  ======================
  === The Workaround ===
  ======================

  The simple workaround is; use a GPT disk with the appropriate
  partition layout. When using a GPT disk with the appropriate partition
  layout is not an option, then use this three step workaround:

  1) Fix the wrong GRUB installation
  2) Manual boot the system with GRUB
  3) Run update-grub so the system will boot correctly

  * Step 1: Fix the wrong GRUB installation

  - Boot into the live desktop
  - Open a terminal
  - Find the boot disk... 
    ...in this case it is: /dev/sda
  - Find the partition where /boot is installed... 
    ...in this case it is: /dev/sda1
  - Now run the commands:
    (replace /dev/sda1 and /dev/sda with the appropriate values)

  sudo mount /dev/sda1 /mnt
  sudo grub-install --boot-directory=/mnt/boot /dev/sda

  * Step 2: Manual boot the system with GRUB

  - Boot the system, the "grub>" prompt should appear.
  - Find the partition where /boot is installed...
    ...in this case it is: (hd0,msdos1)
  - Find the partition where / is installed...
    ...in this case it is: /dev/sda1
  - Heads-up: pay attention to the "ls" commands, 
    the vmlinuz and initrd filenames may differ!
  - Now run the commands:

  ls
  ls (hd0,msdos1)/boot
  set root=(hd0,msdos1)
  linux /boot/vmlinuz-4.15.0-20-generic root=/dev/sda1
  initrd /boot/initrd.img-4.15.0-20-generic
  boot

  - The system should boot now...

  * Step 3: Run grub so the system will boot automatically

  - The system is now booted
  - Open a terminal
  - Now run the command:

  sudo update-grub

  - Now reboot the system
  - The system will boot normally now ... if everything went well...

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/1771651/+subscriptions



More information about the foundations-bugs mailing list