2

When trying to format an USB drive, I accidentally formatted the /dev/sda1 file system, which appears to contain information needed to start ubuntu. I realized that so I decided to not shut down the computer, and trying to repair instead.

I tried sudo grub-install /dev/sda, it gives me:

Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

I tried using bootrepair and this gives:

GPT detected. Please create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag). This can be performed via tools such as Gparted. Then try again.

This is my state now:

enter image description here

Is there something I can do to repair my file?

My computer is still on.

EDIT: The output of boot repair is here: boot-repair output

EDIT: RESPONSE to wjandrea, I tried changing the flag, that is why it says bios_grub flag, but I don't know how to make it "unformatted", which option is of the ones offered by gparted when formatting?

EDIT: RESPONSE to oldfred. Yes the original flag was boot. Based on this thread Problems with booting ubuntu after formatting boot partition, I searched for /sys/firmware/efi and it exits, as indicative of an EFI boot. My knowledge of ubuntu is nothing but having it installed on my pc once to avoid using windows. The output of cat /etc/fstab is:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda2 during installation
UUID=bb009bf9-af36-471a-825d-505f28b194ee /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=E957-26C4  /boot/efi       vfat    defaults        0       1
# swap was on /dev/sda3 during installation
UUID=26cf563f-438e-41cb-a11b-30b4bb99a433 none            swap    sw              0       0

Thanks to all of you for your help.

7
  • You have the instructions already: "create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag)". That's referring to /dev/sda1. It already has the flag, so you just need to create the partition then run Boot Repair again.
    – wjandrea
    Aug 17, 2016 at 4:03
  • 1
    Post this: cat /etc/fstab With the size of sda1, it looks more like an ESP - efi system partition which is FAT32 formatted with boot flag for UEFI boot. A normal bios_grub partition for BIOS boot is only 1 or 2MB. And Boot-Repair is trying to reinstall a BIOS boot verison of grub which then requires the bios_grub partition.
    – oldfred
    Aug 17, 2016 at 4:04
  • I edited to question to include more information. Aug 17, 2016 at 4:33
  • @FranciscoAngel oldfred is right, it should actually be a UEFI partition. So create a FAT32 partition and change the flag to boot instead of bios_grub.
    – wjandrea
    Aug 17, 2016 at 15:17
  • wjandrea, I returned dev/sda1 to fat32 and boot flag, what do I do now? boot-repair still gives the GPT detected. Please create a BIOS-Boot partition (>1MB, unformatted filesystem, bios_grub flag). This can be performed via tools such as Gparted. Then try again. . How can I instruct boot repair to treat the system as UEFI instead of BIOS? Aug 17, 2016 at 17:11

1 Answer 1

0

Finally

sudo grub-install dev/sda

worked after I run:

sudo mount dev/sda1 /boot/efi

based on the information contained here how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows? and the section "Creating an EFI System Partition" here UEFI. Now I get the error

The disk drive for /boot/efi is not ready yet or not present.
Continue to wait, or press S to skip mounting o M for manual recovery.

After skipping, the computer started succesfully. Being able to shut down and restart the computer is enough for me now. I will take my time to solve this new problem, most probably in a new thread. Best regards.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .