Announcement

Collapse
No announcement yet.

How is menu.lst (for GRUB) created?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How is menu.lst (for GRUB) created?

    I installed Kubuntu on a computer with 4 disk drives that is running several OSs. This involved placing the system (root directory) on a logical partition on a drive that the BIOS does NOT boot from. I have a boot manager and don't want Ubuntu installing anything (e.g., GRUB) anywhere (e.g., MBR) but the target partition (i.e., in this case /dev/sdd6). By using the manual/advanced options during installation I think I prepared the installer to do what I wanted. The installation ran (almost to successful completion) but reported a fatal error pertaining to grub-install.

    The result was that the only thing in the /boot/grub subdirectory was the file named "device.map". By reading the GRUB User Guide I figured out how to run "grub-install" manually and this seemed to run successfully. As best I can tell it just copies the various files that provide the different stages of GRUB for a variety of file systems into the target directory. Possibly it also wrote the stage1 onto the boot sector of the target partition but I haven't confirmed that because I haven't yet tried to boot. The reason for not trying to boot is that the file that is conspicuously absent is the one named "menu.lst". While I think I could code (hack) a specially prepared file that might allow me to boot, I think that Debian has a way of preparing one which utilizes a variety of features which are common to Ubuntu/Debian systems and I would like to end up with a properly prepared file. The Debian Automagic Kernels List is something that comes to mind. Also, I believe that some system updates may depend on this file.

    Is it possible to prepare a proper instance of this file after installation is complete? If so how is it done?

    #2
    Re: How is menu.lst (for GRUB) created?

    Boy, very well thought out and very good question.
    I've not done it (but just hacked ad hoc boot menus as you mention).

    >> This comes to mind:
    sudo update-grub

    I read that it should do it but never tried it myself.


    >> Or, I wonder if Super Grub Disk Live CD has a "create menu,lst" capability?
    Super Grub Disk: http://www.supergrubdisk.org/


    >> Or, you can make a text file using one of ours, and you may still have to steal a boot stanza somewhere for a specific OS you have. Like this one from a Kubuntu 8.04 installation /boot/grub/menu.lst:

    # menu.lst - See: grub(8), info grub, update-grub(8)
    # grub-install(8), grub-floppy(8),
    # grub-md5-crypt, /usr/share/doc/grub
    # and /usr/share/doc/grub-doc/.

    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    #
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    # WARNING: If you are using dmraid do not use 'savedefault' or your
    # array will desync and will not let you boot your system.
    default 0

    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout 3

    ## hiddenmenu
    # Hides the menu by default (press ESC to see the menu)
    #hiddenmenu

    # Pretty colours
    #color cyan/blue white/blue

    ## password ['--md5'] passwd
    # If used in the first section of a menu file, disable all interactive editing
    # control (menu entry editor and command-line) and entries protected by the
    # command 'lock'
    # e.g. password topsecret
    # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
    # password topsecret

    #
    # examples
    #
    # title Windows 95/98/NT/2000
    # root (hd0,0)
    # makeactive
    # chainloader +1
    #
    # title Linux
    # root (hd0,1)
    # kernel /vmlinuz root=/dev/hda2 ro
    #

    #
    # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

    ### BEGIN AUTOMAGIC KERNELS LIST
    ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
    ## by the debian update-grub script except for the default options below

    ## DO NOT UNCOMMENT THEM, Just edit them to your needs

    ## ## Start Default Options ##
    ## default kernel options
    ## default kernel options for automagic boot options
    ## If you want special options for specific kernels use kopt_x_y_z
    ## where x.y.z is kernel version. Minor versions can be omitted.
    ## e.g. kopt=root=/dev/hda1 ro
    ## kopt_2_6_8=root=/dev/hdc1 ro
    ## kopt_2_6_8_2_686=root=/dev/hdc2 ro
    # kopt=root=UUID=4f8ed8da-e015-4149-954c-a353db1b284b ro

    ## Setup crashdump menu entries
    ## e.g. crashdump=1
    # crashdump=0

    ## default grub root device
    ## e.g. groot=(hd0,0)
    # groot=(hd1,1)

    ## should update-grub create alternative automagic boot options
    ## e.g. alternative=true
    ## alternative=false
    # alternative=true

    ## should update-grub lock alternative automagic boot options
    ## e.g. lockalternative=true
    ## lockalternative=false
    # lockalternative=false

    ## additional options to use with the default boot option, but not with the
    ## alternatives
    ## e.g. defoptions=vga=791 resume=/dev/hda5
    # defoptions=quiet splash

    ## should update-grub lock old automagic boot options
    ## e.g. lockold=false
    ## lockold=true
    # lockold=false

    ## Xen hypervisor options to use with the default Xen boot option
    # xenhopt=

    ## Xen Linux kernel options to use with the default Xen boot option
    # xenkopt=console=tty0

    ## altoption boot targets option
    ## multiple altoptions lines are allowed
    ## e.g. altoptions=(extra menu suffix) extra boot options
    ## altoptions=(recovery) single
    # altoptions=(recovery mode) single

    ## controls how many kernels should be put into the menu.lst
    ## only counts the first occurence of a kernel, not the
    ## alternative kernel options
    ## e.g. howmany=all
    ## howmany=7
    # howmany=all

    ## should update-grub create memtest86 boot option
    ## e.g. memtest86=true
    ## memtest86=false
    # memtest86=true

    ## should update-grub adjust the value of the default booted system
    ## can be true or false
    # updatedefaultentry=false

    ## should update-grub add savedefault to the default options
    ## can be true or false
    # savedefault=false

    ## ## End Default Options ##

    title Ubuntu 8.04.1, kernel 2.6.24-22-generic
    root (hd1,1)
    kernel /boot/vmlinuz-2.6.24-22-generic root=UUID=4f8ed8da-e015-4149-954c-a353db1b284b ro quiet splash
    initrd /boot/initrd.img-2.6.24-22-generic
    quiet

    title Ubuntu 8.04.1, kernel 2.6.24-22-generic (recovery mode)
    root (hd1,1)
    kernel /boot/vmlinuz-2.6.24-22-generic root=UUID=4f8ed8da-e015-4149-954c-a353db1b284b ro single
    initrd /boot/initrd.img-2.6.24-22-generic

    title Ubuntu 8.04.1, memtest86+
    root (hd1,1)
    kernel /boot/memtest86+.bin
    quiet

    ### END DEBIAN AUTOMAGIC KERNELS LIST

    # This is a divider, added to separate the menu items below from the Debian
    # ones.
    title Other operating systems:
    root


    # This entry automatically added by the Debian installer for a non-linux OS
    # on /dev/sda1
    title Microsoft Windows XP Home Edition
    root (hd0,0)
    savedefault
    chainloader +1


    Note:
    If you have a Linux OS in (hdx,y), and if it has a menu.lst there, then from your main GRUB booting partition menu.lst, you can boot that OS using the following boot stanza:

    title OS in (hdx,y)
    configfile (hdx,y)/boot/grub/menu.lst

    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    Comment


      #3
      Re: How is menu.lst (for GRUB) created?

      Many thanks to Qqmike. Here is how it came out.

      I have and treasure the Super Grub Disk which has proved to be invaluable. However, I believe that it is independent of Debian and therefore, even if capable of building a menu.lst file, wouldn't build the Debian specific kind which is used by Ubuntu. However, I tried booting my system which lacked any menu.lst file using it with the intention of manually entering the necessary commands. However, a sequence of -

      - root (hd1,5)
      - kernel ---file name--- /dev/sdd6 ---various kernel options from working menu.lst files
      - boot

      seemed to find the kernel and start booting but failed before completion with some indication of a file system problem. I also did the same thing using my boot manager and the boot loader that was, after all, installed on the target partition. However, this produced the same result as Super Grub described above.

      At this point I just plain got lucky. Having an older version of Ubuntu running on this same computer I was able to update (edit) it's menu.lst file to include an entry for the new system/partition. Then by booting this former system/partition I was able to select a menu item for the new system which did boot successfully.

      While update-grub does seem to be the prescribed method for building a new menu.lst (even when none previously exists) I couldn't find a way for this to be done on a system (root file system) other than the one the system is running from. Therefore, this is not helpful when, as in my case, you cannot get the system to boot at all. However, it did work nicely once I luckily found a way to get the system to boot.

      The mystery that remains is why the system wouldn't boot using the manually entered commands. The one difference is that I specified the root= kernel option using the /dev/sdd6 method rather than than using the form UUID=....

      Comment


        #4
        Re: How is menu.lst (for GRUB) created?

        Ha! Good work, ajax!

        And, as you noted, lucky, but you were clever, too

        As for manually booting, I would think that root==/dev/sdx should work as well as UUIDs.
        One thing is the typing -- you have to type things perfectly.
        That's where TAB completion comes in handy:

        kernel /boot/vmlinuz-2.6.24-22-generic root=UUID=4f8ed8da-e015-4149-954c-a353db1b284b ro quiet splash

        start typing and see when TAB completion works to complete things for you:
        kernel /boot/vmlinuz-<press the TAB ke nowy>
        etc. etc.

        You might experiment and try again to manually boot, just to see how to get it.

        Thanks for the feedback. Glad you figured this out.
        An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

        Comment

        Working...
        X