Which menu.lst is the Grub in MBR configured to use?


Results 1 to 10 of 10

Thread: Which menu.lst is the Grub in MBR configured to use?

  1. #1
    Join Date
    Jun 2009
    Posts
    9

    Which menu.lst is the Grub in MBR configured to use?

    Can one use Grub commands from a Grub CD or Floppy to determine from which partition Grub in the MBR is trying to read the menu.lst?

    Systems can have many menu.lst files, perhaps one for each distro in different partitions. If the system fails to boot and the admin uses a Grub CD to troubleshoot, can he determine which partition Grub in the MBR thinks should be the root partition.

    Thanks,

    Homerun

  2. #2
    Join Date
    Jun 2002
    Location
    Michigan
    Posts
    875
    Welcome to JL

    I think you will find the answers you need by reading this HERE

  3. #3
    Join Date
    Jul 2002
    Location
    Vladivostok, Russia
    Posts
    9,053
    Above is good documentation referenced by mrrangerman43

    If you want, make a SuperGrub floppy/cd/usb and use this for any emergencies
    Go here and read the documentation to suit your particular situation.
    http://www.supergrubdisk.org/
    "I was pulled over for speeding today. The officer said, "Don't you know
    the speed limit is 55 miles an hour?" And I said, "Yes, but I wasn't going
    to be out that long."

    How To Ask Questions The Smart Way
    COME VISIT ME IN RUSSIA NOW!!

  4. #4
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    The answer is quite simple.

    If Grub is working and a distro has been booted up by whichever Grub controlling the MBR then just examining the menu.lst of the booted up Linux will enable us to know which distro is in the MBR.

    Just looking at the MBR section to determine where the Grub comes from may be possible but the link is an hard disk address which makes little sense to an average user. I am not aware that Grub has the facility to tell us its link.

    I always allow the installer to install its boot loader. Therefore if there is 100 Linux and everyone uses Grub then I will have a 100 choice of Grub to put into the MBR. In theory Any Grub can therefore do the job of booting all the rest. In practice it is safer to choose a newer version.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  5. #5
    Join Date
    Jun 2009
    Posts
    9
    Thank you for the responses. I had read many of Saikee's posts and other documentation before joining Justlinux and posting. Nothing I read appeared to indicate whether the information in the MBR could be obtained via a Grub disk, thus I had concluded it may not be obtainable with Grub commands. I just couldn't readily accept Grub wasn't provided with a command to read itself in the MBR. Thankyou for the confirmation.

    Homerun

  6. #6
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    homerun,

    A boot loader is a very simple program designed with only one task in life and that is to load the OS and bugger off never to appear again.

    Grub is one of the biggest around. Before a system is boot it can work like a mini operating system and so users think it is an all singing and dancing software. Since Grub is available as a Grub shell forming part of the BASH command set it is one of the most flexible and powerful boot loader around. Despite many misgivings Grub is still the easiest and the simplest. Don't take my word for it have a go at the bootmgr of Vista or Win7 and you will appreciate.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  7. #7
    Join Date
    Jun 2009
    Posts
    9

    Grub and multiboot experiences since my last post

    I now have a much stonger understanding of Grub, thanks mostly to this forum. I have encountered several interesting issues ( to me anyway) that I'd like to share.

    1. Currently my Dell Latitude D600 multiboots Fedora 11, Suse 11.2, Suse 11.1, Suse 10.3, Debian 5.0.2, Ubuntu 9.04, Mandriva 2009.1. A copy of cfdisk is at the end of this post. Gentoo Autobuild 20090623 and Gentoo LIve CD 2008.0r1 failed to install, so will try again soon. This failure leads me to ask one specific question in this post. If an existing ext3 formatted unused partition is to be utilized by a new installation of linux, would "not" reformatting it during installation cause problems. I may have chosen not to let Gentoo reformat during installation, and I will try to install Gentoo again. However, Gentoo Autoubuild does have a problem with the Dell D600 during hardware detection, which I confirmed with web searches.

    2. When using openSUSE 10.3, openSUSE 11.1 and Fedora 11, the Grub command line completion feature does not work. I forgot to test or make note of this on all my installations, so there may be more. openSUSE 11.2's does work along with Fedora 11. I believe Ubuntu and Debian worked.

    3. Fedora 11's partition tool was most problematic, which motivated me to finally start using gparted live DVD and Parted Magic to create numerous unused partions, as well as create one menu.list with a bunch of chainloader stanzas. I would swear the Fedora 11 partitioning tool actually removed all the remaining free space from the extended partition (created by a previous distro, not gparted) preventing me from accessing the remainder of the free space. However, It is possible that on three different occassions, that I somehow created the extended partition during a disto installatio to be a limited size such that I could installed other distro's and suddenly not have anymore free space after messing with the anaconda software while attempting install Fedora. I used gparted to resize and get back the free space, but decided not to trust the results and started over after some boot failures.

    4. Each distro installation seems unpredictable about how it handled existing partitions created by gparted. One distro. which itself selected existing used partitions for its own root and home partitions, did allow me to unselect them and move the root where I wanted it. However, it removed the partition labels created by gparted. The "summary" indicated that the labels would be removed, but I could not figure out how to prevent the label removal.

    5. With each distro installation, I tweaked the boot/grub configuration before proceeding. I always set it to use the root partitions and once selected "allow boot from extended partition" or something to that effect. I am still not sure what the extended option provided. In some cases the MBR was overwitten, and I had used Grub's root (hd0,1) setup root (hdo) to get the intended boot/grub/menu.lst back. I finally just started using command line of the new grub menu of each initially installed disto to reinstall the MBRm if the menu was not the menu I wanted.

    6. I got the "Error 18.. Selected cylinder exceeds maximum supported by BIOS" which I had read about but didn't expect. This was my last multiboot installation to date and it was Suse 10.3. I believe this was the installation where there were check boxes for the boot options. I deselected the MBR, selected root partition and "boot extended partition" or something to that effect. The IDE hard drive is 140G. This is the results from cfdisk:

    Name Flags Part Type FS Type [Label] Size (MB)
    -----------------------------------------------------------------------------------------------
    sda1 Primary Linux ext3 [SoftwareWithBoot] 21492.66
    sda2 Primary Linux ext3 10799.80
    sda3 Primary Linux ext3 [suse11.2] 10799.80
    sda5 Logical Linux swap / Solaris 2097.45
    sda6 Logical Linux ext3 [home_data] 10799.80
    sda7 Logical Linux ext3 [boot] 1151.54
    sda8 Logical Linux ext3 [Debian502] 10799.80
    sda9 Logical Linux ext3 [Ubuntu] 10799.80
    sda10 NC Logical Linux ext3 [Fedora11KDE] 10695.48 *
    Logical Free Space 5.62 *
    sda11 Logical Linux ext3 [Gentoo2008] 10692.87
    sda12 Logical Linux ext3 [GentooAutoBuild] 10799.80
    sda13 Logical Linux ext3 [Mandriva20091] 10799.80
    sda14 Logical Linux ext3 [suse11.1] 10799.80
    sda15 Logical Linux ext3 [suse10.3] 10799.80
    Logical Free Space 16705.55

    I cannot boot sda15 with Suse 10.3 sda2 would be labeled Fedora 11, but I was in Fedora 11 and couldn't relabel it after it was removed earlier by an installation.

    Thanks again.

  8. #8
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Gentoo is not known to be put together as good as the other main stream disros. I wouldn't lose sleep if its installer fails to complete an installation.

    If the command line does not work in Grub it is because there is a graphic interface specified in the menu.lst. Disable the graphic interface and Grub will work normally again. The program used by Suse is gfxmenu. Put a "#" in front of that line will disable it. I don't think the recent Fedora uses the same thing but it might have a graphic splash screen controlled by the command "splashscreen". With this if you hit the "esc" key first you will have an option to select the text mode where Grub command line will work.

    Your knowledge in the hard disk partition appears to be weak if you do not understand the working of the extended partition. If you put the extended partition at the 4 primary partition position, assuming the first 3 all used up then the rest of the hard disk is all yours. You should also try to use cfdisk program to create the logical partitions as fdisk and sfdisk tend to freeze the extended partition border. If you do not understand the extended partition then you could create "dead" space in your hard disk and have to use Gparted to cure it. However it is much more rewarding to understand the principle behind and the program cfdisk can teach you on this one.

    I recommend one partition per disro. Playing around with a common /home or any common partition isn't worth the bother, if you are multi-boot several distros and want to keep things simple. Use a common data partition with which you can mount in every distro.

    When you delete and create partitions you will upset the partition names. Thus you must keep a record and update the controlling menu.lst after each change. I recommend overwritting one distro with another. That way you keep the rest of the partitions untouched.

    You can put any Grub in any partition to control the MBR. If the Grub is sourced in the 3rd partition of the 1st disk just used Grub commands
    Code:
    root  (hd0,2)
    setup (hd0)
    The best way to do multi boot is to make every distro "chainloadable". For example if you want (hd0,5) chainloadable you can issue these commands
    Code:
    root  (hd0,5)
    setup (hd0,5)
    Thereafter it will boot by Grub commands
    Code:
    title Distro in (hd0,5) or sda6
    root  (hd0,5)
    chainloader +1
    If you got Error 18 you can overcome it by using the newest Grub, say from an Ubuntu CD. Different distros may use the same version of Grub but they modified it too. The Error 18 is commonly caused by one Grub (older) trying to fire up another Grub (newer).

    Fedora (uses by-label method), Suse (uses by-id or by-path) and Ubuntu (uses by-uuid) have different ways to call a partition in Grub. You need to show their menu.lst if you want to clear the mess. You can alter the partition reference back to the standard /dev/sdax type but this remains in force as long as you do not change the boot disk order.

    Hope the above helps.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  9. #9
    Join Date
    Jun 2009
    Posts
    9
    saikee,

    Thanks for your detailed comments in response to my post on experiences using Grub and multi-booting. It was very helpful but two issues remain: grub command line completion problem and Error 18. Perhaps the BIOS of my Dell D600 is the issue, though my searches come up empty. I am using a 140G IDE for Linux testing. The original was 80G which I swap to for windows operation systems.

    I am not sure if you requested a copy of my menu.lst. Both the one from sda1 and from sda15 are provided at the end of my post.

    The issue of grub command line completion is really not important to me because of other ways to use grub. However, I still cannot get the command line completion working in openSUSE 10.3 or 11.1 nor Fedora 11, even after commenting out the graphic interface from all the menu.lst files on all the partitions. I am referring to using Grub from a terminal window after either "su" or "su -". Grub's command line completion works fine if I go to the command line from the Grub Boot menu during boot up. This is just a curiosity to me. For the brief period of time after reading it may be the graphic interface, I was very gratified, until it didn't work for me. :-) Same can be said for the proposed solution to Error 18 which I haven't solved.

    I am currently trying to sort out the Grub version issue to avoid the Error 18 problem with no success. All the grubs report 0.97 from the grub --version command. Package application programs report all kinds of versions such as 0.97-82 on Suse 10.3. SUSE 11.1 reports 0.97-156.3 which updated to 0.97-160.3. I used the grub command setup (hda0) using different root (hd0,?) to make sure I was using a grub version higher than 0.97.82 in order to boot Suse 10.3, but still get the Error 18. This weekend I am going to reinstall Suse 10.3 in sda 15 as well as install one or two distros in sda16 and sda17 from the remaining free space of 14G to see if they will boot without the Error 18.

    Version 0.97-82 for SUSE 10.3 may be the issue. I determined this version by installing SUSE 10.3 into the failed Gentoo partition which is on the lower number partition sda12. I still can't boot SUSE 10.3 in sda15. After running updates on suse 10,3, it was still 0.97-82. I can boot suse 11.1 from sda14 by the way.

    If 0.97-82 is the problem, I know not how to update Grub in a distro I cannot boot. I have yet to try to copy a higher version grub from an running distro to another distro's file system, such as (cp /sbin/grub /sda/mnt/sda15/sbin/grub.)
    Actually, I have found that grub can be in one of two locations, depending on the distro such as /usr/sbin.

    I didn't explain my extended partition misunderstanding very well. It had to do with selecting the boot loader location when installating Suse 10.3. There were 5 check box selections of which any number can be check. They are listed below:
    *Boot from Boot Partition
    *Boot from Extended Partion
    *Boot from Master Boot Record
    *Boot from root partition
    *Custom Boot Partion (/dev/sda1 .../dev/sda15)

    Usually I select "Boot from root partition" and then later run the grub setup to use my custom menu.lst with all the chainloader stanzas. I suppose I could select both "Boot from Extended Partion and Custom Boot Partion /dev/sda? of the partition in which I am installing the distro. Sometimes I just selected Boot from Master Boot Record. It is this quandery that cause me to write "I am still not sure what the extended option provided" and you wrote "Your knowledge in the hard disk partition appears to be weak if you do not understand the working of the extended partition." <grin>

    I am ignorant about the "*" being located on the extended partition, so that quote of yours may be still relevant. See the results of fdisk -l with the "*" on /dev/sda4. I do not know how important this is, and if it is necessary in order to boot any of the distros in the logical partitions. I assume it denotes the active partition which would be relevant to windows, except it should be on primary partitions sda1, sda2 or sda3

    Device Boot Start End Blocks Id System
    /dev/sda1 1 2613 20988891 83 Linux
    /dev/sda2 2614 3926 10546672+ 83 Linux
    /dev/sda3 3927 5239 10546672+ 83 Linux
    /dev/sda4 * 5240 17426 97892077+ 5 Extended
    /dev/sda5 5240 5494 2048256 82 Linux swap / Solaris
    /dev/sda6 5495 6807 10546641 83 Linux
    /dev/sda7 6808 6947 1124518+ 83 Linux
    /dev/sda8 6948 8260 10546641 83 Linux
    /dev/sda9 8261 9573 10546641 83 Linux
    /dev/sda10 9574 10874 10444799+ 83 Linux
    /dev/sda11 10875 12174 10442218+ 83 Linux
    /dev/sda12 12175 13487 10546641 83 Linux
    /dev/sda13 13488 14800 10546641 83 Linux
    /dev/sda14 14801 16113 10546641 83 Linux
    /dev/sda15 16114 17426 10546641 83 Linux


    Thanks for commenting about the "home" partition as I had wondered about that often.

    I am not sure if you request my menu.lst. Here is the main one on sda1 and the one on sda15.

    # menu.lst is on /dev/sda1 which does not contain a distro.
    # /boot directory copied from Suse 11.2
    #Used root (hd0,0) then setup (hd0)
    #boot=/dev/sda1

    default=9
    timeout=120
    # splashimage=(hd0,1)/boot/grub/splash.xpm.gz
    # hiddenmenu

    title Fedora 11/Gnome (chainloader) on (hd0,1)/sda2
    rootnoverify (hd0,1)
    chainloader +1

    title Fedora 11/KDE (chainloader) on (hd0,9)/sda10
    rootnoverify (hd0,9)
    chainloader +1

    title Suse 11.2 (chainloader) on (hd0,2)/sda3
    rootnoverify (hd0,2)
    chainloader +1

    title Debian 5.0.2 GNOME (chainloader) on (hd0,7)/sda8
    rootnoverify (hd0,7)
    chainloader +1

    title Ubuntu (chainloader) on (hd0,8)/sda9
    rootnoverify (hd0,8)
    chainloader +1

    title Fedora 11/KDE (chainloader) on (hd0,9)/sda10
    rootnoverify (hd0,9)
    chainloader +1

    title Gentoo failed to install (chainloader) on (hd0,10)/sda11
    rootnoverify (hd0,10)
    chainloader +1

    title Suse 10.3 KDE (chainloader) on (hd0,11)/sda12
    rootnoverify (hd0,11)
    chainloader +1

    title Mandriva20091 (chainloader) on (hd0,12)/sda13
    rootnoverify (hd0,12)
    chainloader +1

    title openSUSE 11.1 (chainloader) on (hd0,13)/sda14
    rootnoverify (hd0,13)
    chainloader +1

    #This produces Error 18
    title openSUSE 10.3 GNOME (chainloader) on (hd0,14)/sda15
    rootnoverify (hd0,14)
    chainloader +1

    #This also produces Error 18
    title openSUSE 10.3
    root (hd0,14)
    kernel /boot/vmlinuz-2.6.22.5-31-default root=/dev/disk/by-id/scsi-SATA_WDC_WD1600BEVE-_WD-WXE408E14867-part15 vga=0x314 resume=/dev/sda5 splash=silent showopts
    initrd /boot/initrd-2.6.22.5-31-default

    title Failsafe -- openSUSE 10.3
    root (hd0,14)
    kernel /boot/vmlinuz-2.6.22.5-31-default root=/dev/disk/by-id/scsi-SATA_WDC_WD1600BEVE-_WD-WXE408E14867-part15 vga=normal showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off 3
    initrd /boot/initrd-2.6.22.5-31-default

    #title Works Fedora 11/KDE (2.6.29.4-167.fc11.i586)installed 8-13-09 on /dev/sda10
    # root (hd0,9)
    # kernel /boot/vmlinuz-2.6.29.4-167.fc11.i586 ro root=UUID=c6304659-dc91-4660-aebe-26cffb3060b2 rhgb quiet
    # initrd /boot/initrd-2.6.29.4-167.fc11.i586.img

    #title Works (Testing root=/dev/sda10) Fedora 11/KDE (2.6.29.4-167.fc11.i586) installed 8-13-09 on /dev/sda10
    # root (hd0,9)
    # kernel /boot/vmlinuz-2.6.29.4-167.fc11.i586 ro root=/dev/sda10 rhgb quiet
    # initrd /boot/initrd-2.6.29.4-167.fc11.i586.img



    Menu list on sda15 for Suse 10.3 with Error 18:



    # Modified by YaST2. Last modification on Sun Aug 16 03:09:14 UTC 2009
    default 0
    timeout 15
    # gfxmenu (hd0,14)/boot/message

    ###Don't change this comment - YaST2 identifier: Original name: linux###
    title openSUSE 10.3
    root (hd0,14)
    kernel /boot/vmlinuz-2.6.22.5-31-default root=/dev/disk/by-id/scsi-SATA_WDC_WD1600BEVE-_WD-WXE408E14867-part15 vga=0x314 resume=/dev/sda5 splash=silent showopts
    initrd /boot/initrd-2.6.22.5-31-default

    ###Don't change this comment - YaST2 identifier: Original name: failsafe###
    title Failsafe -- openSUSE 10.3
    root (hd0,14)
    kernel /boot/vmlinuz-2.6.22.5-31-default root=/dev/disk/by-id/scsi-SATA_WDC_WD1600BEVE-_WD-WXE408E14867-part15 vga=normal showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off 3
    initrd /boot/initrd-2.6.22.5-31-default

    Thanks in advance if anyone reads all of this and comments.

  10. #10
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    I am referring to using Grub from a terminal window after either "su" or "su -". Grub's command line completion works fine if I go to the command line from the Grub Boot menu during boot up.
    This mean you never had the problem at all!

    After a Linux has been booted all the Bash Grub commands that help to boot operating systems should not work. If you think about it you will understand why. Grub's commands should only be used "before" a Linux is booted. Some functionalities are available in Bash but don't push your luck on them.

    My interpretations of

    (1) *Boot from Boot Partition
    (2) *Boot from Extended Partion
    (3) *Boot from Master Boot Record
    (4) *Boot from root partition
    (5) *Custom Boot Partion (/dev/sda1 .../dev/sda15) are

    (1) is for the case if you have a /boot partition. This will be the case if you put your Linux inside a LVM because no boot loader in existence can read a LVM. Hence a separate /boot partition is used for this purpose.

    (2) Don't think this one work as the information liable to be overwritten. I tried it before. An extended partition has no storage of its own. It is just a border defining a set of consecutive logical partitions.

    (3) This is for the MBR or the first sector of 512 bytes of the boot disk.

    (4) This is for the partition holding the Linux of the partition holding "/". In this case /boot is a subdirectory of it because Grub is always inside /boot/grub subdirectory.

    (5) This is for "source" Grub from another partition from a Linux, a data-only partition or a Fat partition.

    If you put a Linux in each partition use Choice (4).

    The "*" in the fdisk -l output denotes that partition has been marked "bootable". This is equivalent to MS Windows' definition of a primary partition "active". Every MS Windows must be booted, in the first instance, from an "active" partition. This is how MS boot loaders work. They are blind and search the 4 primaries and boot the one that has been marked active.

    Linux never used the damn thing. One can Linux to mark a priamry or logical partition (or more than one) active or bootable but no Linux boot loader actual use this feature. The superiority of a Linux boot loader is the partition is always declared. In Grub this is done by the command line "root". Thus a Linux can boot a partition regardless it is marked bootable or not. What Grub does is to take note of the partition stated in the "root" statement, go to the partition table to find out the hard disk address of that partition, load its boot sector into memory and bugger off. It takes a mightly corporation like M$ to make this process 100 times more complicated than what it really needs.

    When you restore Grub to overcome Error 18 you must load the latest version of Grub first. Going into an old Linux wouldn't help. My suggestion is to try to boot from a recent Linux Live CD.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

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