LinuxQuestions.org
Review your favorite Linux distribution.
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-05-2009, 06:54 PM   #1
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Rep: Reputation: 0
Edit Grub when XP install won't boot


When I installed Ubuntu it, Ubuntu, was on disk zero and Win XP on disk 1, according to the Windows drive manager. I think that Ubuntu is supposed to be on the first HD in a multiple HD system. Ubuntu set up the grub to load windows with this item in grub:

root (hd2,0)
Safedefault
Makeactive
Map (hd0) (hd2)
Map (hd2) (hd0)
Chainloader +1

When this didn't work I tried changing the drive designations around to no avail. My question is what does this syntax tell the system to do and how can I fix it to see and load my WinXP if I choose that option from Grub? My first impression on seeing this "wording" is that it is counterintuitive to map one drive to another and then reverse that.....in the very next line. So, I don't understand,,,,

Also, I set the boot order so that the drive with the Ubuntu install is the first device.

Both OS's will boot, but Grub is FUBAR!!!!!!!!!!

Last edited by jhinds; 04-05-2009 at 07:10 PM.
 
Old 04-05-2009, 07:02 PM   #2
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Why won't it work to make the root read (hd1) and remove the two map lines? It doesn't, I tried....
 
Old 04-05-2009, 07:43 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,128

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Ugh, these disk ordering issues are always a pain. I deal with this on servers a lot because various distro installers can never seem to get this right. You will probably need to go into your computer's BIOS and rearrange the BIOS drive order so that it matches up with what you expect it to be based on the IDE/SATA channel ordering. Then, get into Linux into Linux and install the GRUB MBR section onto your first hard drive (grub-install /dev/sda or grub-install /dev/hda). regardless of whether or not that is your Linux drive. Before running grub-install, make sure the GRUB root is set correctly (to (hd0,0) if your windows partitiom is the first partition of your first drive, (hd1,0) if it's the first partition of the 2nd drive, etc.). Note that the root willbe different for your Linux install. Then you should be able to get rid of the drive remapping altogether.

Basically, the root command tells GRUB what partition it needs to look for files on. The map commands try to switch hd0 and hd2. The chainloader command just tells GRUB to execute the code on that partition's boot sector (i.e. the Windows bootloader). A Linux entry looks a little different since for Linux GRUB actually loads the kernel and initrd directly without going through an intermediate.

Since you have hd0 and hd2, is it possible you have drives on two different IDE channels or and IDE and a SATA drive? I haven't played with IDE in awhile and I'm a bit rusty as to how GRUB handles that. Most of the time I've seen these problem, there's a disconnect between the BIOS drive mapping and how GRUB thinksd the drives are arranged.

Edit to add: make sure you have rescue CDs for both Windows and Linux before you go messing around with this. They will save your bacon if you mess up and overwrite a bootloader.

Last edited by btmiller; 04-05-2009 at 07:45 PM.
 
Old 04-05-2009, 08:38 PM   #4
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Since you say you only have two disks, leave everything including the bios settings the way they were originally. Grub counts from zero, meaning the first drive is (hd0), the second should be (hd1).
Try editing /boot/grub/menu.lst to look like this:
Code:
title Windows
  root (hd1,0)
  Safedefault
  Makeactive
  Map (hd0) (hd1)
  Map (hd1) (hd0)
  Chainloader +1
What you posted in the first post suggests grub should look at the third drive to boot Windows, of course, this won't work if Windows is on the second drive.
Quote:
I think that Ubuntu is supposed to be on the first HD in a multiple HD system.
Nope, you can install any os on any drive, normally Windows expects to be in a primary partition on the first drive, which is why you have to use the mapping to fool Windows into thinking it's on the first drive.
You can also switch the order in the bios so the Windows drive is the first boot drive, then you would have to boot into a live Ubuntu session with the Ubuntu CD to reinstall grub, the map commands would be eliminated in this case.
 
Old 04-06-2009, 08:43 AM   #5
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks btmiller.
All drives are SATA and I did note the drive ordering according to SATA differs considerably from the bios ordering. SATA drive 5 was BIOS drive 0, or some such. So when you say arrange order in the BIOS you mean the boot order I suppose. I already, before posting my question, redid some SATA wiring so that my Linux drive is 0 and my windows drive is 1. I thought that would be part of the fix. It just seems to me that all I need to do is edit the GRUB script that I included in my question. Here is what my boot.ini says, by the way:


[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(2)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(2)partition(1)\WINDOWS="Microsoft " /fastdetect
multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /noexecute=optin /usepmtimer

I select the item that says "windows", not Windows XP Pro. Windows XP pro, if I select it, gives me the same error my original GRUB config displays if I select windows from there...and this is another clue I suppose, the Grub seems to maybe simply be pointing to the wrong option of the two in boot.ini.

Thanks again.
 
Old 04-06-2009, 08:56 AM   #6
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
And thank you too Junior Hacker.
When I saw this I thought, oh boy! the answer at last...but it doesn't work. I got a screen that said startingup, with a blinking cursor.

Hard to see why (hd1,0) won't work. As I said windows disk manager indicates Windows XP install is on drive 1 and Ubuntu shows to be on 0.
 
Old 04-06-2009, 09:10 AM   #7
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
Can you give us the results of 'fdisk -l' run from terminal as root.
 
Old 04-06-2009, 09:13 AM   #8
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
So, Junior Hacker, another point. You say to reset the Windows drive to boot first then boot into a Ubuntu live CD and reinstall GRUB.
How do I do this from a live CD? Seems to me that I recall trying to find a recovery function on the Ubuntu CD, but it wasn't there. If it was there how would it be accessed? Couldn't GRUB be reinstalled from within my current Ubuntu install, and if so, how?
 
Old 04-06-2009, 09:30 AM   #9
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Larry Webb,

Hmmm! here is the result of fdisk -l:

john@nunya:~$ fdisk -l
Cannot open /dev/sda
Cannot open /dev/sdb
Cannot open /dev/sdc
Cannot open /dev/sdd
john@nunya:~$
 
Old 04-06-2009, 09:37 AM   #10
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Larry Webb,
I am new at this so I didn't realise the fdisk command had to be preceded by sudo. New results:

john@nunya:~$ sudo fdisk -l
[sudo] password for john:

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

Device Boot Start End Blocks Id System
/dev/sda1 * 1 29172 234324058+ 83 Linux
/dev/sda2 29173 30401 9871942+ 5 Extended
/dev/sda5 29173 30401 9871911 82 Linux swap / Solaris

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x011b011b

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 30400 244187968+ 7 HPFS/NTFS

Disk /dev/sdc: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00e800e8

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 30400 244187968+ 7 HPFS/NTFS

Disk /dev/sdd: 1058 MB, 1058275328 bytes
2 heads, 63 sectors/track, 16404 cylinders
Units = cylinders of 126 * 512 = 64512 bytes
Disk identifier: 0x00117675

Device Boot Start End Blocks Id System
/dev/sdd1 * 1 16405 1033456 6 FAT16
john@nunya:~$
 
Old 04-06-2009, 11:13 AM   #11
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: /root
Distribution: Slackware & BSD
Posts: 1,218

Rep: Reputation: 231Reputation: 231Reputation: 231
jhinds:

Quote:============
”When I installed Ubuntu it, Ubuntu, was on disk zero and Win XP on disk 1, according to the Windows drive manager. I think that Ubuntu is supposed to be on the first HD in a multiple HD system. Ubuntu set up the grub to load windows with this item in grub:

root (hd2,0)
Safedefault
Makeactive
Map (hd0) (hd2)
Map (hd2) (hd0)
Chainloader +1”
===================

How many hard disks does your given system have? Three?
If your Ubuntu "was" on (hd0,x) and your Win XP on disk 1 then the two systems are installed in separate hard disks. Whereof, you don't need to configure a chainloader since you can make your choice at the bios sponsored boot menu pressing F11 or F12 or F9. The NTLOADER hardisk(1) should simply equate to grub's (hd1,x), and changing the root line should also need change the Map lines. {Again, why need take the trouble of mapping two hard disks if choice can be made at boot menu after the bios POSTest? Still you have to do a click at choosing through the chainload, just the same amount of calories you spend in making the choice, right? }

Quote: ===========
"My question is what does this syntax tell the system to do and how can I fix it to see and load my WinXP if I choose that option from Grub?"
==================

Here in Linux we need to learn the good lesson and unlearn the poor lessons we had from Windows. I was a poor windows user for ten years: there we learn simple baby tricks and think ourselves as gurus without even knowing what is happening inside the concealed exe, com, dll files. Here in Linux you can change even the kernel source and compile it if you really have the blood. There is a good tutorial on Grub, webpage or downloadable, use google.

Quote:==============
" My first impression on seeing this "wording" is that it is counterintuitive to map one drive to another and then reverse that.....in the very next line. So, I don't understand,,,,"
====================

No it is not counter-intuitive. It is just a practical syntax. Reversing it is necessary to complete the trick at the system; in Algebra: b=a or a=b and that is a spell of complete similitude. Under microsoft windows I bet you are not given the control or power to map drives and play with it pointing from one to another; that lame duck cannot even boot from logical partitions (pardon my language but there is just no other way of bringing you the message that talking about boot loaders grub offers you the best.)

Quote:=

"Both OS's will boot, but Grub is FUBAR!!!!!!!!!!"

=======

No Grub is not FUBAR. I'll show you what fubar is in booting OS. This is a real fubar:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1) \Well?

That's a real FUBAR!!! and a fubar it shall be forever until the day you can teach me how to chainload a linux or unix from that fubar line.

Again pardon me. But let me remind you that this forum is meant to help one another and NOT to proclaim a verdict that grub is fubar just because one is lazy to learn from tutorials. Read the forum rules first then in your terminal, be a root, unmount all pretensions.

Syntax is ---

# umount -a -t pride -o learn /good/manners

Hope this helps.

malekii mustaqiim

"I am a well educated arab: extremely proud and I have less respect to hypocrites. I fear no one and I have destroyed many."
 
Old 04-06-2009, 11:32 AM   #12
Duck2006
Member
 
Registered: Sep 2006
Distribution: Ubuntu 8.04 Hardy Heron LST
Posts: 346

Rep: Reputation: 33
Some info on grub.

http://users.bigpond.net.au/hermanzone/p15.htm
 
Old 04-06-2009, 11:39 AM   #13
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
malekmustaq,

You are right, and I HAVE been using bios boot menu (f11 on startup gives quick access). I am pursuing the grub issue because it is a more "elegant" way of performing the task and because I want to learn how this stuff works.

I DO want to learn this....that's why I am here.

Just because you can walk and I can crawl doesn't mean you should be so condescending. Thanks anyhow.
 
Old 04-06-2009, 11:41 AM   #14
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
duck2008,
Hey, thanks. I'll go look at that.
 
Old 04-06-2009, 11:43 AM   #15
jhinds
LQ Newbie
 
Registered: Apr 2009
Posts: 12

Original Poster
Rep: Reputation: 0
posted this twice

Last edited by jhinds; 04-06-2009 at 12:02 PM. Reason: posted twice
 
  


Reply

Tags
boot, dual, grub, winxp


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
boot from winxp cd...edit grub? timberwolf90 Linux - Newbie 8 10-28-2007 04:09 AM
Edit Grub to boot Windows hiieu Debian 10 05-27-2007 04:41 AM
Kind souls: help getting Mandriva install 2 boot? edit boot.ini/grub /boot device or NoMoreReinstallMS Linux - Newbie 1 08-09-2006 04:34 AM
Using grub to boot.. How do I edit to get mandrake to boot? rrfish72 Linux - General 3 10-29-2004 02:00 AM
How do I edit the grub boot in SuSE Linux trespasser Linux - Newbie 3 04-12-2004 12:58 PM


All times are GMT -5. The time now is 04:07 AM.

Main Menu
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