Configuration:
Two HDDs. Named sda and sdb.
Original situation:
Ubuntu on sda. The other disk (sdb) is empty.
Due to GRUB inferring some boot sector as containing Windows 10, then my GRUB window shows Ubuntu and Windows (on /dev/sda1). See earlier discussion:
Weird small Windows 10 partition on my Ubuntu disc. What is it?
New Situation:
Now I installed Windows 10 on the second HDD (sdb). I also had to run boot-repair
to get GRUB back.
When I boot to the sda, then GRUB shows like in the original situation and it allows booting to Ubuntu. The Windows entry still says it's on /dev/sda1, and using that does not boot Windows on sdb.
If I boot on the second HDD (through F9 from BIOS), then GRUB shows up just like on the first HDD, but this time it allows booting to both Ubuntu and Windows (it says it's on /dev/sda1/ still).
What I see:
When booting to sda, it only sees Ubuntu, and while it might be able to boot to Windows from that, it doesn't because maybe it cannot access sdb or doesn't know about Windows being on sdb.
When booting to sdb, GRUB understands that both Ubuntu and Windows are present. And it also understands where the Windows (on /dev/sda1) entry points to, since we booted on the same disk, where there's an actual Windows installation.
Work-around:
If I just set my second HDD (sdb) to act as the primary one to boot to, then I can boot to both OSes.
Problems that remain:
I don't understand whether GRUB when booted on sda works as it should, or whether it's corrupted. Can I make the GRUB when booted on sda perform the same as on sdb?
And the Entry editor for that entry looks like
insmod part_msdos
insmod fat
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 11FC-F339
else
search --no-floppy --fs-uuid --set=root 11FC-F339
fi
parttool ${root} hidden-
drivemap -s (hd0) ${root}
chainloader +1
So the official doc:
https://help.ubuntu.com/community/Grub2/Installing
explains this as:
GRUB 2 normally writes its bootloader information to an area just beyond the Master Boot Record and before the first partition. Some software on non-Linux operating systems also used this embedded area and broke the system by overwriting the GRUB 2 information on dual-boot systems. GRUB 2 now can recognize this potential problem and avoid it.
On a system with multiple drives and OS's, the user can preserve the original bootloader by installing GRUB 2 on another drive. To accomplish this:
specify the disk (eg /dev/sdX, not /dev/sdaXY) not currently used to boot the system for the bootloader location.
After the installation is complete, change the boot order (via BIOS setup) so that the disk to which the GRUB information was written is the one booted first.
If the user wishes to restore booting with the original bootloader, change the boot order back to the original drive.
boot-repair
after installing Windows on sdb, so maybe it made it work on sdb. I still don't know why it allows to start GRUB when booting on sda though, if it's not supposed to be there(?) – mavavilj Feb 21 '23 at 10:57boot-repair
. – mavavilj Feb 21 '23 at 11:21boot-repair
thus I can't help, as I prefer commands so I know what is done,boot-repair
being programmatic is easily swayed by BIOS settings – guiverc Feb 21 '23 at 11:29boot-repair
was that it broke the original GRUB. – mavavilj Feb 21 '23 at 11:37