My uefi boot deleted by windows

so i just installed windows cause i need something urgent and its deleted my uefi on bootloader can i get it back with chroot or something?

if you have a nixos ISO on a usb, you should be able to chroot into your install with nixos-enter and nixos-rebuild switch, that updates the grub config.

You do have boot.loader.grub.useOSProber = true in your configuration.nix right?

do you have an idea of your partition layout? you’ll need to mount your /, /home and /nix before running nixos-enter

i do know my partition layout i think, but i dont have boot.loader.grub.useOSProber = true on my config

hm, well if you are using systemd-boot (which is the default option i think), then since you installed Windows with UEFI, simply rebuilding should find \EFI\Microsoft\Boot\bootmgfw.efi and add it

if you’re using GRUB (by turning enabling boot.loader.grub.enable), then you’ll want to set useOSProber to true so it sees Windows.

If this is efi, you are (hopefully) using systemd boot anyway, it doesn’t need osprober, as long as you use the same ESP for both.

Also it’s very likely that your old bootloader hasn’t been deleted but just windows made itself the default.

Try your firmwares boot selector if you still have something else than windows available.

just to make clarify that i have nixos livecd too here

may i get step-by-step tutorial i dont think i kinda understand here

if you’re not sure which you’re using, try to remember your boot menu (the place that lists all your NixOS generations and stuff)

if it was black with centred text like this, then it’s most likely systemd-boot:
image

if it was grey, or another colour, with a NixOS logo like this, then it’s most likely GRUB:
image

it’s black one, i think its systemd

  1. check if Windows overwrote your NixOS boot entry or simply placed itself first. you’ll need to press a key on your keyboard as your computer is starting up (usually Del or F10) and see if NixOS or “Linux Boot Manager” is on the list
  2. if it is there, then modify your boot order to place NixOS at the top, you’ll need to go into your computer’s BIOS to change the order
  3. if it isn’t, then it means Windows has overwritten NixOS’ boot entry, this is where the ISO on the drive comes in
  4. you’ll have to boot into your drive, the same way that you installed NixOS, and figure out how to chroot into your install

well i already did it first and it’s dissapear and that’s why i ask

I don’t know your firmware. But you know it. If in doubt check it’s manual for how to do what I proposed. Each firmware does deal with this differently.

once you get in here, can you open Disks (like the application), and send a picture?

for me, this looks like this:

is there any like disks for windows? cuz i only have one device

Windows has Disk Manager (you can search for it in Start, or put diskmgmt.msc in Run), but we need to know the partition type of your NixOS install, and it won’t tell us that.

Perhaps you can simply run lsblk from the Live NixOS install and paste the output into a pastebin and then boot back into Windows to send the link here?

for example, here’s mine: lsblkk output - Pastebin.com


it has efi file there but it doesnt show on my bios and my nix is ext4 btw

hm, that says Disk 1, so I’m assuming there’s 2 disks in your computer, (Disk 0 & 1)

could you show how Disk 0 looks like? does it have an EFI partition too?


here the 600gb is btrfs with my game inside