Dual Booting Understanding of what's going on.

Hi,

I have just added Tumbleweed to a drive with Windows 8.1 on it and created a good dual boot drive. All went well and the installer sorted it all out for me with no issues. I even have a VHD on the Windows partition and can boot that VHD too at the Windows boot loader as I have added it to the BCD; so all is working solidly.

I want to understand a bit more about what happened with the boot loaders and where things were installed, and wondering if someone can either explain or point me the appropriate documentation.

My configuration is as follows:
I am working in a legacy environment and no EFI stuff.
Partition 1 is for windows
Partition 2 is Tumbleweed
Partition 3 is linux swap
There is no other partition like you get with windows 10 as a reserved partition at the beginning of the drive.

So where are the various boot loaders stored etc, and how are they chained? What does the MBR point to? And any other questions I have failed to ask :wink:

Thanks in advance.

PS And, Yes, I have disabled Fast Startup on Windows before the whole disk gets corrupted>:)

Active partition assuming you are using generic code. Otherwise you need to start with describing your boot configuration that we do not know.

I think this maybe a bit chicken and egg here. I just added Tumbleweed to an existing Windows booting disk and I am trying to work out what it has done so I get a better understanding of how it all works.

Going into YaST Boot Loader Module, it indicates that the boot code location is set to MBR (/dev/sda), or at least that is what is selected. So presumably this means that GRUB was installed on the drive at the top level and not on an individual partition. What I am trying to work out is how Windows is booted and what GRUB does to transfer control to the windows bootloader which it does as I get the windows screen up offering me a choice of Win 8 or native boot into a VHD on the windows partition.

Yes.

What I am trying to work out is how Windows is booted

I do not know. How do you boot Windows now?

I personally started with

and worked through it; i.e. followed the links especially the ones given in the section “See also”.

Regards

susejunky

This is too generic a description. Reports from disk partitioning tools provide the detail required to describe what you have, e.g. fdisk -l or parted -l run by root or using sudo, complete with the exact command preceding output as you see on screen, and enclosed within code tags. To really learn a lot, you could run bootinfoscript. From its output you might learn all you want just examining it, no need for us. :slight_smile:

My guess is Grub2 was installed on the MBR to load a Grub menu from the TW filesystem, and a Windows selection has been included in Grub’s menu for Grub to chainload the Windows bootloader.

Just a small off-topic.
I saw you say so somewhere else also. And while it will not lead to anything going wrong, it may lead to misunderstanding when people read this.

sudo is just one way of starting a root owned process. Thus it is not “run by root or using sudo,”, but “run by root **e.g. by **using sudo,”

bootinfoscript was a great help and I think I have worked out what is going on. Yes, GRUB2 is installed in the MBR and I can see how the bootloaders are chained (GRUB -> Windows). What I really want is to have them chain the other way round and have Tumbleweed available as a boot option in the Windows boot menu which should launch first. Looks possible provided I can make a FAT32 /boot partition, as Windows can’t see ext4.

https://wiki.archlinux.org/title/Dual_boot_with_Windows#Windows_before_Linux

The implication as I wrote it was run (directly) by (logged in) root or (root indirectly) by using (the) sudo (shortcut).

There’s no FAT32 requirement. Grub must be installed to a partition. Generic MBR code must be installed. A boot flag must be set on only the Windows primary responsible for booting. Subsequently, Windows’ bootloader can be configured to chainload to Grub. I used to do it long ago, before Vista, on multiboot installations for other people not yet comfortable with Linux. I would make the Windows primary small (400MB or less), and its system partition on the slow end of the HDD, after everything Linux.

What’s nice about the way you want Windows first is the Windows update process won’t waste your time doing/undoing/redoing/undoing/… updates because it doesn’t find a boot flag where it expects one to be. Using Windows’ own MBR code, there must be one and only one boot flag per bootable disk’s MBR table. Boot flags on logical partitions IME doesn’t get it flustered, but since I never have any, I can’t be sure. :stuck_out_tongue:

Great tips from someone who has done it. Many thanks for the help.

Way too much fuss. Turn off CMS in the EFI. Turn off secure boot in grub. Steps to create a new bootloader from scratch:

  1. Have some sane configuration:
**3400G:~ #** grep -v ^\# /etc/default/grub |grep -v ^\$ 
**GRUB_DISTRIBUTOR=TW-btrfs **
GRUB_DEFAULT=saved 
GRUB_HIDDEN_TIMEOUT=0 
GRUB_HIDDEN_TIMEOUT_QUIET=true 
GRUB_TIMEOUT=3 
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet net.ifnames=0 mitigations=auto" 
GRUB_CMDLINE_LINUX="" 
GRUB_TERMINAL="gfxterm" 
GRUB_GFXMODE="auto" 
GRUB_DISABLE_RECOVERY="true" 
GRUB_DISABLE_OS_PROBER="false" 
GRUB_ENABLE_CRYPTODISK="n" 
SUSE_BTRFS_SNAPSHOT_BOOTING="true" 
GRUB_USE_LINUXEFI="true" 
GRUB_CMDLINE_XEN_DEFAULT="vga=gfx-1024x768x16" 
GRUB_THEME=/boot/grub2/themes/openSUSE/theme.txt 
GRUB_BACKGROUND= 
**3400G:~ #**
  1. Delete the existing boot loader:
**3400G:~ #** **rm -r /boot/efi/EFI/tw-btrfs/** 

  1. Install the boot loader:
**
3400G:~ #** **grub2-install**  
Installing for x86_64-efi platform. 
Installation finished. No error reported. 

New bootloader:

3400G:~ #** ll /boot/efi/EFI/tw-btrfs/**
total 312
-rwxr-xr-x 1 root root 319488 Jun 19 15:20 grubx64.efi
3400G:~ # 

New boot #6:

3400G:~ # **efibootmgr **
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0006,0008,0002,0007,0001,0000,0003,0005,0009,000A,000B
Boot0000* tw-ext4
Boot0001* Fedora
Boot0002* manjaro
Boot0003* ubuntu
Boot0004* tw-new
Boot0005* ubuntu
**Boot0006* tw-btrfs**
Boot0007* Windows Boot Manager
Boot0008* leap-15.3
Boot0009* opensuse
Boot000A* Fedora
Boot000B* opensuse
3400G:~ # 
  1. Update boot menu:
**
3400G:~ #** **update-bootloader**  
**3400G:~ #**

New boot menu:

3400G:~ #** ll /boot/grub2/grub.cfg**
-rw------- 1 root root 35493 Jun 19 15:20 /boot/grub2/grub.cfg
3400G:~ # 

That’s all.

As I use a similar setup myself on my notebook (it runs win7, win10 and leap 15.x) I got a few issues with current win10 updates and they weird quirks with such a setup.

Main issue: Win10 feature updates for some reason require the root windows partition to contain its own M$ boot AND has to be set as active - otherwise the feature update fails just cause the update process doesn’t find the flag and bootloader it expects. It’s just another of those arbitrary decisions M$ made for no reason other than marketing BS. As I also run win7 and for some reason although I do own a valid and original license and know how to setup win7 in uefi mode the activation fails (last tried short before official support was dropped - even official M$ support wasn’t able to help me as it should had worked according to their experts) - so I have to run my system in CSM. This in turn results in issues with win10 and its updates. To all that I also run opensuse leap 15.x - which, although there in fact is an official windows-compatible bootloader by using http://download.opensuse.org/tumbleweed/repo/oss/openSUSE_installer.exe use GRUB2.

As I had to set the win10 partition active I somehow still managed to get grub loading as the first stage which has an entry for opensuse and another to chainload the windows bootloader. Another quirk I had to get working was to set the win7 bootloader active which then chainloads the win10 bootloader. For some reason the other way around chaining win10 and then win7 last for some reason doesn’T work.

TLDR: yes, there can be some weird setups where such hacking stuff is required - and for some reasons with a bit of effort one often can get it to work. But: Even though a bit of knowledge is required to get it done on your own it’s also like many linux tutorials: Just follow a couple of steps / commands in the right order - you don’t really need to know why or how it works down at the bit level.

No.

OP is using MBR + Win 8.1 + TW. That hints on 32-bit OSes.

Changing to EFI needs support from hardware for Windows 8.1+:

  1. support for EFI boot in BIOS
  2. support for x86-64 in CPU
  3. support for cx16 (CMPXCHG16b) + PrefetchW + LAHF/SAHF in CPU

And user will need to reinstall Windows OS. And change MBR to GPT. And then maybe reinstall openSUSE.

It is better in our days to choose EFI boot with x86-64, if that is available.

Even the i3-4130 I assembled in 2014 supports EFI. Out of laziness I installed using CSM and switched eventually to EFI in 2018. That was a bad decision. But reinstalling Tumbleweed wasn’t necessary: Frühjahrsputz | Karl Mistelberger

@mrmazda: Thanks got it all working, Windows and Grub happily able to launch each other but with Windows coming up first. Which is just what I wanted to achieve.

So I have now moved on and trying to do it with EFI. Boiler plated it on a VM. No problem getting Grub to chainload the Windows Boot Loader but that’s not the way round I want it. I tried adding a BCD entry as follows, having read that this was the way to do it with Ubuntu:

Windows Boot Manager--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {61255e50-d774-11eb-8544-da43295eddcc}
displayorder            {current}
                        {61255e55-d774-11eb-8544-da43295eddcc}
toolsdisplayorder       {memdiag}
timeout                 10


Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.efi
description             Windows 10
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {61255e52-d774-11eb-8544-da43295eddcc}
displaymessageoverride  Recovery
recoveryenabled         Yes
isolatedcontext         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \Windows
resumeobject            {61255e50-d774-11eb-8544-da43295eddcc}
nx                      OptIn
bootmenupolicy          Standard


Windows Boot Manager
--------------------
identifier              {61255e55-d774-11eb-8544-da43295eddcc}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\opensuse\grubx64.efi
description             OpenSUSE-Tumblwweed
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {61255e50-d774-11eb-8544-da43295eddcc}
displayorder            {current}
toolsdisplayorder       {memdiag}

The new entry shows up but if I select it, the system reboots and throws an error:
*Windows failed to Start. …
File: \EFI\opensuse\grubx64.efi
Status: 0xc000007b
Info: This application or operating system couldn’t be loaded because a required file is missing or contains errors
*

Searching the net others have had similar problems with some sources saying it is not possible to launch Grub from the Windows Boot Loader in an EFI system.

Just wondering if you have managed to get Windows before Linux dual booting with EFI and, if so, how you managed it?

I have no UEFI machines with a Windows license, so I’ve never had occasion to try.

That said, the UEFI BIOS will do as you wish. Each UEFI PC has a hotkey that will bring up a BBS menu from which you can select any OS that has an entry on the ESP. These are those I know about:

  • ASRock: F11
  • Asus: F8
  • Biostar: F9?
  • Dell: F12
  • EVGA: F7
  • Gigabyte: F12
  • HP: F9 or ESC or ESC,F9
  • Lenovo: F12 or F8 or F10
  • MSI: F11
    *]Toshiba: F12
    With efibootmgr, or the UEFI BIOS itself, you can make Windows the default, and use your BBS hotkey to select openSUSE when you don’t want to boot Windows.

Use rEFInd.

I will describe what I do.

I set the firmware to boot Windows (UEFI boot).

In openSUSE, using Yast Boot Loader, there is a box: “Update NVRAM Entry”.

I uncheck that box. That way, an openSUSE update won’t change the boot order. I think that box exists only in Leap 15.3 and Tumbleweed. It is not there in Leap 15.2.

If I want to boot into linux, I hit F12 during boot. That’s the magic key the BIOS provides for this computer.

If I am currently running linux, and I want to reboot to linux, I can use:

efibootmgr -n X

where X is the code for openSUSE. In my case, that happens to be 0000, but will probably be different for you.

If I am currently running Windows, and want to reboot to openSUSE, then I use
SHIFT restart
in Windows. That is, I hold down the SHIFT key while clicking “restart”. An option shows up “Use a device”. Clicking that gives me the choice to boot “opensuse-secureboot”.

I hope this is helpful.

As ever, many useful tips and trick - Thank you all.