How to install bootloader to 1st Linux partition intead to MBR?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
User avatar
arvy
Level 4
Level 4
Posts: 319
Joined: Sat Mar 26, 2016 11:22 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by arvy » Mon Apr 15, 2019 9:29 pm

br1anstorm wrote:
Mon Apr 15, 2019 7:05 pm
It looks from arvy's advice that there may be other ways of (dual) booting into Linux by modifying the WinXP boot.ini files so as to enable chainloading onward to a Linux Grub installed in a separate partition. But that's way beyond my understanding!
I can assure you without any reservation whatsoever that the Grub4Dos method that I outlined above will work with Windows XP. In fact, Grub4Dos will work with any other boot manager that can be made to pass control to it, and that includes all Windows boot managers to date. Only the method for inserting it into the boot options "lineup" differs between ntldr/boot.ini and the later bootmgr/BCD store. The "magic" isn't at all complicated. As its name implies, it's just a Grub derivative that is capable of operating under the NTFS file system to find and load Linux kernels (among other things) in the same way that Grub itself does. It's quite versatile. The "other things" (see tutorial) include most ISO files and WinPE/RE "rescue" images as I mentioned. It can be installed into a PBR and/or MBR if desired, but it's not necessary to do that.

NeoSmart's EasyBCD, in turn, uses a derivative of Grub4Dos that they've named NeoGrub. Again as the name implies, EasyBCD is mainly about manipulating the BCD (boot configuration data) store of the Windows versions that use that more recent boot management system. The relevant web page says that "NeoGrub is especially useful when it comes to adding a *nix-based operating system to the Windows Vista/7/8 bootloader" and makes no similar claim about either XP or W10. On the other hand, there's nothing very special about their "NeoGrub" derivative of Grub4Dos so far as I can see. If anything it seems less versatile, but I've never actually used it myself. Karlchen would likely know better than I if there's any insurmountable reason why it couldn't be adapted for use with Windows XP.

__
P.S.: in the unlikely event anyone may actually be interested, my complete Grub4Dos menu.lst is as follows.

Code: Select all

clear
color white/blue blue/white black/white green/white
splashimage /boot/grub/splash.xpm.gz
timeout 10
default 0
 
title Windows PE/RE Rescue Options
find --set-root /CdUsb.Y
chainloader /bootmgr
 
title Linux Mint Cinnamon
find --set-root /boot/grub/i386-pc/core.img
kernel /boot/grub/i386-pc/core.img
 
title Linux Mint Live (ISO)
map --heads=0 --sectors-per-track=0 /Sources/LinuxMint.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)
 
title Terabyte Image For Linux (ISO)
map /Sources/TerabyteIFL.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)
 
title Acronis True Image (ISO)
map --heads=0 --sectors-per-track=0 /Sources/AcronisMedia.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)
 
title Windows 10
find --set-root /Windows/bootstat.dat
chainloader /bootmgr
 
title Reboot
reboot
 
title Shutdown
halt
The BCD store entry for the Windows 10 boot options menu is a very simple one as follows.

Code: Select all

Real-mode Boot Sector
---------------------
identifier              {d2fd47df-f7ae-11e8-b507-f15348918191}
device                  partition=C:
path                    \grldr.mbr
description             Grub4Dos
System: Asus ROG Maximus XI Code mobo, Intel i9-9900K CPU, Nvidia GTX1080 GPU, 32 GB DDR4-3600 RAM, Sumsung Pro 2x512GB NVMe & 3x1TB SSD, Mint 19.1 x64 Cinnamon

User avatar
karlchen
Level 20
Level 20
Posts: 11048
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by karlchen » Tue Apr 16, 2019 1:43 pm

Hello, arvy.
arvy wrote:
Mon Apr 15, 2019 9:29 pm
[...] Karlchen would likely know better than I if there's any insurmountable reason why it couldn't be adapted for use with Windows XP. [...]
I am afraid that you may be right. EasyBCD supports Windows 7 and later. But it is unsure whether current EasyBCD versions still support Windows XP. (I think early versions did.)
Windows XP uses a less complexly structured boot manager than later Windows versions do.
I have never used EasyBCD on Windows XP, only on Windows 7.

For the next few weeks, I will not have access to any Windows system (neither Windows 7, nor Windows XP), where I could try anything. I will be limited to Linux Mint 18.3 and Ubuntu 18.04 Mate. (No need to pity me. :wink: )
In brief words: no input from my side for the next few weeks.

--
P.S.:
I think that the right approach is very close to what MIRKOSOFT is trying to do. Maybe he just missed a single relevant step.
Or the issue really is that Windows XP is not the primary OS, managing the boot manager, but that it is only chainloaded by OSX.
Else this instruction looks concise and correct to me: Classical Final Solution

Regards,
Karl
Image
Linux Mint 19.2 32-bit xfce Desktop, Total Commander 9.22a 32-bit
Linux Mint 18.1 64-bit Cinnamon Desktop, Total Commander 9.22a 64-bit
Windows? - 1 window in every room

User avatar
arvy
Level 4
Level 4
Posts: 319
Joined: Sat Mar 26, 2016 11:22 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by arvy » Tue Apr 16, 2019 3:27 pm

karlchen wrote:
Tue Apr 16, 2019 1:43 pm
Hello, arvy.
Hi Karl
I have never used EasyBCD on Windows XP, only on Windows 7.
Neither have I, nor with any other Windows version for that matter as I never found it necessary for my own purposes. I don't recall exactly when it first appeared, but not until quite some time after Vista introduced the boot configuration data store, and it may not have included their NeoGrub derivative of Grub4Dos until some time after that.
P.S.: I think that the right approach is very close to what MIRKOSOFT is trying to do. Maybe he just missed a single relevant step. Or the issue really is that Windows XP is not the primary OS, managing the boot manager, but that it is only chainloaded by OSX.
Could be either one or a combination of those factors, I suppose
Else this instruction looks concise and correct to me: Classical Final Solution
Very interesting. I see that other sections of that same web page do suggest using "easybcd help", but only with Vista. Considering that the page was "last modified on 16 October 2011, at 17:25", one wonders about some aspects of its current applicability. In essence, that "Classical Final Solution" is suggesting the creation of your own limited equivalent of the Grub4Dos GRLDR.MBR by extraction from the media disk's linux.bin file. Personally, I think that's doing things the hard way, but to each his own.

I'm quite sure you'll manage to survive your "Windows deprivation" experience without any lasting scars and I don't pity you in the least. :)
System: Asus ROG Maximus XI Code mobo, Intel i9-9900K CPU, Nvidia GTX1080 GPU, 32 GB DDR4-3600 RAM, Sumsung Pro 2x512GB NVMe & 3x1TB SSD, Mint 19.1 x64 Cinnamon

User avatar
karlchen
Level 20
Level 20
Posts: 11048
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by karlchen » Wed Apr 17, 2019 2:19 pm

Hi, Arvy.

Actually following the old instruction,
+ you fetch the Linux Grub boot sector and write it to a file,
+ which is located on the Windows XP boot parition and
+ you make NTLDR chain-load this Grub boot sector
+ thus passing control to Grub which will boot Linux

As Windows XP is much older than 2011, the instruction is unlikely to have been invalidated by any Windows XP update.
If done right, it will still work.

The difference between Windows XP and Windows 7 is only that
+ the amendment to C:\Boot.ini is simple and can be done using Notepad
+ the amendment to the Windows 7 boot menu requires bcdedit and the precise steps are a bit tricky
(have done them on Windows 7, because EasyBCD cannot add more than 1 Linux system to the Windows 7 boot menu, but I wanted 3 of them)

Cheers,
Karl
Image
Linux Mint 19.2 32-bit xfce Desktop, Total Commander 9.22a 32-bit
Linux Mint 18.1 64-bit Cinnamon Desktop, Total Commander 9.22a 64-bit
Windows? - 1 window in every room

User avatar
arvy
Level 4
Level 4
Posts: 319
Joined: Sat Mar 26, 2016 11:22 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by arvy » Wed Apr 17, 2019 4:05 pm

I fully understand all of that, Karl. I wasn't disputing anything that you said. Sorry if I gave you the impression that I was. If fetching the Linux Grub boot sector and writing it to a file actually works in the way you suggest, I'll be more than happy to applaud the concept.

Apparently, however, it must be error prone to some extent for some reason. Therefore, knowing from my own direct experience that Grub4Dos does work and is available as a simple direct downloaded to accomplish the same and much more, I was just offering it as a possible alternative. That's all. Certainly not to denigrate anyone else's idea if they think that it's somehow better or easier or whatever.
System: Asus ROG Maximus XI Code mobo, Intel i9-9900K CPU, Nvidia GTX1080 GPU, 32 GB DDR4-3600 RAM, Sumsung Pro 2x512GB NVMe & 3x1TB SSD, Mint 19.1 x64 Cinnamon

MIRKOSOFT
Level 1
Level 1
Posts: 16
Joined: Thu Mar 07, 2019 10:55 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by MIRKOSOFT » Thu Apr 18, 2019 8:37 pm

So, I tried to follow one of suggestion.

I tried to create linux.bin by this:
Opened terminal and typed
sudo -i | su
after this it shows entering password - I tried to type anything but not possible - accepted only one key and it was Enter, so password was not typed
Then I typed
dd if=/dev/sda3 of=/dev/sda1/linux.bin count=1 bs=512
to copy bootinfo to C:\ partition and of course it outputs Permission denied
if I could to type password it could remain only this:
sync

So, Q is simplest as possible: how to open terminal with admin rights?

Thank you for each word.

Miro

jchelpau
Level 3
Level 3
Posts: 100
Joined: Mon Mar 25, 2019 11:19 pm
Location: Australia
Contact:

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by jchelpau » Thu Apr 18, 2019 9:10 pm

Try this:

Code: Select all

sudo -i
mount /dev/sda1 /mnt
dd if=/dev/sda3 of=/mnt/linux.bin count=1 bs=512
umount /mnt

MIRKOSOFT
Level 1
Level 1
Posts: 16
Joined: Thu Mar 07, 2019 10:55 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by MIRKOSOFT » Fri Apr 19, 2019 7:46 pm

Success!

Thank you very much!

Now I added Linux and DOS to NTLDR and have new problem but it is problem of Windows NTLDR, nothing with Linux.
After choosing different OS than XP it reports:

<Windows root>\system32\hal.dll
is damaged/missing, reinstall file!

This I try to solve later, really important Q and solution here on Mint forum I found by your all help.
Thank you all.
When I fix NTLDR error I'll reply.

Thank you all.
Miro

User avatar
arvy
Level 4
Level 4
Posts: 319
Joined: Sat Mar 26, 2016 11:22 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by arvy » Fri Apr 19, 2019 7:53 pm

Considering the circumstances, you may find this information helpful.
System: Asus ROG Maximus XI Code mobo, Intel i9-9900K CPU, Nvidia GTX1080 GPU, 32 GB DDR4-3600 RAM, Sumsung Pro 2x512GB NVMe & 3x1TB SSD, Mint 19.1 x64 Cinnamon

MIRKOSOFT
Level 1
Level 1
Posts: 16
Joined: Thu Mar 07, 2019 10:55 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by MIRKOSOFT » Fri Apr 19, 2019 8:25 pm

That link writes about problem with Windows booting.
My Windows XP boots correctly.
Only when I choose DOS or Linux error appears.

Miro

User avatar
arvy
Level 4
Level 4
Posts: 319
Joined: Sat Mar 26, 2016 11:22 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by arvy » Fri Apr 19, 2019 9:07 pm

It provides some reasons why a “HAL.dll is missing or corrupt” error message might appear. But never mind.
System: Asus ROG Maximus XI Code mobo, Intel i9-9900K CPU, Nvidia GTX1080 GPU, 32 GB DDR4-3600 RAM, Sumsung Pro 2x512GB NVMe & 3x1TB SSD, Mint 19.1 x64 Cinnamon

hcentaur13
Level 4
Level 4
Posts: 463
Joined: Sat May 18, 2013 5:13 pm

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by hcentaur13 » Sat Apr 20, 2019 3:46 am

Since years there are 2 different, incomatible methods to boot up an OS:
1. MBR, known as old DOS or compatible method, can without tricks only boot a single OS
2. UEFI, can boot multiple OSes concurrently by using an own partition with UEFI bootmanager

In DOS/compatible mode there is no chance to install GRUB outside MBR! It will overwrite the dumb windows boot manager and serves the way to boot windows alternatively.

grub in /boot will be booted from grub in MBR in default or when the user has selected Linux in its grub boot menu.

Mint live system up to 18.x uses compatibility/DOS mode to boot up. Mint since 19 uses UEFI in default! The bootup mode of the live system defines which boot mode is set up by the installer for the installed system. This is a critical step because UEFI and DOS/compatible are incompatible together. Each installed system has to use the same mode!, also either DOS/compatible OR UEFI. Anything else makes it nearly impossible to boot the selected OS!

UEFI requires a new type of partition table, named GPT. Writing a new partition table will remove any partition from that device! Any data on it gets forgotten.

An UEFI boot partition contains a directory UEFI bootstrap that boots up the selected OS, that is in the separate directory.

hcentaur13
Level 4
Level 4
Posts: 463
Joined: Sat May 18, 2013 5:13 pm

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by hcentaur13 » Sat Apr 20, 2019 5:00 am

It depoends:

How is windows booted?
- compatibility mode? Then install grub in mbr. It gives you the chouce to boot windows instead of linux
- UEFI?
- install grub in the UEFI partition. Beside linux it can boot windows too

BIOS can boot in
- compatibility mode: only through MBR, so grub must be installed there to get the choice to boot either windows or linux
- UEFI because there must be a partition that is designed to hold multiple directories whereas each directory contains the bootloader of the selected OS.
Whereas grub can even boot windows too.

hcentaur13
Level 4
Level 4
Posts: 463
Joined: Sat May 18, 2013 5:13 pm

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by hcentaur13 » Sat Apr 20, 2019 11:04 am

I don't trust windows and its software. grub is proven to boot anything including windows bootloader. It will boot anything even it is installed in UEFI or compatibility mode (not on the same computer)

MIRKOSOFT
Level 1
Level 1
Posts: 16
Joined: Thu Mar 07, 2019 10:55 am

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by MIRKOSOFT » Sat Apr 20, 2019 1:16 pm

I'm using MBR drive for DOS (FAT32), Windows XP (FAT32) and Linux (EXT4 & SWAP) partitions.
DOS knows only MBR - so is required.
XP is on half way to GPT and UEFI.
I know that Linux can use both, even by default when I install bootloader of Commodore OS Linux Mint into MBR it can easy boot XP or other Windows - but:
DOS is not possible to reach - no any way!

This is reason why I don't want to use GRUB.
Or if is possible to install GRUB to floppy - this can solve all.

Miro

pbear
Level 6
Level 6
Posts: 1441
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How to install bootloader to 1st Linux partition intead to MBR?

Post by pbear » Sat Apr 20, 2019 11:44 pm

FWIW, the official Grub manual discusses creation of a Grub boot floppy disk. Haven't done it myself, though.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Post Reply

Return to “Installation & Boot”