Find the answer to your Linux question:
Results 1 to 8 of 8
I have a 20GB hard drive. I installed Ubuntu 8.04 on a 12 GB partition (actually 11 for / and 1 for swap). I installed CentOS on the remaining 8 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    May 2007
    Posts
    106

    [SOLVED] Grub basics


    I have a 20GB hard drive. I installed Ubuntu 8.04 on a 12 GB partition (actually 11 for / and 1 for swap). I installed CentOS on the remaining 8 GB partition (no swap). The CentOS installer gave me the option to specify another OS to add support for in Grub. I selected /dev/hda1 (the ubuntu install) and named it Ubuntu. The system boots Centos fine, but Ubuntu won't boot when selected. I think the /boot/grub/grub.conf needs to be adjusted. Here are the contents:

    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE: You do not have a /boot partition. This means that
    # all kernel and initrd paths are relative to /, eg.
    # root (hd0,2)
    # kernel /boot/vmlinuz-version ro root=/dev/hda3
    # initrd /boot/initrd-version.img
    #boot=/dev/hda
    default=1
    timeout=10
    splashimage=(hd0,2)/boot/grub/splash.xpm.gz
    title CentOS-3 (2.4.21-50.EL)
    root (hd0,2)
    kernel /boot/vmlinuz-2.4.21-50.EL ro root=LABEL=/
    initrd /boot/initrd-2.4.21-50.EL.img
    title Ubuntu
    rootnoverify (hd0,0)
    chainloader +1




    What reference should I input for "title Ubuntu" so Grub can find and boot Ubuntu?

    Also, once Ubuntu is accessible, I assume it will have it's own /boot/grub/grub.conf. Which one takes precedence?

    Any help is appreciated! Thanks!!

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    RedHat based distros doesn't detect other installed Linux distros and one has to add an entry in GRUB Manually.
    Mount root partition of Ubuntu in CentOS and open /boot/grub/menu.lst file. Copy first title block from it and paste in /boot/grub/grub.conf file of CentOS.

    Code:
    su -
    mkdir /media/ubuntu
    mount -t ext3 /dev/sda1 /media/ubuntu
    cd /media/ubuntu/boot/grub
    less menu.lst
    Copy first title block and paste in /boot/grub/grub.conf file of CentOS.

    Also, once Ubuntu is accessible, I assume it will have it's own /boot/grub/grub.conf. Which one takes precedence?
    GRUB will be handled by CentOS's grub.conf file unless you install Ubuntu's GRUB in boot sector of Ubuntu's root partition and add chainloading code in grub.conf file of CentOS.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Newbie
    Join Date
    May 2007
    Posts
    106
    is any kind of "write grub" command required to write the changes to the disk's boot sector?

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    I wont suggest you to install Ubuntu's GRUB in Boot Sector now. Just copy/paste first title block. You will have an option to boot up Ubuntu in GRUB Menu and Ubuntu will boot up fine.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  5. #5
    Linux Newbie
    Join Date
    May 2007
    Posts
    106
    this worked perfectly, thanks!

    can you recommend a decent overview of how grub actually works? i'm a bit confused about it now.

    I thought each physical hard drive had one boot sector (also called MBR) and this is where grub is installed. A conf file would exists in the file system which would write changes to that boot sector (i now know in Lilo you had to write changes, but grub searches for the conf file to detect changes on boot automagically).

    It sounds like your saying there is an installation of grub (or there can be) in every boot partition on a physical disk, so for example, if i have one 20GB disk with a pair of 10GB partitions I would have one MBR and two boot sectors (one for each partition).

    I need to figure out how it actually works. If you can point me to a good resource so I can RTFM i would appreciate it.

    thanks a bunch

  6. #6
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    something like this?
    grub
    Linux and me it's a love story

  7. #7
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    It sounds like your saying there is an installation of grub (or there can be) in every boot partition on a physical disk, so for example, if i have one 20GB disk with a pair of 10GB partitions I would have one MBR and two boot sectors (one for each partition).
    Thats correct. Each partition has its own Boot Sector. You can install GRUB in MBR as well as in boot sector. GRUB can chainload other Boot Loaders easily.
    Let say, I have Windows XP + 2 Linux distros ( A and B ) installed in my HD and I am using GRUB of A for dual booting.

    * A : GRUB of A in MBR of HD
    * Windows XP : Windows Boot Loader in boot sector of Windows OS Partition ( thats default and GRUB chainloads Windows Boot Loader )
    * B : I can boot up B distro in three ways :
    1. Install GRUB in Boot Sector of B's root partition and chainload it like Windows OS. ( Its recommended )
    2. Do not install GRUB and add title block ( title, kernel, initrd lines ) in A's grub.conf ( or menu.lst ) file as I suggested you earlier.
    3. Install GRUB of B in MBR ( Its default in all distros ). Installer will overwrite A's GRUB, detect A and Windows XP and setup multiboot itself. But there are a few drawbacks in this method. Installer of RedHat based distros do not detect other Linux distros and one has to add entries manually.


    I hope it helps. Feel free to ask if you have any confusion.
    Last edited by devils casper; 06-26-2008 at 04:25 PM. Reason: typo
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  8. #8
    Linux Newbie
    Join Date
    May 2007
    Posts
    106
    khafa - thanks, that looks like it

    casper - thanks a bunch...this is a good start. Thanks for your help getting the grub thing working before also!

Posting Permissions

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