Results 1 to 3 of 3

Thread: Howto Modify Grub and Menu List

Threaded View

  1. #1
    Join Date
    Apr 2006

    Howto Modify Grub and Menu List

    If you are adding partitions and installing other Linux distros, you will have had problems with either GRUB or the menu.lst.

    This guide shows you how to add distros to the menu.lst so that they are bootable from GRUB at startup.

    ================================================== =====================
    This is an example of how to use the GRUB edit function.

    Highlight the menu entry you want to edit, then press 'e', then
    highlight the line you want to edit and press 'e'. Add what
    you want to the line 'hdd=scsi' etc. and press enter, then
    'b' to boot.

    Examples of the difference between Linux and GRUB device names.

    1st Physical Hard Disc
    /dev/hda1 ----(hd0,0)----- /dev/sda1-------(hd0,0)
    /dev/hda2 ----(hd0,1)----- /dev/sda2-------(hd0,1)
    /dev/hda3 ----(hd0,2)----- /dev/sda1-------(hd0,2)
    /dev/hda4 ----(hd0,3)------/dev/sda2-------(hd0,3)

    2nd Physical Hard Disc
    /dev/hdb1---- (hd1,0)----- /dev/sdb1------ (hd1,0)
    /dev/hdb2---- (hd1,1)----- /dev/sdb2------ (hd1,1)
    /dev/hdb3---- (hd1,2)----- /dev/sdb1------ (hd1,2)
    /dev/hdb4---- (hd1,3)----- /dev/sdb2-------(hd1,3)

    These are some examples of how to use GRUB from the command prompt.

    Press the 'c' key for the command prompt.

    If you want to boot a Linux system on a partition, using it's kernel
    /boot/vmlinuz etc., do this.

    grub> root (hd0,1)
    grub> kernel /boot/vmlinuz root=/dev/hda2 ro
    grub> boot

    (you can also copy and paste the above (minus the "grub>" to the menu.lst)

    You could do this to find what partition the kernel is on.
    For example, show me what partitions have a /boot/vmlinuz.

    grub> find /boot/vmlinuz

    If you want to boot a Dos/Win partition, do this.

    For example, boot partition on /dev/hda1.

    grub> rootnoverify (hd0,0)
    grub> makeactive
    grub> chainloader +1
    grub> boot

    If you want to boot a FreeBSD partition using /boot/loader.

    For example, boot freebsd partition on /dev/hda4.

    grub> root (hd0,3,a)
    grub> kernel /boot/loader
    grub> boot

    If that doesn't work, try this instead.

    grub> rootnoverify (hd0,3,a)
    grub> chainloader +1
    grub> boot
    ================================================== ============

    Press the [Esc] key to return to the GRUB menu.
    I regularly test and install new distros and knowing how GRUB works makes life a whole lot easier.

    Whe you install Linux, the Grub install at the end should detect all other operating systems on your PC, but sometimes it doesn't, no problem just add it manually.
    If you only want to add an already installed distro so that it boots at startup, (maybe you already have Linux installed and now you are installing a second Linux).

    Do this in the terminal :-
    sudo nano /boot/grub/menu.lst
    This will show you a list of all the OS's that can be booted from GRUB.

    You now only have to copy the same format, below, after the last OS.

    For example, on your harddrive, you have just installed another linux distro on partition 3. You would add this to the menu.lst

    title Debian Sid
    root (hd0,2)
    kernel /boot/vmlinuz-2.6.20-4-486 root=/dev/hdc3 ro
    initrd /boot/initrd.img-2.6.20-4-486
    Remember that you NEED to know the kernel and initrd.image numbers, above is 2.6.20-4-486, otherwise it won't boot. Some linux distros only put "vmlinuz" and "initrd.img".

    To find this out, you need to take a peek in the boot folder of the new partition. Like this:-
    cd /dev/hdc3/boot
    Then to see it's contents, type:-
    You can now copy those numbers onto the menu.lst.

    To save the file press Ctrl + X then typ "Y" for yes and hit "Enter".

    You should now see the other operating system on the list when you reboot the computer.
    Last edited by richbarna; March 30th, 2007 at 03:37 PM.


Posting Permissions

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