Find the answer to your Linux question:
Results 1 to 9 of 9
Hello All, I have installed first Ubuntu (/dev/sda1- mount point / and /dev/sda2 - mount point swap) and then CentOS (/dev/sda3 - mount point / and /dev/sda6 mount point swap) ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    59

    Ubuntu and CentOS dual boot

    Hello All,

    I have installed first Ubuntu (/dev/sda1- mount point / and /dev/sda2 - mount point swap) and then CentOS (/dev/sda3 - mount point / and /dev/sda6 mount point swap) on my laptop. Unfortunately CentOS doesn't recognize Ubuntu and loads only to CentOS.
    Even I have modified grub.conf file and added Ubuntu in the grub.conf
    Here it is:
    default=3
    timeout=5
    splashimage=(hd0,3)/boot/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.18-164.el5)
    root (hd0,3)
    kernel /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
    initrd /boot/initrd-2.6.18-164.el5.img
    title Ubuntu, Linux 2.6.31-14-generic
    root=(hd0,1)
    kernel /boot/vmlinuz-2.6.31-14-generic root=LABEL=/ Ubuntu9.1 ro quiet splash
    initrd /boot/initrd.img-2.6.31-14-generic

    If I install CentOS first and then Ubuntu then I load both OS listed in the grub. Please suggest how to solve this problem.

    Thanks in advance!
    Savook

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,939
    You don't need two swap partitions.
    Your grub.conf entries seem to indicate CentOS is still using Grub Legacy while Ubuntu 9.10 is using Grub2. Grub Legacy counts both hard drives and partitions from zero so the entries you posted would indicate CentOS on the first hard drive, 4th partition and Ubuntu on the first hard drive and the second partition? That seems to conflict with the info you posted about where the root partitions are for these systems.

    Perhaps it would help if you logged in to CentOS as root and ran the fdisk -l command to post results here. I haven't used Grub2 but hopefully, someone who is familiar with it will respond.

  3. #3
    Just Joined!
    Join Date
    Apr 2009
    Posts
    59
    To make it clear I have erased my disk. I first installed Ubuntu 9.1 and then CentOS 5.4. Now I can only boot to CentOS but not Ubuntu. Here is fdisk -l output and grub.conf file.

    Please help me to boot Ubuntu also.

    Thanks in advance!
    Savook

    ------------------
    #fdisk -l
    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 1216 9767488+ 83 Linux
    /dev/sda2 1217 1465 2000092+ 82 Linux swap / Solaris
    /dev/sda3 1466 2740 10241437+ 83 Linux
    -----------------------
    #less /boot/grub/grub.conf
    default=0
    timeout=5
    splashimage=(hd0,2)/boot/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.18-164.el5)
    root (hd0,2)
    kernel /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
    initrd /boot/initrd-2.6.18-164.el5.img
    -------------------------

  4. #4
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,939
    Fedora and CentOS are not good at detecting other Linux operating systems as you can see in your menu.lst, only the CentOS entry. You need an entry in the menu.lst file of CentOS for Ubuntu and according to your output of fdisk, it could be:

    root (hd0,0)
    chainloader +1

    The above should work. The problem is that Ubuntu 9.10 uses Grub2 while CentOS uses Grub1 and I'm not sure how this will impact things.

  5. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    You are using GRUB of CentOS now and you have to add an entry of Ubuntu in it.
    Execute this in Terminal of CentOS
    Code:
    mkdir /media/Ubuntu
    su -
    mount -t ext3 /dev/sda1 /media/Ubuntu
    ls /media/Ubuntu/boot
    Post output here.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  6. #6
    Just Joined!
    Join Date
    Apr 2009
    Posts
    59
    Here is the output:

    total 13756
    -rw-r--r-- 1 root root 629174 Oct 16 23:33 abi-2.6.31-14-generic
    -rw-r--r-- 1 root root 111371 Oct 16 23:33 config-2.6.31-14-generic
    drwxr-xr-x 2 root root 4096 Jan 5 17:06 grub
    -rw-r--r-- 1 root root 7641289 Jan 5 17:06 initrd.img-2.6.31-14-generic
    -rw-r--r-- 1 root root 128796 Oct 23 21:41 memtest86+.bin
    -rw-r--r-- 1 root root 1664737 Oct 16 23:33 System.map-2.6.31-14-generic
    -rw-r--r-- 1 root root 1196 Oct 16 23:36 vmcoreinfo-2.6.31-14-generic
    -rw-r--r-- 1 root root 3890400 Oct 16 23:33 vmlinuz-2.6.31-14-generic

    Thanks
    Savook

  7. #7
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Add this code at end of /boot/grub/grub.conf file of CentOS :
    Code:
    title Ubuntu
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.31-14-generic ro root=/dev/sda1 splash quiet
    initrd /boot/initrd.img-2.6.31-14-generic
    Put # sign before hiddenmenu in grub.conf file.
    Code:
    #hiddenmenu
    Save file and reboot machine.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  8. #8
    Just Joined!
    Join Date
    Apr 2009
    Posts
    59
    Thanks for your help.
    Now I ma getting Error 2: Bad File or Directory Type.

    Savook

  9. #9
    Just Joined!
    Join Date
    Feb 2010
    Posts
    1

    Thumbs up Grub2 v Grub1 dual booting

    Ubuntu forums has a Grub 2 Basics post which explains "Reinstalling GRUB 2 from the LiveCD"

    If you have Ubuntu 9.10 booting from Grub 2, you can add an entry for Centos manually.

    The file "/etc/grub.d/40_custom" is used to store menu entries for Grub 2. The first couple lines are needed (especially the "exec tail" line) but after that you can put in menu entries.

    example menu entry, from my own 40_custom file:

    menuentry "CenOS 5.4" {
    set root=(hd0,5)
    linux /vmlinuz-2.6.18-164.el5 root=UUID=3842136d-................ ro
    initrd /initrd-2.6.18-164.el5
    }

    # the set root line tells Grub where the /boot partition is... my sda is hd0 in Grub
    # Grub doesn't understand hda/sda, a is 0, b is 1

    # in the linux line root=UUID=3982349172....etc the long number is the UUID of the
    # / partition for CentOS.

    # the exact name of the vmliuz and initrd files will depend on what you have installed in /boot

    # to get the UUID for a drive you can do this at a command prompt:
    # sudo blkid -o value -s UUID /dev/sda1
    # where /sda1 is whatever partition you wish to look at

Posting Permissions

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