3

Goal: I am trying to install Ubuntu onto a Dell XPS 8900.

Problem: I can't get through an Ubuntu install without the install interrupting with Unable to install Grub in /dev/sda, Executing 'grub-install /dev/sda failed.' This is a fatal error..

Installer: I am using a flash drive with Ubuntu 22.04 LTS Installer on it. I have tried with a flash drive that I have installed with before and I have tried with a fresh install on another flash drive that I created with the Startup Disk Creator application. Note: I have added nomodeset and acpi=off in my grub command to start the Ubuntu Installer OS.

Attempts to solve:

  • I tried to complete the grub-install myself using some answers on askubuntu. I did the aforementioned fix by exiting the installer prompt (after it failed) and running the commands in the terminal. I was able to successfully complete the grub-install here. However, as the original error happens part way into an install the resulting Ubuntu OS had multiple problems. I had services that would fail or just not start (including but not limited to: networkd-dispatcher.service, NetworkManager.service, fwupd-refresh.service, apparmor.service, caspermd5.services(?) ) and I had left over remnants from the install (for example, an application named Install RELEASE was still in my applications).

    • Note: chrooting into /mnt and running grub-install /dev/sda results in unable to allocate pty: No such device
  • Top answer here suggests clicking Try Ubuntu and the using the Install Ubuntu 24.04 LTS application, which didn't work for me.

  • Top answer here suggests that grub-install is installing to the wrong device, which isn't true for me.

  • I am desperate now, so I updated the BIOS to its most recent update. That didn't do anything.

  • I tried running grub-install prior to running the Try Install application.

    • Note: running sudo grub-install --root-directory /mnt /dev/sda results in grub-instal: error: failed to register the EFI boot entry: Operation not permitted.
    • Also, I worry that even if I could successfully run grub-install prior to running the Ubuntu Installer, that the Ubuntu Installer would still fail because the Ubuntu Installer might run grub-install without options.

Question: Why does Ubuntu 22.04 LTS install continue to fail with 'grub-install /dev/sda failed' error?

Output from sudo fdisk -l:

<multiple /dev/loopN>
....
Disk /dev/sda: 1.82 TiB, ......
Device       Size    Type
/dev/sda1    512M    EFI System
/dev/sda2    1.8T    Linux Filesystem

Disk /dev/sdb: 14.45 GiB, ...... Device Size Type /dev/sdb1 3.6G Microsoft basic data /dev/sdb2 4.1M EFI System /dev/sdb3 300K Microsoft basic data /dev/sdb4 10.9G Linux Filesystem .... <multiple /dev/loop<N>>

Output from lsblk:

NAME  TYPE  MOUNTPOINTS
<multiple loop<N>>
...
sda   disk
sda1  part
sda2  part
sdb   disk   /cdrom
sdb1  part
sdb2  part
sdb3  part
sdb4  part   /var/crash
             /var/log
sdc   disk
sdd   disk
sde   disk
sdf   disk
sr0   rom

Output of grub-install --version:

grub-install (GRUB) 2.06-2ubuntu7

Output of sudo gdisk /dev/sda:

GPT fdisk (gdisk) version 1.0.8

Partition table scan: MBR: protective BSD: not present APM: not present GPT: present

Found valid GPT with protective MBR; using GPT.

Output of sudo gdisk /dev/sda then p:

Number  Size   Code   Name
  1    512MiB  EF00   EFI System Partition
  2    1.8TiB  8300

2 Answers2

1

It appears that the Ubuntu is not able to read the HDD after installation. I believe it is an issue with the tool used to create the partitions. I was able to install after I installed a different Linux based OS (Prime OS). Then I was able to erase Prime and install Ubunto. This is an issue with the installer. It should not be this difficult to install the OS.

0

sequence to try:

  1. reboot again with the Ubuntu 22.04 live USB stick

  2. run lsblk to get the partitions list = the biggest one will be the root partition and the first one would be the EFI one

  3. click on drive icon to have it mounted on the default /media/ubuntu/<> or mount it manually into /<>

  4. mount EFI partition into /mnt

  5. run following command:

sudo grub-install --recheck --efi-directory=/mnt --root-directory=/media/ubuntu/<<UUID>> --force --modules=part_gpt

Oleg Kokorin
  • 147
  • 1
  • 5
  • 1
    There appears a typo in the suggested command in the 5.) point: it probably should read grub-install instead of grup-install. – Levente Feb 02 '24 at 21:19