[SOLVED] multi boot with Ubuntu

General support questions including new installations
MrBrainstorm
Posts: 19
Joined: 2010/05/28 11:29:07

[SOLVED] multi boot with Ubuntu

Post by MrBrainstorm » 2010/06/09 13:04:36

Hi guys,
I need your help again :-)
I have a Linux computer which is running Ubuntu 10.4. Now I want to use CentOS additional to the Ubuntu system. So I shrank the existing Ubuntu partition and installed CentOS using the free space. I didn't install the bootloader to be still able to boot Ubuntu. However, I am not able to boot CentOS now.

I am using the Grub2 bootloader. I already did
[code]sudo update-grub[/code] under Ubuntu and it displays the CentOS system. but at start-up the boot option for CentOS wasn't present. I then edited the /etc/grub.d/40_custon file but nothing changed.

Here is my fdisk -l output
[code]Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000045d2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 182401 1465136001 83 Linux

Disk /dev/sdb: 82.0 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd775d775

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 7623 61231716 83 Linux
/dev/sdb2 9554 9964 3301357+ 5 Extended
/dev/sdb3 7624 7636 104422+ 83 Linux
/dev/sdb4 7637 9553 15398302+ 8e Linux LVM
/dev/sdb5 9554 9964 3301326 82 Linux swap / Solaris
[/code]

/dev/sdb3 and sdb4 are the CentOS partitions. The grub.cfg file looks like [url=http://pastebin.centos.org/33230]this[/url]

Does anybody know how to fix this issue? The search didn't show satisfying results (usually threads with open end).
Btw, I am quite a linux noob, so please try to be as simple as possible and tell me what commands I have to use in order to support you with the information you need. So, if you need more let me know! :-)

azjp
Posts: 14
Joined: 2010/02/08 18:10:49
Location: Arizona, USA

Re: multi boot with Ubuntu

Post by azjp » 2010/06/09 15:57:06

MrBrainstorm,

I think you're asking the wrong group. As you may know, there's grub and there's grub2. You're using grub2 which is only used by the last few Ubuntu releases. Virtually everyone in this forum is using the older grub, also known as legacy grub.

I multi-boot Windows, Fedora and Ubuntu on one of my my home systems so I have run up against grub2.

If you wish help with grub2, I'd try the Ubuntu forums.

The one time I had a problem with grub2 finding other OSes, I gave up on grub2 and reinstalled legacy grub. The instructions to do so are on the Ubuntu Forums site. FWIW, I have to know how to fix legacy grub problems. Learning grub2 just wasn't of great interest to me. I suspect the answer to your problem is not all that difficult.

From my sketchy memory, I believe there is a step that you have to perform after you customize any of the grub2 scripts. The grub boot loader configuration is generated from your script as opposed to your script being used at boot time. Before doing the extra step, however, I think your line "set root='(/dev/hd0,3)'" is not correct. OTOH, that's coming from a guy who couldn't put up with grub2, so consider the source. :-D

Good hunting.

MrBrainstorm
Posts: 19
Joined: 2010/05/28 11:29:07

Re: multi boot with Ubuntu

Post by MrBrainstorm » 2010/06/09 17:21:53

Ok, i just installed grub and kicked out grub2. Anyway, I didn't have anything to lose. Unfortunately, a sudo update-grub didn't find the CentOS system. I edited the menu.lst by adding
[code]title CentOS
root (hd0,3)
kernel /vmlinuz-2.6.18-194.el5
makeactive
chainloader +1[/code]
But it still won't boot. Now that I am also using the grub1 bootloader, maybe you might want to give me a hand on that. Another important question: when installing centos, is it necessary to install a bootloader when a linux system with a bootloader is already on the same physical drive (but not partition)? I start to believe that is the reason why centos doesn't start. If i have to install the bootloader, can I still do that now or is it better to reinstall centos?

P.S.: I am also trying to get help in a ubuntu forum, but it's getting really frustating. Don't reallz get the impression they want to help :-(

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: multi boot with Ubuntu

Post by pschaff » 2010/06/09 17:45:58

Welcome to the CentOS fora. The following reading is recommended for new users:
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14274&forum=47]Readme First[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14408&forum=47]Installing Software[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=14273&forum=47]Where to Find Answers[/url]
[url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=25128&forum=47]How to provide information about your system[/url]

My recommendation would be to install CentOS GRUB on the /boot partition and chainload to it. This could have been done at install time, using the advanced option, but will be more difficult now. You should be able to boot using Ubuntu GRUB (or GRUB2) if you get it right. The CentOS stanza should look more like the following, if you did a default install:[code]
title CentOS (2.6.18-194.el5)
root (hd0,2)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-194.el5.img
[/code]

Note (hd0,2) not 3 - fdisk numbers from 1, GRUB numbers from 0.

To chanload try a forum search on "chainload ubuntu grub" for details, but basically you need to [url=http://wiki.centos.org/TipsAndTricks/ReinstallGRUB]Re-Install GRUB[/url] and add a stanza to Ubuntu GRUB (or GRUB2) to chainload.[code]
title chainload CentOS GRUB
root (hd0,2)
chainloader +1
[/code]

To do this you will need to create /boot/grub/grub.conf containing something like:[code]
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,2)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda3
default=0
timeout=5
splashimage=(hd0,2)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5)
root (hd0,2)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-194.el5.img
[/code]

Might be easier to just re-install CentOS putting GRUB on on /boot (/dev/sda3) rather than the MBR.

MrBrainstorm
Posts: 19
Joined: 2010/05/28 11:29:07

Re: multi boot with Ubuntu

Post by MrBrainstorm » 2010/06/09 19:19:24

I am so fed up now!
I am deleting now all partitions on my hard disk, reinstall Ubuntu and CentOS. I just reinstalled CentOS and installed the bootloader on sdb3. Didn't help. Uninstalled grub2 and reinstalled grub1. update-grub found the CentOS system but when I reboot I have grub2 again. Doesn't matter what I do. I was trying to get it to work for more than a week now. Now I start completely frech! But I might still need your help afterwards.

Like now I install Ubuntu which will bring grub2. After that I will install CentOS and install the grub1 onto the /boot partition of CentOS, right?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: multi boot with Ubuntu

Post by pschaff » 2010/06/09 21:13:00

[quote]
MrBrainstorm wrote:
...
Like now I install Ubuntu which will bring grub2. After that I will install CentOS and install the grub1 onto the /boot partition of CentOS, right?[/quote]

Yes. I have done exactly that on multiple systems and used the chainload technique to get to CentOS (or Fedora) GRUB. I never did it with the Ubuntu automation - just inserted the chainload boot stanza as shown with an editor.

MrBrainstorm
Posts: 19
Joined: 2010/05/28 11:29:07

Re: multi boot with Ubuntu

Post by MrBrainstorm » 2010/06/09 21:45:33

Ok, so I am on the right way. Good to know :-)
Now I have both systems installed. Grub2 is on (or in?) the MBR of the hard disk. Ubuntu uses the partitions sda1,2 and CentOs sda3,4. During the CentOS installation I chosed to install the bootloader on partition sda3. So far so good...

Now I have the situation that Ubuntu starts automatically whout a bootloader menu. I could now run [code]sudo update-grub[/code] and then add the CentOS system to the grub.cfg. How should it look like?

I was thinking about this

[code]
menuentry 'CentOS' {
set root=(sda3)
search --no floppy --fs uuid --set <diskID>
linux /vmlinuz.2.6.18-128.el5 root=UUID=<diskID> ro quiet splash
initrd /initrd-2.6.18-128.el5.img
}
[/code]
Should this work for grub2? Or this total nonsense? Right now I am too tired to get a clear thought. Maybe tomorrow I know more. But I would still appreciate if somebody would give an opinion about the menuentry.

Btw, thanks for your time and trying to help. I really do appreciate that!

P.S.: I learned so much the last couple of days that am really afraid to mix things up :-(

chuina
Posts: 355
Joined: 2009/12/11 10:25:56

Re: multi boot with Ubuntu

Post by chuina » 2010/06/09 22:28:41

I use some of Linux in my home Box.

Here i install CentOS first > then the others.

I took my opportunity to post my grub [url=http://pastebin.centos.org/33236]in the pastebin[/url]. :-D

I install the kernels in same partition which is not recommended by many users (so, nor by me now).

Let us know if that clear anything.

azca
Posts: 174
Joined: 2006/06/03 18:06:13
Location: Peoria, AZ USA

[SOLVED] multi boot with Ubuntu

Post by azca » 2010/06/09 23:47:28

First, I apologize if I'm adding confusion or noise, and please understand that I'm not an expert on this, but a few months ago I set up a dual boot CentOS-5 with Ubuntu-9.10, which used grub2. I no longer have that system, so I'm relying on notes and memory.

First I installed CentOS-5 and installed the grub boot-loader normally, to the MBR. My partition scheme was:

hda1 /boot
hda5 /
hda6 swap

After I was satisfied that CentOS-5 would properly reboot, etc, I installed the grub boot-loader to it's PBR, Partition Boot Record, like this:

[code]
# grub

# grub> find /grub/stage1 #<--- Note that you may need to use: "find /boot/grub/stage1" depending on your partition scheme.
(hd0,0)

# grub> root (hd0,0)
# grub> setup (hd0,0)
# grub> quit
[/code]
Next I installed Ubuntu-9.10 with grub2 to the MBR. At this point, Ubuntu-9.10 rebooted properly, but there was no sign of CentOS-5.

To correct that malfunction, I added the following entry to "/etc/grub.d/40_custom"

Note: grub2 partitions start with "1", not "0" as in legacy grub.

[code]
$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
###
menuentry "Centos-5.4" {
set root=(hd0,[b]1[/b])
chainloader +1
}

$
[/code]
Next I ran "sudo update-grub", or "sudo update-grub2". Sorry, I don't remember which. But now I was able to successfully dual boot CentOS-5 and Ubuntu-9.10.

Please see the following links for more info:

https://help.ubuntu.com/community/Grub2

https://wiki.ubuntu.com/Grub2

Again, sorry for any confusion or noise.

azjp
Posts: 14
Joined: 2010/02/08 18:10:49
Location: Arizona, USA

Re: multi boot with Ubuntu

Post by azjp » 2010/06/10 00:09:25

While I was working on my reply the previous post was entered. The post before this is a good answer and I do not need to add one more way of accomplishing the same thing.

Good luck MrBrainstorm.

Post Reply

Return to “CentOS 5 - General Support”