Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

Thread: Understanding grub/boot

  1. #1
    Join Date
    May 2010
    Location
    Central USA
    Posts
    268

    Default Understanding grub/boot

    I have a vague concept, but I would fail any test over the boot process. I've read a page about the grub2 commands but still am having a hard time understanding exactly how it works, or maybe what choices I need to make on the install.

    To demonstrate my lack of understanding and question, after the first OpenSUSE version I installed, I now have created multiple partitions on my hard drive with a home partition separate. I installed 12.1 on an extended partition. Having read that not all computers support booting to extended partitions, I was prepared for it not working. When I restarted the system, it was just a blinking cursor. So I used a gparted disk to flag the original system, added to its menu to chainload to the extended partition and got the system to work.

    With 12.3, I managed to get a primary partition available and installed it on that. However, booting still did not work. So now I don't know if the extended partition might have booted if I understood what I needed to do.
    Maybe since it is using grub2, it needed to change the main MBR of the whole hard disk?

    Anyway, where I get confused is on the boot loader setting screen. On the 13.1 setup, I see the similar help screens which do not really tell me what I could understand.

    There are several checkmarks, and could it be valid to check multiple ones, or only one?
    When it says, boot from Master Boot Record, does that mean it will change my whole hard drive boot process and if something was working it may no longer work?
    When it says Boot from Root Partition, is that .... Well, I don't know what that could mean... Is root same as boot? For those having a separate boot partition from your main system play a role here? Since there's a checkmark for extended, does root mean like primary? Is root whichever partition your main system (/) is on so it really means set a flag? But then on the Boot Loader Options Screen there's something for setting active flag, so I don't know what this means here. There's also something about writing code to the MBR. I may have done that back at 11.2 or whenever, but I originally was trying to install windows 98 without luck with new hardware (or maybe something with the booting process?).
    When it says Boot from Extended Partition, how does that relate to the options screen about setting a flag?

    I don't want to change my main disk MBR or whatever it's called. I may want to or have to if grub2 requires it, (and in the future), but I want to know what would impact that. Changing my target extended partition I don't care about if that's all it changes. Is there a boot record for the partition that maybe I'm not allowing to be written on install?

    What impact does checking or not checking the various options have and when would, why would I check them?

    The help screen says "Write Generic Boot Code to MBR in Boot Loader Options to update the master boot record if that is needed". Do I need it? When do I need it? I'm thinking if I had windows running in a partition I would never write to MBR. I am assuming the MBR is for the whole hard disk and enables booting to whichever partition is flagged for booting.

    I just know enough to know I don't know much. Mainly I want to know which check marks to check and why and when and what it does where.

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,681
    Blog Entries
    3

    Default Re: Understanding grub/boot

    Quote Originally Posted by dt30 View Post
    Mainly I want to know which check marks to check and why and when and what it does where.
    Usually, the installer will select defaults that work in most cases and do not cause other problems.

    The MBR is just the first physical sector of the drive. It contains boot code and the partition table. The boot code is probably from Windows.

    If grub is installed in the MBR, then that replaces the Windows boot code with grub2 boot code. But that won't affect anything else. Windows will still work. You will just see a grub2 boot menu as the first step of booting.

    In a normal situation, the grub boot code has to go in either the MBR or one of the primary partitions. You can configure your install to put it in the root partition. But it the root partition is a logical partition, that won't work. People who have grub installed in a logical partition have to know a bit more about what they are doing and about how to boot from there. If you are unsure, then you probably don't want that.

    I hope that helps a little. Ask more questions if you want more answers. I don't want to say too much and make it sound too complicated.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  3. #3
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Understanding grub/boot

    Quote Originally Posted by dt30 View Post
    I have a vague concept, but I would fail any test over the boot process. I've read a page about the grub2 commands but still am having a hard time understanding exactly how it works, or maybe what choices I need to make on the install.

    To demonstrate my lack of understanding and question, after the first OpenSUSE version I installed, I now have created multiple partitions on my hard drive with a home partition separate. I installed 12.1 on an extended partition. Having read that not all computers support booting to extended partitions, I was prepared for it not working. When I restarted the system, it was just a blinking cursor. So I used a gparted disk to flag the original system, added to its menu to chainload to the extended partition and got the system to work.

    With 12.3, I managed to get a primary partition available and installed it on that. However, booting still did not work. So now I don't know if the extended partition might have booted if I understood what I needed to do.
    Maybe since it is using grub2, it needed to change the main MBR of the whole hard disk?

    Anyway, where I get confused is on the boot loader setting screen. On the 13.1 setup, I see the similar help screens which do not really tell me what I could understand.

    There are several checkmarks, and could it be valid to check multiple ones, or only one?
    When it says, boot from Master Boot Record, does that mean it will change my whole hard drive boot process and if something was working it may no longer work?
    When it says Boot from Root Partition, is that .... Well, I don't know what that could mean... Is root same as boot? For those having a separate boot partition from your main system play a role here? Since there's a checkmark for extended, does root mean like primary? Is root whichever partition your main system (/) is on so it really means set a flag? But then on the Boot Loader Options Screen there's something for setting active flag, so I don't know what this means here. There's also something about writing code to the MBR. I may have done that back at 11.2 or whenever, but I originally was trying to install windows 98 without luck with new hardware (or maybe something with the booting process?).
    When it says Boot from Extended Partition, how does that relate to the options screen about setting a flag?

    I don't want to change my main disk MBR or whatever it's called. I may want to or have to if grub2 requires it, (and in the future), but I want to know what would impact that. Changing my target extended partition I don't care about if that's all it changes. Is there a boot record for the partition that maybe I'm not allowing to be written on install?

    What impact does checking or not checking the various options have and when would, why would I check them?

    The help screen says "Write Generic Boot Code to MBR in Boot Loader Options to update the master boot record if that is needed". Do I need it? When do I need it? I'm thinking if I had windows running in a partition I would never write to MBR. I am assuming the MBR is for the whole hard disk and enables booting to whichever partition is flagged for booting.

    I just know enough to know I don't know much. Mainly I want to know which check marks to check and why and when and what it does where.
    For working with Grub 2, have a look at my bash script: GNU Grub2 Command Listing Helper with --help & Input - Blogs - openSUSE Forums

    For dealing with MBR and GPT formatted hard disks: Creating Partitions During Install for MBR and GPT Hard Disks - Blogs - openSUSE Forums

    You indeed have to start somewhere, perhaps these blogs can help?

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  4. #4
    Join Date
    May 2010
    Location
    Central USA
    Posts
    268

    Default Re: Understanding grub/boot

    Quote Originally Posted by jdmcdaniel3 View Post
    For working with Grub 2, have a look at my bash script: GNU Grub2 Command Listing Helper with --help & Input - Blogs - openSUSE Forums

    For dealing with MBR and GPT formatted hard disks: Creating Partitions During Install for MBR and GPT Hard Disks - Blogs - openSUSE Forums

    You indeed have to start somewhere, perhaps these blogs can help?

    Thank You,
    I had seen your blog on the grub2cmd scripting, but I'm really wanting to understand how the boot loader options work. The creating partitions one was informative. And the part about GPT disks cleared up some things. I had thought GPT disks were special disks, but sounds like GPT is just a partition table format system, but you need a PC with the firmware to read/use it. So any disk can be made as a GPT disk, but only certain PCs can use them. Is that correct?

    What I really want to do is boot from a logical partition as nrickert talked about. But I think I'll settle for later on that and because I don't want to change the MBR at this time. So my third primary partition has 12.3 on it and I'd like to boot from that. So from what I read on your blog, I want to load the grub boot loader into partition 3 and set it active. Can I do that now with my running system? What if I was fresh installing it to that partition? How do I "load it into partition 3" based upon the boot install options? Would that be check "boot from root partition"? Is that what "boot loader location" means, to load the grub at that location? If multiple options are checked, does it load it at all locations? I'm guessing that loading it at the MBR has extra stuff it puts there unlike if you load it at a partition.

    If I had wanted to boot from a logical partition, would I check boot from master boot record AND boot from extended partition, making sure not to check write generic boot code to MBR? That is, when grub replaces the generic code, it adds "smarts" so that it is able to boot to a logical partition whereas the generic boot code does not know how to do that?

  5. #5
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Understanding grub/boot

    Quote Originally Posted by dt30 View Post
    I had seen your blog on the grub2cmd scripting, but I'm really wanting to understand how the boot loader options work. The creating partitions one was informative. And the part about GPT disks cleared up some things. I had thought GPT disks were special disks, but sounds like GPT is just a partition table format system, but you need a PC with the firmware to read/use it. So any disk can be made as a GPT disk, but only certain PCs can use them. Is that correct?

    What I really want to do is boot from a logical partition as nrickert talked about. But I think I'll settle for later on that and because I don't want to change the MBR at this time. So my third primary partition has 12.3 on it and I'd like to boot from that. So from what I read on your blog, I want to load the grub boot loader into partition 3 and set it active. Can I do that now with my running system? What if I was fresh installing it to that partition? How do I "load it into partition 3" based upon the boot install options? Would that be check "boot from root partition"? Is that what "boot loader location" means, to load the grub at that location? If multiple options are checked, does it load it at all locations? I'm guessing that loading it at the MBR has extra stuff it puts there unlike if you load it at a partition.

    If I had wanted to boot from a logical partition, would I check boot from master boot record AND boot from extended partition, making sure not to check write generic boot code to MBR? That is, when grub replaces the generic code, it adds "smarts" so that it is able to boot to a logical partition whereas the generic boot code does not know how to do that?
    So, it is my opinion that unless your boot drive is larger than 2.2 TB, I would stick with an MBR formatted boot disk and flee from GPT hard disks and UEFI boot setups. Next, I have an article on booting from an external hard drive, but what is shown can be any hard drive and the blog shows what you must do:

    https://forums.opensuse.org/blogs/jd...ard-drive-150/

    I am not a big fan of loading the grub bootloader into a Logical Partition because Windows has been known to blow that up. In my blog, I loaded grub into the root / partition, not located on the logical partition. Pay attention to that suggestion.

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  6. #6
    Join Date
    May 2010
    Location
    Central USA
    Posts
    268

    Default Re: Understanding grub/boot

    Quote Originally Posted by jdmcdaniel3 View Post
    https://forums.opensuse.org/blogs/jd...ard-drive-150/

    I am not a big fan of loading the grub bootloader into a Logical Partition because Windows has been known to blow that up. In my blog, I loaded grub into the root / partition, not located on the logical partition. Pay attention to that suggestion.
    Thanks for the link and after reading, I thought I understood it. I'm doing a chainloading from an old bootable partition to the extended partition which was where I had available space. I can't remember which order I tried what, but I checked one, boot from root partition?, and when that gave me a "Invalid or unsupported executable format" I managed to manually enter grub commands of root, kernel, and initrd and 13.1 loaded. I then used 13.1's Yast -> boot loader screen to check both, boot from the root and from the extended partition, but got the same error.

    I had set my menulist from the old system boot partition to include:
    Code:
    title Chainloader 12.1
        rootnoverify (hd0,7)
        chainloader +1
    
    title Chainloader 13.1
        rootnoverify (hd0,6)
        chainloader +1
    The 12.1 worked in the extended partitions. So I don't know why the same doesn't work for 12.3. Which means I don't understand something. I came across something and tried "makeactive" before the chainloader, but still same error.

    I still don't really understand what the checkmarks mean. I really don't want to lose my working boot partition from the old system. It's in the first primary partition. I don't know which check marks mean to write magic unseen boot loader code and which ones mean overwrite the boot menu.

  7. #7
    Join Date
    Sep 2012
    Posts
    7,105

    Default Re: Understanding grub/boot

    Quote Originally Posted by dt30 View Post
    I still don't really understand what the checkmarks mean.
    They actually mean what they say - "install bootloader in this location". Script that performs final step loops over all checked locations and calls utility to install bootloader in each one.

    Unfortunately, it does not work that well in case of grub2. Having more than one location checked will with high probability result in unbootable system, similar to what you observed. So for now I would strongly recommend not to use multiple boot locations in case of grub2.

  8. #8
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,681
    Blog Entries
    3

    Default Re: Understanding grub/boot

    Quote Originally Posted by dt30 View Post
    If I had wanted to boot from a logical partition, would I check boot from master boot record AND boot from extended partition, making sure not to check write generic boot code to MBR? That is, when grub replaces the generic code, it adds "smarts" so that it is able to boot to a logical partition whereas the generic boot code does not know how to do that?
    Some of the discussion has become confusing,

    In order to boot, the BIOS loads a sector into memory and jumps to it (executes it as code).

    In the normal scheme of things, the BIOS loads the MBR into memory and jumps to it. The MBR code then loads the partition boot record (first sector of the partition) for the active partition, and jumps to that.

    When the installer ask about "boot from MBR" or "boot from /" or "boot from external partition", it is asking where to write that boot record (that single sector).

    The general rules: You can put the boot record in the MBR, though Windows may later overwrite that.
    You can put the boot record in any ext2/ext3/ext4 partition, because the first sector is reserved for that purpose.
    You can put the boot record in the external partition (the primary partition that carves out space for logical drives), though at the risk that some other software might overwrite it.

    The standard BIOS code can only boot from a primary partition. If you put the boot record on a logical drive, then you have to make other arrangements to boot.

    As for alternate arrangements:

    Some folk put the boot record on a logical partition, then copy that boot record to a file, and use the Windows boot loader to boot using the boot record in that data file.

    Other folk have more than one linux installed. So they have the BIOS boot one of those, and have a grub2 entry to chainload the boot sector for the other linux, and that chain-loaded boot sector can be on a logical drive.

    What is not completely clear to me, is what you are trying to accomplish. If you were to list your partitions, what's on them, and what you want to be able to boot, we could probably come up with decent suggestions.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  9. #9
    Join Date
    May 2010
    Location
    Central USA
    Posts
    268

    Default Re: Understanding grub/boot

    Quote Originally Posted by arvidjaar View Post
    They actually mean what they say - "install bootloader in this location". Script that performs final step loops over all checked locations and calls utility to install bootloader in each one.

    Unfortunately, it does not work that well in case of grub2. Having more than one location checked will with high probability result in unbootable system, similar to what you observed. So for now I would strongly recommend not to use multiple boot locations in case of grub2.
    I may have overlooked the message for the installation. Once a system is running, the Boot Loader screen just says "Boot Loader Location". Which gave me the idea that I need to tell it where the boot loader is rather than where I want to create it.

    I manually loaded 13.1 and ran the boot loader screen once with just the check mark on the root partition and once with it on the extended partition. When I ran the old grub menu with the chainloader screen, I got the same error, Invalid or unsupported executable format. Could there be something about the old grub not being able to chainload to the grub2 partition?

  10. #10
    Join Date
    May 2010
    Location
    Central USA
    Posts
    268

    Default Re: Understanding grub/boot

    Quote Originally Posted by nrickert View Post
    Some of the discussion has become confusing,
    Which may be because I don't understand it.

    In order to boot, the BIOS loads a sector into memory and jumps to it (executes it as code).In the normal scheme of things, the BIOS loads the MBR into memory and jumps to it. The MBR code then loads the partition boot record (first sector of the partition) for the active partition, and jumps to that.

    When the installer ask about "boot from MBR" or "boot from /" or "boot from external partition", it is asking where to write that boot record (that single sector).
    Which is part of what I hadn't understood. The help screen doesn't seem to fully explain that.

    The general rules: You can put the boot record in the MBR, though Windows may later overwrite that.
    Which I'm still vague on. The MBR enables things to boot, but the boot record is an additional thing or is that what MBR means - that is, just and only just the boot record which Linux writes or windows writes? Which may include things like a partition table but is not in addition to what windows writes, but could be different.

    Other folk have more than one linux installed. So they have the BIOS boot one of those, and have a grub2 entry to chainload the boot sector for the other linux, and that chain-loaded boot sector can be on a logical drive.

    What is not completely clear to me, is what you are trying to accomplish. If you were to list your partitions, what's on them, and what you want to be able to boot, we could probably come up with decent suggestions.
    And this is the choice I'm wanting to make at this time. For some reason, I couldn't get partition 3 to boot 12.3 and had to use chainloader. It may because of not checking the Write to root partition. Once I get 13.1 booting, I will go back and try that.

    What I'm trying to accomplish is to understand it. From the beginning I never understood the checkmarks and just kind of guessed or let it default. Last time, I may have been to scared to overwrite something I didn't check anything, which may be why 12.3 isn't booting, but I don't remember for sure. I thought it is about time to understand it so when I have something different than normal/standard I will be able to fix it and know what I'm doing.

    What I have currently:
    Code:
    sda1 - Ext3 - boot (or actually menu) partition from probably 11.2
    sda2 - swap
    sda3 - Ext4 - 12.3 which I'm using now by chainloading from the sda1 menu.  
    sda4 - Extended
    sda5 - Ext3 - Data - but separate from the "home" partition included with the (/) partition.
    sda6 - Ext4 - 11.3
    sda7 - Ext4 - 13.1
    sda8 - Ext4 - 12.1
    What I want currently is to boot to sda1, like I've been doing, choose from the menu, 13.1, and have it chainload to sda7.
    The menu of sda1 has:
    title Chainloader 13.1
    rootnoverify (hd0,6)
    chainloader +1

Page 1 of 4 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •