Update 2: Finally did it by following the first option I explained in my own comment (i.e. backup and reinstall)
Update 1: I also updated the UEFI just to be sure and the issue persists as expected
Sorry if the post is long, trying to give each relevant detail.
My system has two drives, the first for Linux and the second for Windows.
Initially I had OpenSUSE MicroOS on the first and I could boot into Windows through the UEFI, but then I installed Fedora on it and lost the ability to get into Windows since. I thought that it had a boot partition on its own drive, but I guess I was wrong since now that I checked the partitions, there is no FAT32 partition on there.
(in text form)
nvme0n1 931,5G disk
├─nvme0n1p1 16M part
├─nvme0n1p2 930,8G part BitLocker
│ └─bitlk-66306 930,8G crypt ntfs
└─nvme0n1p3 692M part ntfs
Unlike on my Linux drive
(in text form)
nvme1n1 931,5G disk
├─nvme1n1p1 600M part vfat /boot/efi
├─nvme1n1p2 1G part ext4 /boot
└─nvme1n1p3 929,9G part crypto_LUKS
└─luks-353e522f-c0f3-4167-99fc-90d576a734e8 929,9G crypt btrfs /var/home
So I probably destroyed the content of the boot files in its installation process.
I’m able to access my BitLocker encrypted drive through Fedora, so if I have to reinstall I can still make a backup (it wasn’t very important to me either way).
I also fired up a Windows recovery drive to see if it detected the system and it does, I haven’t yet looked at what the recovery drive can do, so if that’s the key to solving this let me know.
The actual question
So at this point I wonder: is there a way to restore the Windows boot option? Would I have to do it in some GRUB config or do I have to/can I create a boot partition on the Windows drive too and somehow write the bootloader there?
I’ll make a summary of what I learned up to now, maybe it can be helpful to whoever will face this in the future.
I initially had 1 drive with Linux installed, let’s call it A, then I got a second drive, called B, so I could install Windows on a separate one, but I decided to replace the OS on A with Windows since it had lower speeds while I would use Linux more so I’d rather put it on the faster drive.
To make use of that potential speed I had to put B in the first NVME slot and A in the second (it was actually useless because my CPU doesn’t support PCIE 4.0, but that’s beside the point) so I got to the first installation and put Windows on drive A, but I didn’t know that Windows would put its boot partition in the drive at the top of the list which would be B of course, since it was in the first slot, so unknowingly until today, I end up with drive A that has only the OS partitions and drive B with the boot partition and the Windows bootloader therein.
After that I install openSUSE MicroOS on drive B and it actually treats the boot partition correctly, the Windows entry there remains and stays accessible through the UEFI menu (GRUB wouldn’t pick it up for some reason I don’t remember), then unsatisfied with the then subpar experience of MicroOS KDE (alpha) I decide to move to Fedora Kinoite, so I install it and there something breaks, apparently that installation completely overwrote the boot partition so my Windows entry gets deleted, it’s the only plausible explanation and I did see some reports on other forums of Silverblue having to be installed first if you intend to dual boot, so that checks out.From there we get to the problem: how to restore the Windows bootloader without messing up the current boot partition content?
O thought of two approaches:- The easy way: Backup the important files stored in the Windows drive (A), take out drive B reinstall Windows from zero on the only remaining drive in the system, then put your old files back also drive B can be plugged back in.
- The hellish way: juggle boot files around. We want a new boot partition on A, but since the data partition on A is encryped with BitLocker it can’t be safely resized directly to make space for a new partition, it has to be converted back to plain unencrypted first, then resized and finally encrypted again. So first save the current content of the boot partition on B onto another external drive, DO IT DON’T BE LAZY, if you don’t you might not be able to go into Fedora again, then use a Windows recovery media to run the usual
bootrec
commands that will recreate the Windows bootloader (note: it can only recreate the bootloader on its own, NOT the partition, if no FAT32 partition is available it will always fail, that’s why we must have our drive B that holds the boot partition still plugged in).
Now we can boot back into Windows, maybe the Fedora bootloader will be screwed up, maybe not (I won’t test this method as it’s too complicated), but it doesn’t matter because we saved a copy before, so from within Windows we disable BitLocker, resize the partition to have about 600MB of empty space, format that as FAT32 and enable BitLocker again. Unplug drive B, boot into the Windows recovery media and restore the Windows bootloader on the newly created FAT32 partition on A, boot into Windows again with only drive A plugged in to check that it’s working.
Plug drive B back in and overwrite the content of the boot partition on it with your old save so that you get rid of the now superfluous Windows bootloader on it and restore the (perhaps) broken Fedora bootloader and you’re finished.
TL;DR I hate Windows
…but I also learned a lot from my mistakes, dare I say, it’s always the breakages that really advance understanding
If I’m understanding you correctly, you were on the right track. Use the windows recovery disk to recreate the windows bootloader. It SHOULDN’T touch your Linux drive in the process, but I would remove it just to be sure as Windows always assumes it’s the only OS present. From there I believe you could create a GRUB entry for the windows bootloader and then use GRUB to control which you boot from. I haven’t done any GRUB configuration in a very long time, so you will need to Google that one, or maybe someone else here can chime in on how to get that working.
Thanks for the input! I had a suspicion too with Windows being potentially aggressive with the drives so my first thought was to take out the other drive too, I’ll try to go that way then.
Do you have any links to the process needed to restore the bootloader with the recovery tool?
In the recovery environment open a command prompt and run bootrec.exe /fixboot should do it. You might also need to run bootrec.exe /fixmbr
Take a look here: https://learn.microsoft.com/en-us/troubleshoot/windows-client/performance/windows-boot-issues-troubleshooting
run
bootrec.exe /fixboot
I tried that and it gives me an
Access denied.
errorOn the other hand, following the guide in the website, I can confirm that the OS seems to be still intact, running:
BootRec.exe /ScanOS
I get one Windows installation identified on
C:\Windows
I can show you how to restore the windows boot but I’m not exactly sure what it will do to your Linux boot.
if you have a windows install USB boot to that.
once you get to the first screen hit shift-f10 this will open a command prompt
type diskpart
type list vol
this will show you your volumes and drive letters you will need to determine the drive letter of your windows install
next determine the the volume number of your fat32 uefi partition
type sel vol 2 (or whatever the number of your uefi vol is)
type assign (this will give the selected a drive letter)
type list vol again and see what letter is assigned
type exit to leave diskpart
type bcdboot x:\windows /s y: /f uefi
where x: is your windows partition and y: is your uefi partition
The problem is that I have no FAT32 partition on that drive, I don’t know why exactly. Is there a way to resize the other partitions to make a new one?
the uefi should boot from the first drive that has a valid boot partition. . if you have multiple boot partitions then you would have to select the drive to boot to from the boot menu. if that is what you want then I don’t believe it matters if the partition is at the beginning or end of the drive. I would try and shrink you partition by about 500mb partition and format the empty space as fat32 then use the steps I mentioned to setup your windows boot.
Ok, so in that case I’ll have to shrink the Basic data partition (BitLocker) right?
I curious what is in that ntfs partition at the end of your windows drive, if it’s not needed you may be able to use that.
I’ve never shrunk a bit locker partition before but it should be possible, worst case you decrypt the drive resize then reencrypt.
what is in that ntfs partition at the end
I cannot access it, so I don’t know, but I imagine it is of some importance I found it in another PC too with Bitlocker enabled.
worst case you decrypt
Unfortunately I can’t simply decrypt it to perform a shrink, I need to actually disable BitLocker first, but in order to do that I would have to log in to Windows, I ended up thinking of two possible solutions which I listed in my other comment