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 read how to get help. Topics in this forum are automatically closed 6 months after creation.
MIRKOSOFT

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

Post by MIRKOSOFT »

Hi!

I need to install bootloader into 1st Linux partition, so have MBR untouched.
OS: Linux Mint based Commodore OS Vision 1.3
At installation it offers this not.
Is it possible by any way or only post installation procedure?

I'm newbie in Linux at all.

Thank you for help, suggestions and replies.
Miro
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18206
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 »

Hello, Miro.

In the Linux Mint installation guide, you will find the installer screenshot below.

Image

In the lower part of the screenshot you should spot the drop down list, where you specify the "Device for bootloader installation".
If you click on the little triangle on the right hand side, the list of available disk devices and disk partitions should drop down.
It should be possible to select any valid ext4 partition here, like e.g. /dev/sda4.
(In the screenshot the other partitions are NTFS or swap and cannot be used. In the situation, displayed in the screenshot, selecting /dev/sda4 should be possible, but would make no sense.)

For me this always works as expected.
I have several dual and triple boot Linux systems. All still use the good old MBR boot, no UEFI here, yet. When setting up the first system, Grub will be installed into the MBR of /dev/sda e.g. When setting up the other systems, their Grub goes to /dev/sda5 or /dev/sda6, whichever is their system partition.
So Grub of the first Linux installation will "rule" the boot loading process. It will be the master of desaster.

Best regards,
Karl
--
P.S.:
Please, note that OS: Linux Mint based Commodore OS Vision 1.3 may be based on Linux Mint, but that it is not a supported Linux Mint release.
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
MIRKOSOFT

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

Post by MIRKOSOFT »

Ok, I try it.
Why I need to use 1st Linux partition for bootloader:
I have installed OSX86, Windows XP and want to add Linux.
OSX86 bootloader is able to start Linux, but I want to leave it untouched and I want to use NTLDR to select between XP and Linux 'cause I'm booting from floppy.
And really truth is that I understand better Windows than OSX and even Linux.
I know how to add Linux to NTLDR, but it needs to have Linux bootloader on 1st Linux partition.

Also - in installing happened that MBR was rewritten by GRUB and after OSX selection it only reboots computer, in case of XP it was not problem.
And even after failed OSX choosing, I reinstalled OSX, but GRUB resided in MBR and it helped not.

So, I try but if it will not work I'll be sad.

Miro
User avatar
karlchen
Level 23
Level 23
Posts: 18206
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 »

Hi, Miro.

I do understand your reasons for putting the Grub bootloader into the first Linux partition.
Whether it will work or not, depends on whether you select the correct disk partition, /dev/sdaX, where X will be a number like 1, 2, 3, etc.
I do not know which is the right /dev/sdaX in your case.
I only told you where the location for the Grub boot loader can be selected.

Rule of thumb:
In case your Linux partition will be on /dev/sda5 (the one to be mounted under Linux as /), then select /dev/sda5 as your Grub boot loader device, too.
In case your Linux partition should be on /dev/sda3 (the one to be mounted under Linux as /), then select /dev/sda3 as your Grub boot loader device, too.

Best regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
MIRKOSOFT

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

Post by MIRKOSOFT »

In my case it is 3rd partition of single disk, so
/dev/sda3
So, I try it this week and result will report.
Miro
MIRKOSOFT

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

Post by MIRKOSOFT »

Hi!

So, finally I did it by recommended steps, but found problem:
I can't to start Linux.
Of course for bootloader installation into 1st Linux partition.

I had no choice to create installation diskette.
Is any way to create it?
or
Way to create Linux item in NTLDR is possible in Linux, but is possible to create file by dd.exe (MS-DOS tool from Linux)?
Only enter this
dd.exe if=/dev/hda3/ of=start.lnx bs512 count=1
will it create start.lnx file correctly?

Thank you for help again.
Miro
pbear
Level 16
Level 16
Posts: 6569
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 »

Not familiar with your system, but can tell you how this works in Mint. If you install Mate 19.1 to sda1, Cinnamon to sda2 and XFCE to sda3, putting the bootloaders for the latter two on their respective partitions, it's sudo update-grub in the FIRST system (here, Mate) which makes them bootable.
MIRKOSOFT

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

Post by MIRKOSOFT »

I installed it and succesfully - even it leaves MBR untouched.
I have now problem to boot into Linux.
I found over the web GRUB Bootloader diskette, works even with other OSes, but in case of Linux it outputs error: loader is corrrupted.
This I understand not - installation was successful.

Miro
jchelpau

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

Post by jchelpau »

Setting GRUB to install to an ext4 partition should work fine (I did this for VeraCrypt)
MIRKOSOFT

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

Post by MIRKOSOFT »

That's done.
Bootloader is installed on Ext4 partition.

Miro
MIRKOSOFT

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

Post by MIRKOSOFT »

Still don't know how to enter Linux.
GRUB boot floppy works not correctly.
I have only installer DVD which can be used also as Live System.

Is possible to create there any startup disk?

Miro
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

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

Post by pbear »

Bear in mind karlchen's comment in the first reply to your OP:
Please, note that OS: Linux Mint based Commodore OS Vision 1.3 may be based on Linux Mint, but that it is not a supported Linux Mint release.
Also, I see on Wikipedia:
This operating system is no longer in development. The company is now closed and its web site is no longer active.
I do notice there's a link at the bottom of the Wiki page for a user group on Facebook. You might try there.

By the way, did you run sudo update-grub on the Commodore system? If there's a simple solution, that would be it.
User avatar
karlchen
Level 23
Level 23
Posts: 18206
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 »

Hi, guys.

Running update-grub will not help in this case.
As MIRKOSOFT had explained above, he wants Windows XP NTLDR to offer starting Commodore OS.
Commodore OS has been installed on /dev/sda3, Grub has been put on the same partition /dev/sda3 as well, as was MIRKOSOFT's wish.

As a consequence, the primary OS, Windows needs to be enabled to chainload Linux Grub on /dev/sda3 from its boot manager.
I had assumed that this had been clear. But obviously, this had not been clear, and obviously MIRKOSOFT does not know how to do so.

There is a Windows software EasyBCD, which can be installed on Windows and which can do precisely this: add a Linux system to the Windows boot menu. (For private use, the free version can be used.)
EasyBCD will copy the Grub boot loader on /dev/sda3 to a folder on Windows drive C: and create the needed bootmgr entries to enable Windows to chainload the Grub boot loader.
At least on my Windows 7 64-bit Home Edition, this worked as expected.

Best regards,
Karl
--
P.S.:
Have removed the [solved] flag from the thread, because installing Grub to /dev/sda3 is only half of the truth.
Making Windows XP chain loading Grub on /dev/sda3 is still pending.
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
User avatar
arvy
Level 6
Level 6
Posts: 1286
Joined: Sat Mar 26, 2016 11:22 am

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

Post by arvy »

As karlchen says, EasyBCD can let you chainload Grub from the Windows XP boot.ini menu and there are several other possibilities as well. In fact, EasyBCD just uses a minor variant of Grub4Dos. I personally prefer the latter because of its very versatile capability for additional boot options ranging from ISO files to WinPE/RE "rescue" images. (No extraction or media burning needed.) For the specific LM Grub2 boot requirement mentioned here, Grub4Dos can also be used in conjunction with AIO boot as this tutorial explains in detail. It works for any Windows version, but be sure to scroll down to the Windows XP section in your case.

Regardless of whether you choose Grub4Dos or one of its many derivatives such as EasyBCD, be forewarned that you may encounter difficulties if your ext4 partitions have been formatted with 64-bit extensions. The current LM installer does that by default, but 64-bit ext4 extensions actually have negligible value for anything less than 16 TB and can be eliminated by using GParted partitioning during LM setup. GParted does not add 64-bit extensions to ext4 partitions by default and the LM installer can be "persuaded" not to with the following command: sudo sed -i 's/64bit,//' /etc/mke2fs.conf

__
P.S.: Strictly as added info and not essential to this objective -- The MBR vs PBR Grub2 installation choice isn't actually critical to Grub4Dos booting of LM or other distros. Nor does Grub4Dos itself require MBR or PBR installation. Very similar to a Grub1 menu.lst entry, it just needs to be able to find and chainload core.img as follows:

Code: Select all

title Linux Mint
find --set-root /boot/grub/i386-pc/core.img
kernel /boot/grub/i386-pc/core.img
pbear
Level 16
Level 16
Posts: 6569
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 »

karlchen wrote: Sun Apr 14, 2019 6:10 amAs MIRKOSOFT had explained above, he wants Windows XP NTLDR to offer starting Commodore OS.
Sorry, karl, I had indeed misunderstood who is on first.
MIRKOSOFT

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

Post by MIRKOSOFT »

So, how I want to add Linux to NTLDR:
Entering command in console

if=/dev/hda3/ of=start.lnx bs=512 count=1

My problem is to enter Linux - only by Live part of installer and even I know not how to browse folders in console.
Really I'm in Linux world newbie, Windows I know very good...

So, Q remains - if I enter mentioned command, where will be file placed?
When I can copy file to Windows partition (e.g C:) it is easy to add option to NTLDR by boot.ini modifying:
c:\start.lnx=“Boot Linux“

That's all.

So Q now is only:
Where will be placed start.lnx after creation in console?
and
Is it possible to do also from Live part of installer - so without entering installed Linux?

Thank you for understanding.
Miro
User avatar
arvy
Level 6
Level 6
Posts: 1286
Joined: Sat Mar 26, 2016 11:22 am

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

Post by arvy »

I'm not at all sure what method or guidelines you are actually using, but if you follow either karlchen's suggestion or mine, the setup is quite straightforward. The instructions for using EasyBCD are on its web site. If you choose my Grub4Dos suggestion, the Grub4Dos tutorial includes a download link.

In the latter case, there is no need to "install" anything. You only need to extract the GRLDR and GRLDR.MBR files from the Grub4Dos download and copy them into the Windows XP drive's root (aka C:\). Next, also in the WinXP drive's root, create a plain test menu.lst file as follows:

Code: Select all

timeout 0
default 0
  
title Linux Mint
find --set-root /boot/grub/i386-pc/core.img
kernel /boot/grub/i386-pc/core.img
Then edit the Windows XP boot.ini file to add the C:\GRLDR="Boot Linux Grub" option to in its [operating systems] section, so that the revised boot.ini file looks something like this:

Code: Select all

[boot loader]
timeout=10
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP" /noexecute=optin /fastdetect
C:\GRLDR="Boot Linux Grub"
That's it. That's all there is to it other than perhaps changing the boot.ini default=C:\GRLDR if you wish to do so. Additional Grub4Dos menu.lst boot options could be included later, but that's a whole other subject.
MIRKOSOFT

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

Post by MIRKOSOFT »

Ok, by your words:

"...need to extract the GRLDR and GRLDR.MBR files from the Grub4Dos download..."

Really is Grub4Dos required?
I want to do it without any external tool.
Example is creating Start.lnx file - or is it not possible? I cannot believe that Linux is in any way OS not able to do anything!
I think Linux is opposite to OSX - Linux allows user all, OSX allows nothing, only few mods small but hard to do.

Miro
User avatar
arvy
Level 6
Level 6
Posts: 1286
Joined: Sat Mar 26, 2016 11:22 am

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

Post by arvy »

I've offered you a way to boot Linux from the Windows XP NTLDR/boot.ini startup that I know works from my own direct experience, albeit now some time ago, but still used for many other newer things. It's entirely up to you whether you want to make use of that suggestion to accomplish your objective, but if you do, then yes, it requires what I said it requires. If not, as I also said, I have no idea at all about that "start.lnx" thing you're trying to create "without any external tool" and whether or not it's possible. Perhaps you'll tell me. I can only wish you the very best of good luck with it.
__
P.S.: What you're dealing with really has very little to do with what the Linux OS allows or doesn't allow. It's a matter of what the MS Windows boot loader allows and is capable of doing when your system hands off start-up control to it. If you switch to Linux Grub, you'll have no problem at all.
br1anstorm
Level 5
Level 5
Posts: 602
Joined: Mon Nov 24, 2014 8:53 am

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

Post by br1anstorm »

karlchen wrote: Sun Apr 14, 2019 6:10 am
There is a Windows software EasyBCD, which can be installed on Windows and which can do precisely this: add a Linux system to the Windows boot menu. (For private use, the free version can be used.)
EasyBCD will copy the Grub boot loader on /dev/sda3 to a folder on Windows drive C: and create the needed bootmgr entries to enable Windows to chainload the Grub boot loader.
At least on my Windows 7 64-bit Home Edition, this worked as expected.

Best regards,
Karl
--
P.S.:
Have removed the [solved] flag from the thread, because installing Grub to /dev/sda3 is only half of the truth.
Making Windows XP chain loading Grub on /dev/sda3 is still pending.
I'm catching up rather late with this discussion, and I don't have the knowledge to comment on Grub4Dos or on manual editing of the grub files.

But I am a user of EasyBCD, and if MIRKOSOFT or anyone else is thinking of trying this option, I need to post up a warning.....

EasyBCD works well where the main or first operating system (whose MBR bootloader it preserves and modifies) is Windows Vista, 7, 8 or 10. I notice that karlchen, like me, has EasyBCD set up with Windows 7, to dual boot Linux Mint (or in my case, multiboot with Mint, Lite and PCLinuxOS).

EasyBCD can also be used where the primary operating system is Win Vista, Win7 or later in a set up which then dual boots WinXP as the 'secondary' operating system option..... if anyone wants to do that!

But despite the impression given by the EasyBCD website, EasyBCD can NOT, as far as I know, be used where Win XP is the primary operating system, to dual boot any other OS. I don't recall the exact explanation, but the key point is that WinXP uses a different bootloader process (boot.ini?) to the BCD of Windows Vista, 7 and later - and EasyBCD cannot use or modify the WinXP bootloader to "see" and boot up other operating systems.

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!
Locked

Return to “Installation & Boot”