0

I have a dual boot system with two drives. Each drive has it own OS, with the one being Windows 10 and the other Debian 11. In order to prevent Debian seeing the Win10 drive, I have disabled it during the boot process like this: https://askubuntu.com/a/554417/805980

Everything works fine, but I see that sometimes (during installing updates on Debian maybe?) the GRUB gets updated, probably with update-grub. And since Debian doesn't see the Win10 drive, it removes it from GRUB.

Is there a way to make the Win10 entry in GRUB not be removed when the drive is not available and update-grub executes?

I don't know if it matters, but I don't use UEFI.

user2173353
  • 101
  • 1

1 Answers1

1

Maybe you can copy the Windows 10 Grub config to /etc/grub.d/40_windows. Afterwards, your configuration will be copied to /boot/grub/grub.cfg whenever update-grub is run.

Jesús Ángel
  • 379
  • 2
  • 12
  • 1
    Also turn off os-prober in /etc/default/grub with `GRUB_DISABLE_OS_PROBER=true` otherwise if Windows is found you get two entries. Grub2 is now automatically turning off os-prober because of some security issue. – oldfred Jan 24 '22 at 15:54
  • @Jesús Ángel Any hint on where the Win10 grub config is, in order to copy from it? It is the file in `/boot/grub/grub.cfg`? If yes, any hints on which portions I should copy, apart from the `menuentry` or `submenu` ones? This is the first time in my life that I look inside this file and I am a bit horrified... – user2173353 Jan 24 '22 at 23:55
  • @oldfred Right. In my case, the Win10 drive will be hidden from Linux altogether, so most likely I will not be getting any duplicates, I think. But if I do, I will certainly try your suggestion. :) – user2173353 Jan 24 '22 at 23:57
  • If you unhide temporarily the Win 10 drive and run update-grub you'll get the Windows config in grub.cfg. Supposing you want to keep the Win drive hidden, you can write the Windows boot config from scratch. Check this URL for some samples: https://unix.stackexchange.com/questions/259069/how-to-start-a-windows-partition-from-the-grub-command-line/259072 – Jesús Ángel Jan 26 '22 at 08:50