1

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?

enter image description here

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:

  1. specify the disk (eg /dev/sdX, not /dev/sdaXY) not currently used to boot the system for the bootloader location.

  2. 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.

  3. If the user wishes to restore booting with the original bootloader, change the boot order back to the original drive.

mavavilj
  • 211
  • If you installed grub to sdb, then it is how it should work. – Pilot6 Feb 21 '23 at 10:56
  • I don't actually know where it is. How to check? I just ran 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:57
  • You should not install grub to both devices. Probably some part if grub is installed to sda. I suggest leaving as it is. Boot from sdb. – Pilot6 Feb 21 '23 at 10:59
  • @Pilot6 Why do you suggest not touching it? – mavavilj Feb 21 '23 at 11:00
  • Because it makes no sense. There should be one primary boot device with a properly setup grub. It is sdb now. It wont work well with both anyway. You can spend some time and change it to sda, but what is the reason? – Pilot6 Feb 21 '23 at 11:02
  • You've likely got grub on both drives; and thus you're booting a different grub when you hit F9 & boot the other drive... You've not highlighted how you boot (as I saw it; ie. what mode) and the legacy form of GRUB sites outside of the drive partitioning (as per the 1982 standard that's still followed today) it may not be impacted by a windows 10 install (you didn't specify modes of boot but don't mention uEFI/Secure-uEFI thus maybe you're using legacy/CSM/..)... – guiverc Feb 21 '23 at 11:10
  • @Pilot6 I just want to understand whether it's actually on sdb (or both) now and why it also shows GRUB when I boot to sda. It was originally on sda before I installed Windows on sdb and did boot-repair. – mavavilj Feb 21 '23 at 11:21
  • @guiverc Yes my BIOS is set on Legacy (HP Elitebook). – mavavilj Feb 21 '23 at 11:25
  • You'll have 2x grub systems installed.. one on each drive in sector 0 (ie. outside of the partitioning space used by all OSes including windows/Ubuntu/etc) being reserved for the boot process as per the first IBM PC DOS 2 of 1982 (a standard still used today except where uEFI/Secure-uEFI is used; though uEFI just ignores sector 0 & still doesn't overwrite it thus complying with the 1982 standard...) FYI: You've used boot-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:29
  • @guiverc Yes that seems the case, and official doc explains that in a dual-booted system one should use the second/new one, because it has a reference to the other OS. When one boots to sda it uses the previous GRUB. I just don't understand why these cannot be merged now. Or maybe it risks corrupting the original Ubuntu disk? – mavavilj Feb 21 '23 at 11:31
  • It seems like this is in fact the intended way, because what it did before boot-repair was that it broke the original GRUB. – mavavilj Feb 21 '23 at 11:37
  • We do not normally suggest running the default fix with Boot-Repair until someone has reviewed report. Sometimes you have to choose the advanced mode and make selections with that for a correct repair. Boot-Repair's most often fix is an update to grub. Or a full reinstall of grub for first install seen. It typically cannot fix Windows, but may be able to install a Windows type BIOS boot loader to Windows drive. But most systems are less than 10 years old, so UEFI, not old BIOS. – oldfred Feb 21 '23 at 14:56
  • @oldfred But as the official doc specifies in the question, with dual-boot it seems expected that there's a new GRUB for Windows and the previous GRUB for Ubuntu. Now if one deletes the whole Windows drive, then Ubuntu would not stop working. So it makes sense. I just wonder if this type of Windows disk is compatible with non- dual-booted systems. So that one could e.g. restore Windows from such disk that also has GRUB. – mavavilj Feb 22 '23 at 07:07
  • Do not really know Windows fixes. But you should always have a Windows repair/recovery flash drive & good backups of all your systems or data. https://askubuntu.com/questions/1156795/windows-hard-disk-read-only-now-windows-is-removed If you want to see details of boot, post link to summary report from Boot-Repair in question above. – oldfred Feb 22 '23 at 14:41

0 Answers0