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.

1 Answers1

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.