Linux – How to delete folder from EFI partition – Microsoft

bootfedoralinuxwindows

I have problem with my Fedora disto. Boot is stucked on system check on disk by UUID…
I discovered that it is EFI partition and I tried to reconfigure grub2 but there are inffinite Input Outpur errors(see here) in Microsoft folder (yes, I have dual boot but each system on different disk). During my investigation I completely broke Windows so I want to delete Microsoft folder – fix Fedora and reinstall Windows. BUT when I try to delete the folder (sudo rm -rf… – also from Live CD with partition booted with RW permissions) it says that it is Read Only file system.
What am I doing wrong ?

Best Answer

The "read-only filesystem" error might be caused by the OS detecting the filesystem (FAT32) on the EFI partition is corrupted.

If you can, copy the contents of the Fedora folder out of the EFI partition to some temporary safe place. Then, you can try running /sbin/fsck.fat on it, or if that won't solve the problem, use the nuclear option (i.e. a complete reformat and rebuild of the EFI partition):

1.) Identify the current volume ID of the EFI partition using blkid. It will be reported as UUID= for that partition.

2.) Unmount and then reformat the entire EFI partition using mkfs.vfat -i <volume-ID> -F 32 /dev/<your EFI partition>. When specifying the volume-ID, you'll need to omit the dash: specify the hexadecimal numbers only.

For example, if blkid reported the volume ID as UUID="3610-E638", the mkfs command should be mkfs.vfat -i 3610e638 -F 32 ...

3.) Mount the EFI partition again, then restore the Fedora folder back into place. Or if it was impossible to copy the existing Fedora folder because of the corruption, you could use grub-install (or grub2-install in some Linux distributions) to completely reinstall the GRUB bootloader from scratch.

You may also need to regenerate the GRUB configuration file using grub-mkconfig (grub2-mkconfig in some Linux distributions). See your Linux distribution's documentation to find the location of the GRUB configuration file, and use the -o option to direct the new configuration file to the correct location. Example: grub2-mkconfig -o /boot/grub2/grub.cfg.

Since the GRUB configuration is automatically regenerated by grub-mkconfig on each kernel update anyway, the new configuration should be identical to the old one unless you've customized the GRUB configuration manually... and in that case you should know what you did.

If your EFI partition is mounted in /boot/efi and the GRUB configuration file is not within that filesystem (e.g. in /boot/grub2/grub.cfg), then using grub-mkconfig is probably unnecessary. However, running it anyway should not be harmful.

4.) Use the efibootmgr -v command to view the firmware NVRAM boot settings and verify that they are still correct and that Fedora's bootloader path name is correct relative to the root of the EFI partition.

Related Question