LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Grub XP option reloads grub (https://www.linuxquestions.org/questions/linux-software-2/grub-xp-option-reloads-grub-809731/)

NDR008 05-24-2010 03:09 AM

Grub XP option reloads grub
 
Yesterday I installed EasyPeasy (an Ubuntu based distro) on my netbook.

Somehow I mucked up the installation of grub...

/dev/sda1 * 1 9407 75561696 7 HPFS/NTFS
/dev/sda2 9408 18813 75552769 5 Extended
/dev/sda3 18814 19451 5124735 1c Hidden W95 FAT32 (LBA)
/dev/sda4 19452 19457 48195 ef EFI (FAT-12/16/32)
/dev/sda5 9408 14271 39062528 83 Linux
/dev/sda6 14271 18689 35489792 83 Linux
/dev/sda7 18689 18813 998400 82 Linux swap / Solaris


/dev/sda1 = Windows Partition with XP
/dev/sda5 = My linux partition
/dev/sda3 = Windows Recovery stuff

Now, during the installation of EasyPeasy, I installed the bootloader on /dev/sda1 and NOT /dev/sda.

As a result, Windows was not available

So I then ran:
sudo update-grub

And an option to book /dev/sda1 came up as Windows XP.

However when I select /dev/sda1 Windows XP, it re-loads the bootloader itself.
What do I have to edit to (if possible) leave the bootlader in /dev/sda1 (dislike it being on the MBR out of fear of mucking the MBR up and making the whole system useless), and making the option /dev/sda1 Windows XP point to the actual boot up of Windows and not the bootloader itself?

menuentry "Microsoft Windows XP Home Edition (on /dev/sda1)" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7ae0a82de0a7ee17
drivemap -s (hd0) ${root}
chainloader +1

This is the entry that re-loads itself....

Thanks in advance.

business_kid 05-24-2010 05:05 AM

Quote:

Originally Posted by NDR008 (Post 3979118)
Y/dev/sda1 * 1 9407 75561696 7 HPFS/NTFS
/dev/sda2 9408 18813 75552769 5 Extended
/dev/sda3 18814 19451 5124735 1c Hidden W95 FAT32 (LBA)
/dev/sda4 19452 19457 48195 ef EFI (FAT-12/16/32)
/dev/sda5 9408 14271 39062528 83 Linux
/dev/sda6 14271 18689 35489792 83 Linux
/dev/sda7 18689 18813 998400 82 Linux swap / Solaris


/dev/sda1 = Windows Partition with XP
/dev/sda5 = My linux partition
/dev/sda3 = Windows Recovery stuff

When grub's screen comes up, hit the letter e
whatever line you had highlighted will come up. Hit e again, and you can edit that line. Then press return to finish, and b to boot from it.
I thing you may have a problem with disk numbering, or the location of your kernel.

syg00 05-24-2010 05:09 AM

Quote:

Originally Posted by NDR008 (Post 3979118)
...What do I have to edit to (if possible) leave the bootlader in /dev/sda1 (dislike it being on the MBR out of fear of mucking the MBR up and making the whole system useless)

Well you've already proven how wrong that attitude is.
The MBR is easy to fix - from both Linux and XP. On the other hand you have potentially over-written vital data within the XP partition. It certainly can't be fixed with a simple edit. Search for "fixmbr" here on LQ - this comes up all the time.
Even with "classic" grub couldn't always be recovered by the M$oft utility - I have no idea how many sectors grub2 overwites.

NDR008 05-24-2010 05:14 AM

Well, linux loads fine from GRUB (which I know realised is grub2), which is on /dev/sda5
Windows XP is on /dev/sda1 which on grub I gather would have been called hd0,0 but on grub2 is now referred to as hd0,1.

The hard disk pre-linux had 3 partitions:
XP Parition NTFS C:\
Empty NTFS D:\
hiden parition FAT32 used to restore windows on the netbook (since it has no CD-ROM)

I deleted the second partition, and created:
a partition /
a parition /home
and the swap parition

Grub gives:
Linux....
Linux recovery...
Memtest
Memtest (some variation of above)
Windows XP
Windows (the hidden parition)

They all load except windows XP. During the GUI installation of this distro, I chose to install /dev/sda1 which was the bootable partition.
I would even be happy removing grub completely off /dev/sda1 because I did not like this distro and want to go for nbr ubuntu.

Thanks again.

NDR008 05-24-2010 05:16 AM

Quote:

Originally Posted by syg00 (Post 3979226)
Well you've already proven how wrong that attitude is.
The MBR is easy to fix - from both Linux and XP. On the other hand you have potentially over-written vital data within the XP partition. It certainly can't be fixed with a simple edit. Search for "fixmbr" here on LQ - this comes up all the time.
Even with "classic" grub couldn't always be recovered by the M$oft utility - I have no idea how many sectors grub2 overwites.

Hehe, true, live and learn. I have done it this way in the past, but obviously, now it would seem MBR was the right way to go... *sighs*

Well, if I have no resort, I will just restore XP from the hidden partition, it is not the end of the world. Would rather not though.

NDR008 05-24-2010 05:45 AM

Got an idea I will try once I get home (why oh why did I not get my netbook, guess was assuming my (some overpaid) lecturers to be in on time at uni...)
Will make a USB drive with the XP recovery console.
Use the fixboot function
fixboot Drive:

Fingers crossed, will let you know, if anyone has any ideas, let us know please.

syg00 05-24-2010 05:52 AM

Yeah sorry, fixboot is what you need, not fixmbr. Was going to correct my post, but you picked up my error first.
G'luck - sometimes it works, sometimes not.

NDR008 05-24-2010 06:01 AM

When I had installed grub in the MBR and had issues many many years ago, it was fixmbr - and it is the most often recited step - so easy mistake there ;)

NDR008 05-24-2010 11:07 AM

After much searching and swearing because most USB pendrive bootable XP recovery consoles work on 2GB or less pendrives, I found a modern one:

Problem solved, follow this guide:
http://tuts4tech.net/2009/07/14/crea...overy-console/

With one modification, when you open a CMD to run BootSect.exe, open the CMD as administrator, because BootSect.exe will require very high level admin rights to the USB drive.

Reboot from USB pendrive on the netbook (or victim PC),
let the recovery console boot
select the windows installation damage

fixboot

Done! Then get ready to re-install a better Linux distro till you have the sanity to never go Windows again! ;)
If you want to keep the Linux installation you had and XP, I suggest re-installing the Linux Distro, some have a recovery function that re-installs the bootloader, just choose the MBR this time OR find a Windows resident and Windows based grub installation or other bootloader. ;)


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