LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ubuntu / CentOS / Grub issue (https://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-centos-grub-issue-704857/)

lassik 02-15-2009 01:54 PM

Ubuntu / CentOS / Grub issue
 
I've had Ubuntu installed on my system for awhile now and i recently installed CentOS. I elected to let CentOS install it's own Grub (probably my first mistake). After that, now I don't have an option to boot in to Ubuntu when I start the computer up.

What do i need to edit or change in order to get this back to normal.

Here's what i've got right now.

My original Grub.conf from Ubuntu. (note that the partition that says Ubuntu 7.10 was replaced with CentOS. Ubuntu 7.10 is no longer on the machine)
Code:

title          Ubuntu 8.10, kernel 2.6.27-7-generic
uuid            d2b830a3-898f-4178-b9c7-14910bb7cc8d
kernel          /boot/vmlinuz-2.6.27-7-generic root=UUID=d2b830a3-898f-4178-b9c7-14910bb7cc8d ro quiet splash
initrd          /boot/initrd.img-2.6.27-7-generic
quiet

title          Ubuntu 8.10, kernel 2.6.27-7-generic (recovery mode)
uuid            d2b830a3-898f-4178-b9c7-14910bb7cc8d
kernel          /boot/vmlinuz-2.6.27-7-generic root=UUID=d2b830a3-898f-4178-b9c7-14910bb7cc8d ro  single
initrd          /boot/initrd.img-2.6.27-7-generic

title          Ubuntu 8.10, memtest86+
uuid            d2b830a3-898f-4178-b9c7-14910bb7cc8d
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 Professional
root            (hd0,0)
savedefault
makeactive
chainloader    +1


# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
title          Ubuntu 7.10, kernel 2.6.22-14-generic (on /dev/sda5)
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.22-14-generic root=UUID=4c0cf01a-b115-4327-bde2-0bc6b6d79c65 ro quiet splash
initrd          /boot/initrd.img-2.6.22-14-generic
savedefault
boot


# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
title          Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode) (on /dev/sda5)
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.22-14-generic root=UUID=4c0cf01a-b115-4327-bde2-0bc6b6d79c65 ro single
initrd          /boot/initrd.img-2.6.22-14-generic
savedefault
boot


# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
title          Ubuntu 7.10, memtest86+ (on /dev/sda5)
root            (hd0,4)
kernel          /boot/memtest86+.bin
savedefault
boot

My new grub.conf file when i installed CentOS
Code:

# 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,4)
#          kernel /boot/vmlinuz-version ro root=/dev/sda5
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.22.el5)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-92.1.22.el5.img
title CentOS (2.6.18-92.el5)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-92.el5.img
title Other
        rootnoverify (hd0,0)
        chainloader +1

fdisk -l
Code:

Disk /dev/sda: 250.0 GB, 250058268160 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        4233    34001541    7  HPFS/NTFS
/dev/sda2            4234      30401  210194460    f  W95 Ext'd (LBA)
/dev/sda5          23825      30141    50735128+  83  Linux
/dev/sda6          30141      30401    2094088+  82  Linux swap / Solaris
/dev/sda7            4234      23024  150938644+  83  Linux
/dev/sda8          23025      23824    6425968+  82  Linux swap / Solaris

/dev/sda1 = Windows XP partition
/dev/sda5 = CentOS 5.2
/dev/sda7 = Ubuntu 8.10


I thought that maybe just doing this would fix the issue but i haven't tried it yet because i don't want to mess anything up.
Code:

# 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,4)
#          kernel /boot/vmlinuz-version ro root=/dev/sda5
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
hiddenmenu
title Ubuntu 8.10, kernel 2.6.27-7-generic
        root (hd0,6)
        uuid d2b830a3-898f-4178-b9c7-14910bb7cc8d
        kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=d2b830a3-898f-4178-b9c7-14910bb7cc8d ro quiet splash
        initrd /boot/initrd.img-2.6.27-7-generic
        quiet
title CentOS (2.6.18-92.1.22.el5)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-92.1.22.el5.img
title CentOS (2.6.18-92.el5)
        root (hd0,4)
        kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-92.el5.img
title Other
        rootnoverify (hd0,0)
        chainloader +1

Another thing to note is that i'm not at this machine so i need to be able to make this change, type reboot in the terminal and it boot right back up in to Ubuntu automatically. So i kinda have just 1 chance at this. I can get to the machine if i really need to. Just a bit of a drive to do so.

Any help would be greatly appreciated.

Thank you.

cmnorton 02-15-2009 02:30 PM

Backup Before Experimenting
 
It looks like CentOS took your position reserved for Ubuntu, and you need to add Ubuntu back. You'll learn a lot by experimenting. Just back the relative files up somewhere safe.

I saw this but did not read it in great detail as to how well it will help you.

https://answers.launchpad.net/ubuntu/+question/37978

You can also use the live CD to put your boot stuff back. Backing up the files helps preserve CentOS, in case using the live CD does to you what installing CentOS did.

lassik 02-15-2009 04:20 PM

I found out that (hd1,6) is definitely what i need to use as root but here's what i got

Code:

[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
Unknown partition table signature


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
  lists possible command completions.  Anywhere else TAB lists the possible
  completions of a device/filename.]
grub> root (hd1,6)
root (hd1,6)
 Filesystem type is ext2fs, partition type 0x83
grub> setup (hd1)
setup (hd1)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... no

Error 2: Bad file or directory type
grub>

I assume this may be because Ubuntu is using a different version of Grub than CentOS is... maybe...

CJS 02-15-2009 06:28 PM

How about doing the following from your Intrepid Live CD, because it is important to make sure you use the latest Grub that Intrepid has:
Code:

sudo grub
grub> root (hd0,6)
grub> setup (hd0,6)
grub> quit

And then in your CentOS grub.conf add:
Code:

title Ubuntu Grub menu
root (hd0,6)
chainloader +1

Let me know if that works OK or not.

lassik 02-15-2009 11:14 PM

Well my whole point was that I needed to do it remotely but I went to the site where the server was and did what you said CJS and it worked.

Thank you.

CJS 02-16-2009 08:03 AM

Glad to hear that worked OK; cheers and enjoy Ubuntu and CentOS. :)

malikjunaid 04-30-2010 04:56 AM

Quote:

Originally Posted by CJS (Post 3444742)
How about doing the following from your Intrepid Live CD, because it is important to make sure you use the latest Grub that Intrepid has:
Code:

sudo grub
grub> root (hd0,6)
grub> setup (hd0,6)
grub> quit

And then in your CentOS grub.conf add:
Code:

title Ubuntu Grub menu
root (hd0,6)
chainloader +1

Let me know if that works OK or not.

Hi CJS,
I have a similar problem but the ubuntu version i have is ubuntu 9.10 and it have grub2. I can not run the grub command. i tried grub2 but there is nothing like this.
Can you help me what i can do to fix my problem?
thanks.


All times are GMT -5. The time now is 06:02 AM.