Windows nuked my EFI partition

Hi everyone,
long story short, while installing Windows on new SSD, it completely nuked Qubes OS efi partition. Any idea on how to reinstall grub with EFI? I already have live USB, tried recovery but without any success. I do not want to reinstall whole qubes installation.
Thank you for any ideas :slight_smile:

1 Like

Download the grub2-efi-x64 and xen-hypervisor packages for your corresponding Qubes OS version, current or current-testing repository and the same package version that you have in your Qubes OS (or you can just get the latest if you don’t use xen.efi).
Example download links:
https://yum.qubes-os.org/r4.2/current/dom0/fc37/rpm/grub2-efi-x64-2.06-4.fc37.x86_64.rpm
https://yum.qubes-os.org/r4.2/current/dom0/fc37/rpm/xen-hypervisor-4.17.5-9.fc37.x86_64.rpm
You can additionally verify the package signature using rpm -K command.
Extract packages using this command:

rpm2cpio /path/to/package.rpm | cpio -idmv

Change package.rpm to the name and path to the downloaded package.
From grub2-efi-x64 package you’ll need these files:

/boot/efi/EFI/BOOT/BOOTX64.EFI
/boot/efi/EFI/qubes/fonts
/boot/efi/EFI/qubes/grubx64.efi
/boot/efi/startup.nsh

From xen-hypervisor package you’ll need this file:

/boot/efi/EFI/qubes/xen-4.17.5.efi

Copy the files to your EFI partition.
E.g. copy /boot/efi/EFI/qubes/grubx64.efi to the EFI/qubes/grubx64.efi directory in EFI partition.
Copy /boot/efi/EFI/qubes/xen-4.17.5.efi to /boot/efi/EFI/qubes/xen.efi
Create GRUB config file /boot/efi/EFI/qubes/grub.cfg with the following content:

search --no-floppy --fs-uuid --set=dev xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
set prefix=($dev)/grub2

export $prefix
configfile $prefix/grub.cfg

Where xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is the uuid of your Qubes OS /boot partition.
You can check the UUID of your partitions using blkid command.

If your EFI partition was formatted, then you’ll also need to mount your Qubes OS dom0 root and change the UUID of your EFI partition in /etc/fstab to the new value.
You can mount it like this:
How to mount a Qubes partition from another OS — Qubes OS Documentation

3 Likes

Hi, sorry for my late response. I did find out that Microsoft overwrote BOOTX64.EFI and aaded their own folder with boot stuff. I replaced these according to your guide and boot is now working. Thank you so much for the help

1 Like