LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to get grub2 to boot a distro in a logical partition (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-grub2-to-boot-a-distro-in-a-logical-partition-4175571838/)

Higgsboson 02-09-2016 06:04 PM

How to get grub2 to boot a distro in a logical partition
 
I have read somewhere that GRUB2 is not able to boot an OS on a logical partition. So how is it possible to multi-boot with grub given that we are limited to 4 primary partitions?

Is it that a separate /boot partition needs to be created on a primary partition or is it something to do with chainloading?

Currently I have grub booting from the mbr and I believe it is located in sda1. It can see a Windows OS in sdb1 (i.e another hard disk) which previously had access to the mbr. If I want to install further linux distros onto the sdb hard disk, how can I do this if grub can't see distros in a logical partition?

I've looked on the net, but can't find an easy answer to what seems to be a simple problem.

syg00 02-09-2016 06:14 PM

Total rubbish.
Even grub legacy didn't care. I have (several actually) systems that only have logical partitions.

Some lame installers (Linux as well as M$oft) demand a primary partition, but that is because of the devs on that particular distro - nothing to do with grub. For gpt disk, the discussion is moot as they are all primary.

yancek 02-09-2016 06:49 PM

Quote:

I have read somewhere that GRUB2 is not able to boot an OS on a logical partition.
Wherever you read that is a good place to avoid in the future as it is absolutely false. I currently have 11 Linux operating system on logical partitions and they all boot with no problems. I don't use and have never used a separate boot partition, it isn't necessary but some choose to have it.

Quote:

Currently I have grub booting from the mbr and I believe it is located in sda1.
Not sure what you mean by that. If you are using the older MBR method to boot, Grub will have a tiny amount of code in the MBR but most of it is on the / partition in the boot directory. Are you aware that the manuals for Grub Legacy and Grub2 are available to read online, if you want the facts from the source.

Higgsboson 02-09-2016 09:14 PM

Quote:

Originally Posted by syg00 (Post 5497807)
Total rubbish.
Even grub legacy didn't care. I have (several actually) systems that only have logical partitions.

Some lame installers (Linux as well as M$oft) demand a primary partition, but that is because of the devs on that particular distro - nothing to do with grub. For gpt disk, the discussion is moot as they are all primary.

I see. I have noticed there are many defenders of grub. For a newbie like me, grub is essentially a menu screen allowing multi-boot.

However, it seems grub has to deal with the twin challenges of BIOS and Linux who may have conflicting demands. Also, it may even need to fight with Windows to own the MBR securely (idk).
It's amazing to see so much complication caused by different interest groups over - what seems to the users eyes - is a simple menu screen.
Nonetheless, it is good to see software from the GNU project fighting for its principles. However, the logo of grub1 (perhaps a vigilant Stallman) is replaced with the grub2 logo which shows a less energised individual https://en.wikipedia.org/wiki/GNU_GRUB.

Higgsboson 02-09-2016 09:40 PM

Quote:

Originally Posted by yancek (Post 5497820)
Wherever you read that is a good place to avoid in the future as it is absolutely false. I currently have 11 Linux operating system on logical partitions and they all boot with no problems. I don't use and have never used a separate boot partition, it isn't necessary but some choose to have it.

So that means I can put an OS onto a logical partition and grub2 will automatically see it on boot?
I don't have to add code to any files?

Quote:

Not sure what you mean by that. If you are using the older MBR method to boot, Grub will have a tiny amount of code in the MBR but most of it is on the / partition in the boot directory. Are you aware that the manuals for Grub Legacy and Grub2 are available to read online, if you want the facts from the source.
Ah, yes. I should've written 'grub2' as opposed to 'grub'. However, I haven't found anything about the relationship between grub2 in an mbr and a bootable partition.
Although 'fdisk -l' places an asterisk under the boot header for the location of the actual boot file, I'm not sure if that is reliable after reading various websites

syg00 02-09-2016 09:51 PM

grub{legacy,2} ignores the boot flag. Some BIOS require there to be one, but grub doesn't care

yancek 02-10-2016 08:31 AM

Quote:

However, it seems grub has to deal with the twin challenges of BIOS and Linux who may have conflicting demands. Also, it may even need to fight with Windows to own the MBR securely (idk).
Grub (GRand Unified Bootloader) is a bootloader used to boot various operating systems and not "a menu screen". It doesn't deal with the BIOS. You boot the computer and the power on self test is run, the BIOS then looks to a specific location on the first hard disk set to boot priority in the BIOS and turns the booting over to the code on the drive. Doesn't matter what the bootloader is or what the operating system is. If you use a windows-only system, you have windows code. If you use Linux, you have Linux code.

Quote:

So that means I can put an OS onto a logical partition and grub2 will automatically see it on boot?
No, it's not magic. If you install a Linux operating system with the Grub bootloader to a machine with other operating systems already on it and install the Grub bootloader to the MBR, during the installation process of the bootloader, it should detect these operating systems. If, on the other hand, you already have Grub installed with another Linux operating system and you install an additional Linux system, the Grub from the original will obviously have no way of knowing an additional system has been installed so you need to run either sudo update-grub or grub-mkconfig commands which search the system for new operating systems.

Quote:

However, I haven't found anything about the relationship between grub2 in an mbr and a bootable partition.
The code in the MBR simply points to the partition where boot files are. It's too small to do much else. You should be able to find all the information you want from the Grub2 Manual at the link below.

http://www.gnu.org/software/grub/manual/grub.html

Quote:

Although 'fdisk -l' places an asterisk under the boot header for the location of the actual boot file, I'm not sure if that is reliable after reading various websites
The asterisk identifies the partition which is active/bootable and this is necessary for a windows system to boot. I've never seen or experienced this being needed with any Linux system although it may be.

Higgsboson 02-10-2016 02:35 PM

Quote:

Originally Posted by yancek (Post 5498085)
No, it's not magaic. If you install a Linux operating system with the Grub bootloader to a machine with other operating systems already on it and install the Grub bootloader to the MBR, during the installation process of the bootloader, it should detect these operating systems. If, on the other hand, you already have Grub installed with another Linux operating system and you install an additional Linux system, the Grub from the original will obviously have no way of knowing an additional system has been installed so you need to run either sudo update-grub or grub-mkconfig commands which search the system for new operating systems.

That is the clarification I was looking for. I think I was confused old discussions about grub legacy with grub2.
Since I already have a linux OS using the bootloader, I'm not going to add grub to a new OS during the installation phase.


All times are GMT -5. The time now is 07:35 PM.