Hi,
I have to setup a dual-boot Rocky Linux 8 + Windows 10 on my girlfriend’s computer. Usually I try to avoid this kind of setup, but she needs some Windows stuff for her work, and the machine’s configuration only allows a virtualized solution in the sense that chickens fly and horses swim.
The computer sports two identical 1 TB hard drives, so I thought putting Windows on one drive and Linux on the other. It’s been ages since I last setup a dual-boot, and I only have a very faint recollection of what I did. (Promising myself to take detailed notes this time.)
As far as I can tell, I’ll have to install Windows 10 first (on one disk, but which one). Then Rocky Linux 8 on the other. Then boot Linux and edit my GRUB configuration accordingly so it can “see” the Windows installation.
Any pointers on some good documentation/tutorial about the subject ?
Cheers,
Niki
No pointer, but EFI. [U]EFI boot loads bootloader from ESP (EFI System Partition). Each disk can have one ESP.
Both Windows and EL8 installers do add entry to “EFI menu” (in motherboard). The entry loads their bootloader.
The “EFI menu” is not shown by default; one has to press a key during POST. If one does not, then the “default” entry is chosen.
I have machine with such setup. If I do nothing, then I get one OS.
If I press ‘F12’ anh ‘Enter’, then I get the other OS (because its entry is first on the list, although not the default).
One can still have Windows-entry in GRUB menu. In fact, os-prober should create one. It did not work in legacy BIOS, because there Windows was on NTFS and NTFS-drivers are not in base install. With EFI the sought files are in VFAT ESP.
Nevertheless, I did disable os-prober in some CentOS 7 machines with Ansible tasks, like these:
- name: Check if UEFI is in use
stat:
path: /sys/firmware/efi
register: has_uefi
- name: Unrestricted Windows boot
shell: |
/etc/grub.d/30_os-prober | sed "s/--class os \$menuentry_id_option/--class os --unrestricted \$menuentry_id_option/; s/Windows.*)/Windows 10/" > /boot/{{ 'efi/EFI/centos/' if has_uefi.stat.exists else 'grub2/' }}custom.cfg
chmod 700 /boot/{{ 'efi/EFI/centos/' if has_uefi.stat.exists else 'grub2/' }}custom.cfg
args:
creates: /boot/{{ 'efi/EFI/centos/' if has_uefi.stat.exists else 'grub2/' }}custom.cfg
- name: Disable 30_os-prober
lineinfile:
path: /etc/default/grub
regexp: '^GRUB_DISABLE_OS_PROBER='
line: GRUB_DISABLE_OS_PROBER=true
notify:
- grub mkconfig
1 Like
The machine has a legacy BIOS.
Nevertheless, there is “BIOS Boot Menu” that lists the devices to boot from?
One usually invokes the menu to boot from PXE, USB, etc and should be able to adjust priority of devices.
This is untested thought-experiment:
- I would have only one disk attached at a time for installation. Install Windows on one, and Rocky to other.
- Connect both disks so that BIOS reads (sector 0) Rocky’s disk first (i.e. the GRUB).
- Check that you can in Boot Menu select the second disk and that Windows does boot.
- Install
ntfs-3g
from EPEL into Rocky
- Re-run
grub2-mkconfig -o /boot/grub2/grub.cfg
- Check that Windows boots via the entry in Grub menu
Windows might be picky and throw a tantrum if it is no longer on “first disk”. One probably can: “Ok, be on first enumerated device, but we will boot from the other disk”.
If grub2-mkconfig (i.e. os-prober) still can’t find the Windows, then create chainloader menuentry as file /boot/grub2/custom.cfg
This implies both o/s are going to be sharing some files, which is a whole other topic (if needed).
As I wrote before, on legacy BIOS the installer and the grub2-mkconfig do not add grub menu entry for Windows without NTFS-support, because the os-prober cannot read NTFS-filesystems by default.
Yes, the NTFS-support is an overkill if all you need is grub menu entry, but if you don’t want to write that entry yourself, then you do need it. (One could uninstall the ntfs-3g right after one has got the proper entry.)
I was looking at the first line in the post where it says “BIOS boot menu”, and thought we were talking about using the BIOS menu, as opposed to the ‘grub’ menu?
Exactly. The thing that we hardly ever use (except when we want to boot from USB, etc).