@fehlix Back when I lost the bootloader due to drivedeathiness I got this bit saved in my files after asking for help on the forum, which solved it for me.
Maybe this is of use for you.
Don't ask me what I did anymore... I don't remember, as this was likely a year ago or something. It was very confusing and I'd much rather forget that whole ordeal

but I thought maybe the info could help so I am doing a straight copy/paste from my file.
Strong urge to OP to NOT use this unless vetted by someone in the know.. might be that your code lines need to be different or whatever else needs adjusting. Could be not the solution for you at all. Just sharing this for fehlix so he might know what you need to do / can try.
If you lose the Windows Boot Partition (drive broken)
In /boot/efi/EFI/Microsoft there are two folders, one is Boot. In it the file
bootmgfw.efi
If that is there you can make a custom bootloader:
Code: Select all
sudo tee -a /boot/grub/custom.cfg <<!
menuentry "Windows 10" {
insmod part_gpt
insmod fat
insmod chain
set root=(hd1,gpt1)
search --no-floppy --fs-uuid --set=root F22E-D9D6
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
!
where F22E-D9D6 is the UUID of the Fat32 partition.
Best way is to regenerate the boot loader into the partition.
Grab the Windows 10 USB key and boot to it using F8 to get to the Bios boot menu
From the Windows Setup screen, select “Next”.
Choose “Repair your computer”.
On the “Choose an option” screen, select “Troubleshoot”.
Then select “Advanced options”.
Choose “Command Prompt” from the list of options.
Start diskpart by entering diskpart in the terminal
list disk to show an overview of all the disks on the computer that can be detected
select disk X (where X is a number, 0, 1, 2, etc.)
list volume to show the content
I have found that no matter what disk I selected, the volume output remained the same
I did select the windows install disk number, and then went list volume and found that was 4 in this case
The sequence
diskpart
list disk
select disk X (the disk that holds the windows install)
list volume
select volume Y (the fat32 partition)
assign letter=S (this gives the letter S to the partition as drive name)
then exit out of diskpart, and run
bcdboot X:\Windows /s S:
The X in that line, replace it with the found drive letter in diskpart and list disk and such. I found it was assigned D, so the line became:
bcdboot D:\Windows /s S:
Which means save the bootrecord found in D Windows on drive S (that Fat32 partition).
When completed successfully it will say so, boot files sucessfully created. If you don’t see that, check that you have assigned everything correctly. I had the bcdboot line set at X first, and that needed to be D. It gave me “failed to set element application device. Status = [c00000bb]
Type exit again to close the command prompt, and shut down the system. Remove the USB disk. Reboot.
Now it either just works when you press F8 to boot from the Bios boot menu, and getting into Windows. You might need to use mx-boot-repair to reinstall MX bootloader if that doesn’t start from the Bios menu.
If you can boot into MX and there is a /boot/efi/EFI/Microsoft folder, with in there content, then you could just run
sudo update-grub
and it should bring Windows back into the grub menu. You might have to change the boot order in MX Boot Options if Windows boots first now.
MX-23.6_x64 July 31 2023 * 6.1.0-37amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.247.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030