How Not to Resize EFI Partition Dual Boot Windows + Fedora
I have a Framework laptop with Fedora Linux and at some point I couldn’t install firmware updates. The error was not enough free space in my 100MB /boot/efi partition so I had to resize it somehow.
^ that is me_irl
To give the EFI partition some extra room, I found this guide which said “to create a new bootable FAT32 partition and copy the files from the old one.” Back into the LiveCD we go and sure enough it worked well booting into Fedora. df is now showing the newly added space in EFI.
But all is NOT well…
Previously, I could select “Windows Boot Manager” from GRUB screen, and Windows happily boots from its Bitlocker partition. The only time I had to provide the Bitlocker key was the one time after Fedora installed itself into EFI. Because the UEFI -> Grub -> Windows pathway is validated.
But now, the “Windows Boot Manager” GRUB item no longer works, because the partition UUID has changed. os-prober fails to find Windows whatsoever – rendering any attempts to grub2-mkconfig ending in sadness and the removal of the existing non-functional “Windows Boot Manager” entry.
Worse still, even manually selecting Windows from UEFI BIOS still fails to validate the UEFI -> Windows pathway and thus the Bitlocker key needs to be provided every time.
The Road to Recovery
The setup: Fedora 43, Windows 11, Framework Laptop 13 (Intel 12th gen, 2022)
Strategy: Get Windows back working normally first, then add GRUB back to it.
- First, backup the contents of the EFI Partition. Just copy all the files from it and toss it in a USB stick or somewhere
- Rearrange partitions so that the extra space is next to the EFI Partition
- Purposefully destroy the EFI partition, then re-create it. Recover from a Windows installation media using method from https://www.youtube.com/watch?v=Mzloza_2g_c
- You might not need a Windows installation media for this – booting into the Windows RE should also work
- The newly created partition MUST be a EFI System Partition Type. Simply being “a new bootable FAT32 partition” is not enough. In Windows,
create partition efi size=XXX(as shown in the Youtube video). For Linux, usefdisk, you want to presstthen selectuefi(see Arch Wiki). - For the
bcdboot W:\Windows /s S: /f UEFIcommand, the “W” drive is the “actual” installed Windows volume where the “Windows” folder is - Why don’t we just copy the original Windows EFI files back into this newly created EFI Partition? Because you will get an error when turning on BitLocker “The path specified in the Boot Configuration Data (BCD) for a BitLocker Drive Encryption integrity-protected application is incorrect.”. It is necessary to perform the
bcdbootstep using information from your existing Windows installation.
- After this is done, go back into Fedora LiveCD. Try running
os-proberand it should show Windows entry now. - Stay in Fedora LiveCD and follow https://docs.fedoraproject.org/en-US/quick-docs/grub2-bootloader/#_restoring_the_bootloader_using_the_live_disk to rebuild GRUB in the new EFI
- Last step while in LiveCD: Update
/etc/fstab(very easy to do as you are already chrooted now) with the new partition UUID for/boot/efipartition, otherwise you will encounter “You are in emergency mode.” error upon booting Fedora
And finally, the universe is once again in harmony.
Other things I tried which did NOT work
Fully disable Bitlocker on the Windows partition did not help os-prober to find Windows… because os-prober is looking for the EFI System Partiton. If your partition is FAT32 Bootable Partition but does NOT have Partition type GUID for EFI System Partition, os-prober will not find the Windows EFI entry.
Booting into Fedora LiveCD and used KDE Partition Manager and then reize/expand the existing EFI System partition does NOT work. Sure, the partition itself has the new expanded size. But in Fedora /boot/efi, it refuses to realize that the EFI partition now has a larger size. Running df will show that it is still the old size (~100mb)
Lessons Learned
- Instructions online for fixing Linux boot issues often never account for any Dual-boot situation
- Any piece of added security (i.e. Bitlocker, LUKS) will make life for both you and your attacker more difficult
- I created a partition which did not have the correct Partition type GUID for EFI Partition which was the source of much misery
- Whatever this guy also learned
- I also somehow managed to get my EFI Partition “stuck” in the middle of the disk. This is not strictly “bad” but I would like to have flexibility with disk space allocation in the future. So I had to move mountains and earth to put it back to the front of the disk (used KDE Partition Manager for this). But now, the partition number no longer correlate to their physical locations.
- To fix this, use
sudo fdisk /dev/nvme....: typexfor “extra functionality (experts only)”; typefto “fix partition order”, typewto “write table to disk and exit” - Also good to run
chkdskin Windows after, because there are some magical things that KDE Partition Manager didn’t quite do during the move
- To fix this, use
- Apparently Windows has annoyed me sufficiently that I am willing to go through all this trouble to keep Fedora around so I can use it more