Accidentally formatted efi while installing arch Linux

So, I was installing arch linux dual boot on parrot os desktop and accidentally formatted the efi partition.

Now I have functional arch installed, without parrot os in efi/grub.

I want parrot os back and

  • Os-prober didn’t detect
  • Neither do update-grub command

Please help, how could I recover parrot os.

  • ParrotOS iso in use:

  • Application used for flashing the iso: etcher

  • Logs/Terminal output (use pastebin or similar services):

  • Screenshots:

in the arch terminal:

sudo nano ect/default/grub

the line should be inserted / uncommented

GRUB_DISABLE_OS_PROBER=false

sudo grub-mkconfig

sudo grub-install /dev/sda

if your main hd is sda otherwise change sda accordingly

Other solution could be also possible to try grub-rescue cd starting up ParrotOs,
but try the first first.

1 Like

Hello @ycom1, thank you and above commands didn’t worked so i followed through arch terminal (to reinstall efi:) linux - Cannot find EFI directory: issue with grub-install - Unix & Linux Stack Exchange

note:
dev/sda2 → parrot is installed in
dev/sda5 → efi directory

su
mount /dev/sda2 /mnt

mount /dev/sda5 /mnt/@/boot/efi
#because /boot/efi was inside /dev/sda2/@ folder

for i in /dev /dev/pts /proc /sys /run; do mount -B $i /mnt/@$i; done
chroot /mnt/@

# Not sure about this line but without it was giving err:
# grub-install: error: cannot find a device for /boot/grub (is /dev mounted?).
# Which is resolved after below line
mount /dev/sda5 /

grub-install –efi-directory=/boot/efi
#Detects parrot os

grub-mkconfig -o /boot/grub/grub.cfg
#Detects parrot os and arhc-linux```

But when restarting, it didnot show boot option of parrot os.
I think this: `mount /dev/sda5 /` line was responsible, please help

[solved]
Turned out above steps worked for me, additionally, I have to add boot option for parrot manually from boot setting and change UUID of efi directory in /etc/fstab.

Complete steps followed:

note:
parrot_root/home : /dev/sda2
efi partition: /dev/sda5

sudo mount /dev/sda2 /media
mount --bind /media/@ /mnt
sudo mount /dev/sda5 /mnt/boot/efi

For me parrot root was inside ‘@’ directory inside /dev/sda2 partition i.e. /dev/sda2/@ & I coudn’t find way to mount it to /mnt directly so mounted /dev/sda2 to /media first and then bind the ‘@’ folder to /mnt

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

sudo cp /etc/resolv.conf /mnt/etc/
# (optional above 1 line) to use wifi inside chroot, if wifi doesn't work inside chroot. 
#to test if wifi works: ping parrotsec.org
#works if it shows something like: 64 bytes from....  (ctrl+c to close)


# Previously efivars
sudo modprobe efivarfs

sudo chroot /mnt

sudo apt-get update

sudo apt-get install --reinstall grub-efi-amd64

sudo grub-mkconfig

sudo update-grub

grub-install /dev/sda

and i had to add to boot option :

  • f2 while rebooting
  • general / bootsequence / add boot option
  • selected ‘grubx64.efi’ option from EFI/parrot/
  • apply

and f12 while rebooting and select to boot from parrot.

while booting to parrot, I got and error saying:

cannot open access to coonsole, the root account is locked.
See sulogin(8) man page for more details.
Press enter to continue

It turned out UUID of efi directory changes while formatting, so the system was referring to non existent UUID as efi. To change that:

# To see new UUID of EFI partition (/dev/sda5 is efi partition)
sudo lsblk /dev/sda5
# copu uid from here

#mounting parrot_root directory to /mnt temporarily
mount /dev/sda2 /mnt

# opening /etc/fstab of parrot_os since '@' folder inside /dev/sda2 is parrot root  
nano /mnt/@/etc/fstab

and replace the UUID of line having mount point /boot/efi with UUID previously copied

References (thanks to):
@ycom1 : https://community.parrotsec.org/t/accidentally-formatted-efi-while-installing-arch-linux/21854/2

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.