LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 04-26-2008, 05:10 PM   #1
Dekker
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Rep: Reputation: 0
Question TripleBoot - how to "move" grub from MBR to BootSector


I am nearly there, triplebooting XP, VISTA and Kubuntu.
I have tried and liked EasyBCD, as it uses the "new" BCD style bootloader incorporated into VISTA (I am not debating if this is a good thing or not). What I like about the setup is that it offers a relatively clean menu for all three (or as many as I want, as far as I can figure out) OS.
Follwing directions, I installed XP first, then VISTA and finally Kubuntu, each into their own primary partition. The only precaution needed is to not let grub modify the MBR, but install itself into the Kubuntu's bootsector, but I am afraid I have failed here.
Kubuntu advanced option isn't very clear on how and where to install GRUB. Anything differnet from hd0 would produce an error at the end of the setup cycle. When I finally tried hd0, it worked fine, but overwrote my VISTA loader.
So, I shall recover that, but then how to I boot into Kubuntu, in other words, how or where will grub/Kubuntu boot files be located. That's what I mean by "moving" grub from MBR to the bootsector of the kubuntu partition. The EasyBCD documentatiion for linux just states:
Quote:
When prompted to set up the bootloader, make sure you specify to install LILO, GRUB, or whatever to the bootsector of the partition that Linux is being installed to and not the MBR of your hard drive.
I would appreciate any help resolving this. I am aware that I shall need to edit the boot.lst file to remove the other OS that the Kubuntu installer found, etc. but that shouldn't be a problem. I have also played around with grub comands from the live CD, but most fail with (hd0,3) not found errors or similar.
Thanks,
Derek.
 
Old 04-26-2008, 05:45 PM   #2
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
With your live cd in terminal or (konsole) as root type grub then hit enter. This should bring up a grub prompt. Type 'root (hd0,3)' if 0 is on the first hd and Kubuntu in the fourth partition and hit enter. Then type 'setup (hd0,3)' and hit enter.

This will make Kubuntu bootable but will not fix the mbr.

Last edited by Larry Webb; 04-26-2008 at 05:49 PM.
 
Old 04-26-2008, 05:58 PM   #3
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,839

Rep: Reputation: 48
I believe you would use grub-install to install GRUB to your root Linux partition.
 
Old 04-26-2008, 06:30 PM   #4
Dekker
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for your prompt replies. I still have not modified my MBR, so grub is working OK, for now, and I am able to boot into Linux.

I can even choose to boot Windows, where I end up with an option to start VISTA or XP. As this is my home computer and all the family uses it (XP and VISTA mainly, I am the only one trying to haul my self over to Linux), my intention is to simplify the boot process.

So, currently grub is in the MBR, taking over the initial boot sequence. I want to replace that with the VISTA BCD bootloader (enhanced with EasyBCD). That means I need to be able to "call" grub from the BCD bootloader (using EasyBCD), but then grub has to reside on the bootsector (NOT MBR) on the Linux partition. How to I achieve this?

These are some of my parameters:
Quote:
$ sudo fdisk -l

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

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1305 10482381 7 HPFS/NTFS
/dev/sda2 1306 3916 20972857+ 7 HPFS/NTFS
/dev/sda3 3917 5221 10482412+ 83 Linux
/dev/sda4 5222 5532 2498107+ 5 Extended
/dev/sda5 5222 5532 2498076 82 swap

grub> find /boot/grub/stage1
(hd0,2)

... and the edited (comments removed) menu.lst file:

title Ubuntu, kernel 2.6.20-16-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=266e426d-05bd-43e5-90db-64ee53c40101 ro quiet splash
initrd /boot/initrd.img-2.6.20-16-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=266e426d-05bd-43e5-90db-64ee53c40101 ro single
initrd /boot/initrd.img-2.6.20-16-generic

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,2)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=266e426d-05bd-43e5-90db-64ee53c40101 ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root (hd0,2)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=266e426d-05bd-43e5-90db-64ee53c40101 ro single
initrd /boot/initrd.img-2.6.20-15-generic

title Ubuntu, memtest86+
root (hd0,2)
kernel /boot/memtest86+.bin
quiet

title Windows Vista/Longhorn (loader)
root (hd0,0)
savedefault
makeactive
chainloader +1
I some how need EasyBCD to "point" a booting sequence, grub, that will load this menu and boot Kubuntu with no delay. But how?
Using grub-install? But to what hard disk/partition parameters?
Using grub> root (hd0,2) and then setup (hd0)? But surely that would place grub back in the MBR

I think I am getting confused.

Cheers
 
Old 04-26-2008, 07:07 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Some options (best/simplest first):
i) keep using grub but default to booting the Vista loader. Looks like you got too aggressive with your editting. There should be a line in menu.lst that says "default 0". Change it to "default 5" - maybe also shorten the time-out so the family doesn't have to wait so long. You can even set it up so the grub menu doesn't show (hiddenmenu) - when you *do* want to get to the grub menu, hit <Esc> within the timeout period.

ii) as per Larry Webbs post, except in Ubuntu you'll need "sudo grub". Also, change references from (hd0,3) to (hd0,2). This will install grub to the partition boot sector record. Yes, grub will also (still) be in the MBR - doesn't matter.
Then change the MBR to use the Vista loader, and use EasyBCD to update the boot list. Note that there have been reports of problems with EasyBCD, but the couple of times I've used it, it worked as advertised.
 
Old 04-26-2008, 08:18 PM   #6
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Quote:
Kubuntu advanced option isn't very clear on how and where to install GRUB. Anything differnet from hd0 would produce an error at the end of the setup cycle. When I finally tried hd0, it worked fine, but overwrote my VISTA loader.
I was a little chocked when Ubuntu did this to me also. I have Bootitng as a boot manager and I had to reinstall my boot manager and recover all the other partitions, about 12 of them.
I don't know how BCD works, but bootitng only makes primary partitions, up to 254 or so, and when you go to install an OS you configure the boot loader to allow the OS to see no more than three other partitions as the limit in the MBR is four. Then you install the OS, re-boot and select the entry you created for it and the boot loader boots it after re-writing the MBR to include only the four primary partitions it's allowed to see, the rest of the primary partitions appear as free space.

I like this method as I don't have to worry about the chain loading structure between Windows OSs like Vista and XP. I can install a couple Linux distros first if I want and install XP a couple times in various areas of the drive and then install Vista towards the end or wherever and none of the OSs know the others exist, therefore just boot up and go no matter when and where they are installed, and they are all in primary partitions, they are allowed to see up to 4 primary partitions on as many drives as you have up to 8.

I'm only guessing here, but I would think EasyBCD should be able to do the same and boot the two Windows partitions separately. When I install a Windows OS, it overwrites the entries bootitng put in the MBR and I have to re-capture bootitng from it's partition, when I installed Ubuntu, it wiped out bootitng's partition effectively loosing reference to all other partitions I had on the drive, "a** hole".
 
Old 04-26-2008, 10:11 PM   #7
Dekker
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Thumbs up Triple boot - XP, VISTA and Linux

DONE! It all works beautifully.

I am using EasyBCD 1.7.2, and so far it works as advertised. It calls grub on the linux partition bootsector (hd0,2) (in my case), without a hitch. I deleted the extra grub entries (basically, the Win OS it found upon installation) and set the timeout to 3, so it goes practically unnoticed. I guess I could unremark the 'hidemenu' command for even a more seamless boot process.

Recalling my past failed attempts at getting this right, one was not invoking grub with 'sudo'. Not running with 'root' privileges means that grub will simply not return anything or "device not found" errors. Secondly, to run the grub 'setup' command, 'root' has to be run first, even though in theory I was not changing the boot file location. After that, plus your invaluable tips, everthing worked OK.

As a summary for this success story, this is what I did:
  1. Installed XP in its own primary partition (hd0,0)
  2. Installed VISTA in its own primary partition (hd0,1). Vista should automatically create a dualboot scenario
  3. Installed Kubuntu, or any other distro for that matter, in its own primary partition (hd0,2)
    1. BUT making sure that grub or whatever loader you choose does NOT overwrite or install itself in the harddisk's MBR (Master Boot Record), but on the bootsector of the linux partition.
      Not as trivial as it sounds, specially if you are using a high level (intelligent?) installer
    2. In the event that grub installs itself anyhow on the MBR, not much is lost, as linux should still be bootable, and from the grub boot menu you should be able to access the VISTA loader, that in turn should offer to boot 'VISTA' or 'XP' (or whatever)
    3. To recover from the above scenario, I "installed" grub on the bootsector of the linux partition, from within linux, by running these commands from grub (remember to invoke as $ sudo grub ):
      grub> root (hd0,2) # in my case, third partition
      grub> setup[/I] (hd0,2) # bootsector of third partition
      After rebooting, nothing changes, as the grub loader still resides on MBR as well.
    4. Using EasyBCD, I added an entry for linux, telling it to look for the loader in the third partition (Windows nomination, not linux's).
      Next, using the EasyBCD "Manage Bootlader" option, I re-installed the VISTA loader to the MBR, and crossed my fingers!
    5. Finally, from within linux I edited the /boot/grub/menu.lst and removed the any MS-Windows entry, as well as reducing the timeout. A very good idea is to make a backup of this file before modifying

One word of caution though, EasyBCD displays drive letters, but request actual partition numbers when adding entries. A wee bit off-putting, but it works in then end.

Thanks for you support.
 
Old 04-26-2008, 10:26 PM   #8
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Glad to see a success story, I will try and remember the info. I chainload now but if I ever setup another hd I will consider something else.
 
Old 04-27-2008, 02:24 AM   #9
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
for future reference...I do not mind the OP has elected to move off grub but be aware that the stated claims of easybcd are misleading
http://neosmart.net/gallery/v/neosma...enter.png.html

I think grub in mbr and its ability to be used for trouble-shooting easily outweighs the above link....easybcd has so many ways of fixing linux?

I think not
 
Old 04-28-2008, 03:10 PM   #10
Dekker
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Just for clarification purposes...

I agree with aus9 that grub is probably a more robust multi-booting and debugging platform, and definitely would reverse my decision if linux was being used as the primary O.S. (which it is not at the moment I am afraid).

What put me off grub was the daisy-chaining of loaders. If there is a way to directly invoke the VISTA and XP boot process (bootmgr and ntldr ) then I would probably opt for it. If not possible today, then maybe some future release of grub might attend this need, and yet again it may no be in its interest to solve (if at all doable) Windows booting woes.

Because I definitely would have more faith in it (over EasyBCD or Windows alternatives) as linux and it's community has proved once and again.

But right now, I have found a solution that works (so far), and more importantly, that my family can deal with, without too much stress.

BTW, aus9 what do you mean with the phrase "...I do not mind the OP has elected to move off grub...". Who or what is OP?. Operator?

In any, thanks again for all your support, good vibes and intelligent ideas that makes this harsh technical environment so much more habitable.
 
Old 04-28-2008, 09:03 PM   #11
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
sorry I thought you had left having got satisfaction ....op = original poster

which is why I said for future reference....not trying to reverse your decisions as I am ex windows user myself
 
Old 04-28-2008, 11:29 PM   #12
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Quote:
Originally Posted by Dekker View Post
What put me off grub was the daisy-chaining of loaders.
Grub can be just like my boot loader and boot the Windows OS's separately. Just like bootitng, it can have it's configuration file in it's own partition (not using a menu.lst from a OS). By doing so, you can configure it to hide OS's from each other and boot them directly from the grub menu. You can probably do the same with the menu.lst of an installed OS, only you'll have to keep editing this menu.lst every time there is a kernel update or grub update etc.
But...
There is still some chain loading in the extended partition, just you won't have to do like Windows and need to go through another boot menu.
 
Old 01-24-2010, 09:59 AM   #13
Airidh
LQ Newbie
 
Registered: Sep 2006
Location: Western Isles of Scotland
Distribution: Fedora 12, Mint
Posts: 10

Rep: Reputation: 0
Thank you

Just to add my thanks to everybody else's. I have been looking for a solution to the Vista/fedora boot problem for ages, so the thread is still relevant.
 
  


Reply

Tags
grub, multiboot


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I restore my MBR aka "Oops I messed up my Grub" codeape Debian 4 04-13-2007 12:14 AM
uninstall boot loader "Lilo" install "Grub" sethis Linux - Newbie 6 11-30-2006 10:32 AM
"GRUB _" when booting, nothing but "ctrl+alt+del" functions rabidpencil Linux - Newbie 15 08-08-2006 11:20 AM
grub list "MZ" for my windows boot "Help on Change" davimint Linux - Newbie 2 01-26-2006 07:22 AM
Will "grub-install /dev/hda" kill Windows XP MBR? Zullocrit Linux - Newbie 3 09-25-2004 10:50 AM


All times are GMT -5. The time now is 03:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration