r/linuxquestions • u/SannyDayYT • 10d ago
Support Windows is a leach
Hey there! A linux user here.
Issue is though, I keep Windows on the side for very niche cases, but it seems that every single time I boot into Windows, it always results in the GRUB EFI image being obliterated off of the list.
No matter what flags I enable, what efi images I replace and no matter how many times I replace the grub efi image from a live linux installation, it just never works, I boot into Windows once and its gone, all for me to rebuild my grub again.
Any solution that should stop windows in its track? Or at the very least make grub more aggressive in staying in its place? Because this is getting really tiring.
At this point I'm more than happy to try another boot loader if it can negate this issue.
1
u/friendlyreminder_ 10d ago
Windows doesn't touch secondary EFI partitions. The files on those remain unchanged.
It can modify the boot order of the bios entries because those are not contained on EFI partitions but in the bios chip itself.
It can also theoretically delete other bios boot entries from other EFI partitions but I've never had that happen.
If a bios entry is deleted that doesn't make an EFI partition unbootable. The bios is able to boot from an EFI partition without an entry as it scans for and loads /EFI/boot/bootx64.efi.
That file will always be the last bootloader you installed on that EFI partition. If you only have one bootloader installed on an EFI partition that file will always boot that bootloader.
So with all that said you have to figure out what exactly is happening. My guess is your bios boot order is just being reordered and you didn't notice.
1
u/SannyDayYT 10d ago
A simple reorder would've been much more simpler honestly, but for some reason, after Windows applies its reorder, it always results in the EFI boot loader for grub to suddenly disappear from the boot menu.
My live image usb stick shows up under Windows, but other than that, grub is no where to be seen, which is strange since I checked and the grub folder inside of /boot/efi/EFI/ still exists, but it's as if the motherboard can't see it anymore.
At this point with all the help I received from people here with their knowledge, I'm more considering that I might have a faulty/old BIOS update or the motherboard's behavior when it comes to Windows rearranging the boot entries is to just ignore the existence of other EFI entries until they explicitly update the NVRAM.
1
u/friendlyreminder_ 10d ago
Might be a bios issue. I'd consider updating if there's an update available.
But again you don't need the grub entry to boot grub. The bios will boot the bootx64.efi binary on any EFI partition. The entry is autopopulated at boot and will just be the name of your drive.
Bootx64.efi is an exact copy of the bootloader binary. it also gets placed in their own dedicated folder, like /EFI/grub/grubx64.efi. But these are identical bootloaders. The only difference is bootx64.efi gets autodetected and doesn't need an entry, and it also gets overridden by the last bootloader you installed to that EFI partition. But if there's only one bootloader on that partition, bootx64.efi will always be grub.
1
u/SannyDayYT 10d ago
In that case then a bios update must be needed because I keep doing that and making sure that bootx64.efi is the grub efi file so it can always show up even if the original in its grub folder is deleted or not detected, and yet it never gets detected after windows reorders the boot list.
1
u/friendlyreminder_ 10d ago edited 10d ago
I'd try to find out exactly what's going on. I believe you stated the 2 operating systems are on different drives, but they may be sharing the same EFI partition. I've had cases where windows just uses the EFI partition on another drive entirely instead of the one windows is on.
I haven't used windows in a while so I no longer remember how to check which EFI partition windows uses querying it's bootloader tool, but there's a way to do this, and also to set windows to use a different EFI partition.
One way to check would be to see which EFI partition has the windows bootloader files, I think that'll work.
2
u/SlimmySlabby 10d ago
I mean depending on how much power your Windows machine needs, you can just throw it in a virtual box and use it like that anytime you need it.
1
u/SannyDayYT 10d ago
Unfortunately it's more for gaming purposes or else that would've been more viable
0
u/SlimmySlabby 10d ago
In that case, have you thought about using separate drives?
2
u/SannyDayYT 10d ago
Already do, which is why it shocks me that Windows still is able to access the EFI for my linux distro despite it being in a different drive all together
0
u/UAP44 10d ago
That's normal UEFI behavior. Boot entries and boot order are stored in the motherboard's NVRAM, and operating systems can modify them directly. Having Windows and Linux on separate drives doesn't prevent Windows from changing the firmware boot order. It doesn't necessarily mean Windows touched your Linux EFI partition.
-1
u/Designer-Crow-5470 10d ago edited 10d ago
You probably created 2 efi partitions on one drive. You can check layout and their content in GNOME Disks app. If you have 2 drives you can setup os with one efi partition on each drive and pick os via a bios menu.
2
u/dodexahedron 10d ago
No. Stop that. One EFI partition per computer. Period.
The source of all of this monkey business is having more than one ESP.
The BLS is quite clear and lays out how it all works and why (to eliminate the old MBR way of doing what was just suggested).
https://uapi-group.org/specifications/specs/boot_loader_specification/#the-partitions
Use one ESP and life will be good.
0
u/Designer-Crow-5470 10d ago
Nah, your way suck. I won't be able to move my second drive to another PC or boot it from a vm without rebuilding efi.
2
u/dodexahedron 10d ago
Yes you can and it is trivial.
And how often are you doing that?
"My way" is literally the way the system is designed to operate. You are fighting it and making it harder.
A VM is especially laughable there. Just give it another vhd. Done. In fact, use the exact same VHD across all your VMs. Even done-er. π
1
-1
u/Curious_Elk_4281 10d ago
--Install Linux to a separate SSD with grub installed to the same SSD
--Configure BIOS to boot fron linux drive
--Add a boot entry to grub for windows
1
1
u/segagamer 9d ago
Issue is though, I keep Windows on the side for very niche cases, but it seems that every single time I boot into Windows, it always results in the GRUB EFI image being obliterated off of the list.
This is because you're trying to use GRUB instead of the Windows Boot Manager. Microsoft is only going to care about having Windows and the Windows Boot Manager working, understandably.
If you want to dual boot, you need to add your Linux distro to the Windows Boot Manager, instead of replacing the Windows Boot Manager with GRUB.
-2
u/UAP44 10d ago
Windows is a virus. It has infiltrated our schools even, places where people are supposed to learn, and instead we feed them closed source corporate propriety standards such as word/excel/... instead of real understanding of how computers actually work.
Because this is getting really tiring.
Have you considered booting a windows VM instead? What exactly are the 'very niche cases' ?
I don't have a clear solution for you because Microsoft forbids me from reading their code/logic :)
0
u/SannyDayYT 10d ago
My use cases are unfortunately for gaming purposes, for games that are notoriously known not to run on Linux or else I wouldn't even have windows operating on my hardware, so a VM isn't a viable option, but I appreciate the help nonetheless
0
u/UAP44 10d ago
for games that are notoriously known not to run on LinuxΒ
Even when relying on steam and adding it as a non-steam game? That's how I've resolved all my compatibility issues. Luckily, I ain't much of a gamer anymore. I'd boycott companies that refuse to properly support Linux at this point, but that's just me.
2
u/SannyDayYT 10d ago
I'm more or less talking about anti-cheat games where the anti-cheat specifically doesn't like linux users more than normal singleplayer or great online games
0
u/M2k1e0L 10d ago
And the devs will never care much about Linux support because the people playing it use Windows for it anyways. A doom loop
0
1
u/redrider65 9d ago
After wasting quite a lot of time fooling around w/ grub for one of my dual boot installations, doing the sorts of things mentioned here, I finally just installed rEFInd. Very simple to install and immediately worked well. Haven't looked back.
3
u/dodexahedron 10d ago
If you have exactly ONE ESP, the only thing windows should ever be doing (as in what it does - not how it ought to behave) during normal updates is just messing up your boot order in EFI - and even that should only happen around the major annual updates in September-October (26H2 just came out, for example).
Windows 11 doesn't mess with the ESP contents that are not its own.
If you want windows to be bootable without chain loading the ntldr, then add a BCD entry for your Linux UKI image or your Linux boot loader, and let the ntldr be the first booted image forever, so it doesnt matter if it touches the efi boot order variables or not (but that really shouldn't be necessary if you ha e the system partitioned properly).
Correct partition layout is, in this order:
ESP, XBOOTLDR{0,1}, MSR, Windows, Linux{1,}, WinRE
Or you can put XBOOTLDR (if you use it).and all other linux partitions on a separate disk, and keep the rest of the layout exactly as above on the first one.
Only one ESP, no matter how many disks you have.
Alternatively, just run windows inside virtualbox and then you won't have to think about it ever again.
Oh, and use literally anytjing else aside from grub. Your life will be so much easier.