XP Won't Boot After Upgrade to 10.04 LTS in Dual-Boot System

Asked by Steve Hensley

Two-drive system: "OS" /dev/sdb and "DATA" /dev/sda
Windows XP is /dev/sdb1
Ubuntu 10.04 LTS is /dev/sdb2

Before upgrading to 10.04, I could dual-boot into Windows. Now I can't.

Based upon what I saw here (https://answers.launchpad.net/ubuntu/+question/108090), I tried a few things:

I tried "sudo update-grub". It "finds" Windows XP on /dev/sdb1, but it doesn't seem to fix anything.

Trying "grub --version" gets me: "The program 'grub' is currently not installed...."

I tried "sudo mount /dev/sdb1 /mnt" and "sudo grub-install --root-directory=/mnt/ /dev/sdb" and ".../dev/sda". They both install without errors. The /dev/sdb one didn't solve anything, while the /dev/sda one left me with a "grub" prompt and no way to boot anything now (as far as I know). I'm downloading the .ISO to create a LiveCD now. (I upgraded to 10.04 from within 9, since it gave me that option, so I don't have an install CD.)

I know there are a LOT of problems with dual-boot systems and upgrades, but I couldn't find anything specific to my issue. I'm new to Linux, but not PCs.

Does anyone have any ideas?

Thanks in advance....

Steve

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Steve Hensley (planete) said :
#1

I was able to use the LiveCD to re-install grub and get my boot menu back. I still can't load to Windows though.

Revision history for this message
eric tennant (erictennant) said :
#2

Question, are you using 2 seperate Hard drives, or a single hard drive that is Partioned.??

Revision history for this message
Rajinder Sandhu (sandy744) said :
#3

can you boot into xp with XP installation/ recovery disk and then run fixmbr
 after that you can run sudo update-grub in ubuntu.terminal

Revision history for this message
eric tennant (erictennant) said :
#4

Hi, my problem has been solved, using the Bios to boot from the Linux
disk, Thanks.
Eric Tennant

Revision history for this message
Steve Hensley (planete) said :
#5

Eric, I'm using 2 separate hard drives. The "DATA" drive has just one NTFS partition. The "OS" drive has an NTFS partition and the Linux partitions.

Just out of curiosity, did you mean to post your note about "using the BIOS" to fix your problem in another thread? That's not related to this.

And can someone tell me why the status of this is set to "Answered"? This hasn't been resolved yet.

Is there a problem with this forum where messages get posted into the wrong threads?

Revision history for this message
Steve Hensley (planete) said :
#6

can you boot into xp with XP installation/ recovery disk and then run fixmbr after that you can run sudo update-grub in ubuntu.terminal

I was able to run fixmbr from the XP install CD. It warned me about a "non-standard" partition and boot record, but I overwrote it, anyway. Went into Ubuntu, ran "sudo update-grub". No errors; still doesn't work after rebooting.

Revision history for this message
Steve Hensley (planete) said :
#7

Should I worry that Ubuntu still says "grub is not currently installed"?

Revision history for this message
delance (olivier-delance) said :
#8

Can you do :
    sudo parted -l; cat /etc/fstab
and post result.

P.S.: a question answered is marked "answered" and a one solved "solved". "Answer" means question was answered and that you have not posted yet.

Revision history for this message
Steve Hensley (planete) said :
#9

Thanks for the clarification, delance!

Here are the results:

steve@linux-desktop:~$ sudo parted -l; cat /etc/fstab
Model: ATA WDC WD400EB-11CP (scsi)
Disk /dev/sda: 40.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 40.0GB 40.0GB primary ntfs boot

Model: ATA WDC WD1600JD-00G (scsi)
Disk /dev/sdb: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 117GB 117GB primary ntfs boot
 2 117GB 160GB 42.9GB extended
 5 117GB 158GB 41.1GB logical ext4
 6 158GB 160GB 1810MB logical linux-swap(v1)

Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
has been opened read-only.
Error: /dev/sr0: unrecognised disk label

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda5 during installation
UUID=5fc9894d-cbeb-4f46-9618-107cfc8ff762 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=d4329c5c-3b39-418a-a73f-74a794bf2d75 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
steve@linux-desktop:~$

Revision history for this message
delance (olivier-delance) said :
#10

Grub > 1.97 alias Grub2 - boot neither XP or Ubuntu
                      /dev/sda: 40.0GB - DATA
 1 40.0GB primary ntfs boot <= partition should not be boot-able
                      /dev/sdb: 160GB
 1 117GB primary ntfs boot <= XP
 5 41.1GB logical ext4 <= whole linux
 6 1810MB logical linux-swap(v1)

"Should I worry that Ubuntu still says "grub is not currently installed"?" => means you have probably grub 1.97 (or 1.98) installed

1) With Administration->Système->GParted, could you remove boot flag from /dev/sda1 partition.
    Unmount /dev/sdb1 and /dev/sdb5
    And also put label "XP" on /dev/sdb1.
    And also put label "Ubuntu" on /dev/sdb5.
Then reboot to take into account new label (or run "mount" and check partition are under media with new names).

2) http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html#Re-install_GRUB_from_Live_CD

ls /media/XP # you should see content of your XP partition (which one with OS)
ls /media/Ubuntu # you should see content of your Ubuntu disk (which one with OS)
sudo grub-setup -d /media/Ubuntu/boot/grub /dev/sda # boot config on Ubuntu partition but MBR on first disk in BIOS order

3) Reboot, you are supposed to get at least Grub at startup and to be able to boot Ubuntu

4) If XP doesn't boot, can you result of post
         tail -20 grub.cfg

Revision history for this message
delance (olivier-delance) said :
#11

Sorry, but Launchap doesn't keep formating of message.
For (2), the commands are:

ls /media/XP
ls /media/Ubuntu
sudo grub-setup -d /media/Ubuntu/boot/grub /dev/sda

Revision history for this message
Steve Hensley (planete) said :
#12

I'm sorry, delance, but I don't know what "ls /media/XP" and "ls /media/Ubuntu" mean. Is that a command to label the drives or something?

Also, this configuration as it appears right now worked just fine before the upgrade. I don't mind removing the boot flag from the DATA drive and labeling the other partitions, but is that really necessary when all of this worked the day before the upgrade?

Ubuntu boots just fine, by the way, and I have whichever version of grub that comes with 10.04. I would have thought that a command to check the version of grub would tell me the version, regardless of which version it is. I wouldn't think the command would tell me grub isn't installed when it clearly is. Is this a flaw?

I'll try what you've suggested and let you know, but just so I can learn from this, I'm wondering why the configuration I have wouldn't work after the upgrade when it did before the upgrade.

Thanks.

Steve

Revision history for this message
Steve Hensley (planete) said :
#13

I was able to remove the boot flag from the DATA drive, and I was able to label /dev/sdb1 "XP". But I was not able to unmount the Ubuntu partition to label it. GParted said I'd have to do that manually, and I don't know how to do that.

I did reboot, but I still can't boot to XP. I can choose it (as I've always been able to do), but after 2 seconds of black screen, it comes back to the same boot menu, where it defaults to Ubuntu.

How do I unmount the Ubuntu partition when I'm actually using it, or is there another way to label it? I suppose I could use the LiveCD if I had to...but is that really necessary?

Thanks.

Steve

Revision history for this message
delance (olivier-delance) said :
#14

1-"ls /media/XP" and "ls /media/Ubuntu" are command in a terminal to display content of a folder.
2-The boot flag on DATA drive is useless, as you will not boot on this disk, and is a useless complexity. It should not be taken into account in theory,...but only in theory. The simpler is the best. But it is not mandatory.
3-Labeling is just to be able to know what is name of disk under media. If you provide me the result of "ls /media", I don't need it.
4-The command to know version of Ubuntu exist, but is well hidden in documentation. And in Grub2, this command is not accessible via "man grub".
5-I'm wondering why the configuration I have wouldn't work after the upgrade when it did before the upgrade. => some bug in Grub2 update process, but I'm not from developing team.
----------------------------------------------------------------------------------
6-But I was not able to unmount the Ubuntu partition to label it. Yes, as you currently use this partition, you can't unmount branch on which you are sitting! Gparted is more clever than me! Solution will be to use LiveCD. But I can work without label, if you provide the result of command "ls /media" or open folder "media" and tell me the names of disk
----------------------------------------------------------------------------------
You can boot on Ubuntu partition on disk, you have XP entry in Grub menu but XP boot failed.
Perhaps Ubuntu try to use /dev/sda as
   - it is a NTFS partition
   - it was boot-able, so presumed to host XP kernel
Can you try command (after booting on Ubuntu disk partition):

   sudo grub-install /dev/sda

If it fails, after problem is to repair XP boot. XP is presumed to be always installed on first disk. Grub1 did a logical switch of both disk before calling XP boot-loader. perhaps Grub2 missed this step. I build in a Virtual Machine such a configuration. I will check configuration files now.

Revision history for this message
delance (olivier-delance) said :
#15

Can you type:
      grep 30_os-prober -A 10 grub.cfg
and post result.

I get:

delance@delance-desktop:/boot/grub$ grep 30_os-prober -A 10 grub.cfg
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
 insmod ntfs
 set root='(hd1,1)'
 search --no-floppy --fs-uuid --set eee0f04ce0f01c91
 drivemap -s (hd0) ${root}
 chainloader +1
}
### END /etc/grub.d/30_os-prober ###

In this file (Ubuntu on first disk, XP on second one), you see:
      on /dev/sdb1 => right partition
      set root='(hd1,1)'
      drivemap -s (hd0) ${root} => these two lines set second disk as first one, XP boots only on first disk
      chainloader +1 => call the boot-loader on sdb1

Revision history for this message
Steve Hensley (planete) said :
#16

Delance, you asked, "Can you try command (after booting on Ubuntu disk partition): sudo grub-install /dev/sda"?

Should I be trying to install grub on /dev/sdA when XP and Linux are on /dev/sdB?

One of the times when I tried to install grub on /sdA, I couldn't even load Linux when I was done. I had to use the LiveCD to fix that.

I tried " grep 30_os-prober -A 10 grub.cfg" in the Terminal. It didn't work. I tried again after mounting the XP partition and the DATA partition. It still didn't work. Here are the results:

steve@linux-desktop:~$ grep 30_os-prober -A 10 grub.cfg
grep: grub.cfg: No such file or directory
steve@linux-desktop:~$

Revision history for this message
delance (olivier-delance) said :
#17

At boot, the BIOS load a small program on first disk, which is called MBR. This small program must load after Linux which is on second disk. So, yes, this new MBR must be installed on /dev/sda.

I apologize for command, I didn't use full pathname:
       grep 30_os-prober -A 10 /boot/grub/grub.cfg

Revision history for this message
Steve Hensley (planete) said :
#18

delance,
Thank you for your patience with me. I'm new to Linux, but I've been building and maintaining PCs for 15 years. This Linux stuff is just throwing me for a curve--especially since it used to work with the same configuration.

Do you think it would help if I just disabled the DATA drive in the BIOS? The OS/XP drive is set within the BIOS as the primary boot drive. It is not the first hard drive seen, but that's a limitation of the BIOS--and I guess grub (or Linux, or whatever) doesn't like that. I can disable it until this is resolved and then re-enable it from within the BIOS. Please let me know if you think that would help.

Here's the result of what you wanted to see:

steve@linux-desktop:~$ grep 30_os-prober -A 10 /boot/grub/grub.cfg
### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
 insmod ntfs
 set root='(hd1,1)'
 search --no-floppy --fs-uuid --set 2c8ca9d38ca9983a
 drivemap -s (hd0) ${root}
 chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###
steve@linux-desktop:~$

Thanks again!

Steve

Revision history for this message
delance (olivier-delance) said :
#19

On a virtual machine, with XP on second drive, I get:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
 insmod ntfs
 set root='(hd1,1)'
 search --no-floppy --fs-uuid --set eee0f04ce0f01c91
 drivemap -s (hd0) ${root}
 chainloader +1
}
### END /etc/grub.d/30_os-prober ###

i.e. same result!
--------------------------------------------------------------------------------------------------
Do you think it would help if I just disabled the DATA drive in the BIOS? YES. I see any simple way of doing, and I am a little lost.
First step should be to restore XP as first OS on first disk, and to try later to reinstall Grub2.
If you have a XP repair CD, you can start to search it!

1) Removing first disk (BIOS or physical unplug)
2) Verify that XP boot directly when 160GB is first disk.
3) If not, use XP repair CD to repair MBR
4) If not and no CD to repair
http://www.intowindows.com/repair-windows-xp-vista-windows-7-without-installation-cddvd/
5) Verify that XP boot directly when 160GB is first disk.
6) Why do you have 40GB disk as first disk ? Configuration 160GB then 40GB is more common, and so more tested.

Revision history for this message
Steve Hensley (planete) said :
#20

Well, disconnecting and disabling the 40 GB PATA drive didn't help. Now I get a short message about a grub command-line interface. This happened before, and I needed to use the LiveCD to restore everything--at least to the point where I could boot Linux again.

The 40 GB drive shows first because of the BIOS. It reads parallel drives before SATA ones, for some reason. I can't change it in the BIOS, unless I just want to disable the PATA drives--and that includes the DVD-RW drive. The computer is about 4 years old, but I've updated it to the most recent BIOS.

I have the XP install CD, and I've repaired the MBR once already for this process, but it didn't help. I'm pretty sure the drive would boot to XP if grub wasn't installed or causing problems. I don't know how to switch to a different boot loader, so I'm stuck with grub, I guess.

Is there a way to remove Linux and grub completely? I don't really have anything on the Linux partition yet. I was just testing Linux. I just don't want to lose my XP installation. I could re-install Linux (though I'd rather not), but I don't want to have to re-install XP. If there's no clean way to remove Linux and grub without making the drive unable to boot, I'd rather not do that, of course.

Thanks!

Steve

Revision history for this message
Rajinder Sandhu (sandy744) said :
#21

hi Steve
seems...lot of research but no satisfactory result...can you put up your question a fresh with all the details you have done on your system...as in my last reply I asked you to boot with xp installation disk to recover your booting by using fixmbr ...after that i went on long leave and when i checked there are too many things to understand what went wrong...you asked me about vista ...it was not installed after reading public opinion that it sucks...
your problem is suppose to be far too small than the list of research going on.
Thanks
Rajinder

Revision history for this message
delance (olivier-delance) said :
#22

Grub dislikes mixture of PATA and SATA drives, which could explains problem.
So you have keep both disks in same order.

If you have reinstalled MBR from Windows CD (with 40GB disk disconnected), you should have erased Grub and boot directly to XP.
"Is there a way to remove Linux and grub completely?" Yes, installing Windows MBR with Windows CD!!

Situation is not clear for me. 40GB is older disk, on which Windows was installed previously. It looks you installed later Windows on 160GB (and in this case with 40GB disk unplugged), and after you installed Ubuntu. Can you confirm it ?

Revision history for this message
Rajinder Sandhu (sandy744) said :
#23

and you need to connect both the hdd then in the bios select what was set earlier if 40 gb hdd was your master then make it master and then boot with xp cd and carry out fixmbr....in case it does not work then go for repair if that also fails then only reinstall XP OS on the same windows partition ie C:/windows your all the data of XP will be safe and usable... Let us first restore XP then will guide you to changing over to ubuntu
regards
Rajinder

Revision history for this message
Steve Hensley (planete) said :
#24

Gentlemen, thank you again for trying to help.

I'm going to try to clear up some of the confusion here and reiterate some of the things I've already said, just to be sure we're all on the same page.

The 40 GB PATA drive is the only drive on that cable. Windows was never installed on it; it's only formatted as an NTFS drive. The jumpers are set to Cable Select. The DVD-RW drive is the primary/only drive on its cable. It is on the secondary PATA cable. It is also set to Cable Select.

The 160 GB SATA drive is the only SATA drive in the system. The BIOS looks at it first for booting. The only reason the BIOS would try to boot from the 40 GB drive was if the SATA drive failed. Since there is no operating system on the 40 GB drive, the BIOS would not be able to boot Windows or Linux, anyway.

I REALLY don't want to have to re-install XP. It was working just fine before I upgraded Linux. I use the XP installation, and re-installing it just to fix Linux is not worth it. I'd rather just remove Linux. I can re-install that if necessary.

I'm not sure what delance means by "installing Windows MBR with Windows CD!!" as an answer to my question yesterday about how to remove Linux and grub completely without destroying XP. FDISK /MBR will not remove grub. On May 27, I ran FDISK /MBR in an attempt to fix this whole boot problem. Here's what happened:

"I was able to run fixmbr from the XP install CD. It warned me about a "non-standard" partition and boot record, but I overwrote it, anyway. Went into Ubuntu, ran "sudo update-grub". No errors; still doesn't work after rebooting."

If there's a way to completely remove Linux and grub without destroying my Windows XP partition, please let me know.

Thanks again for your help.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#25

Sorry i don't have time to read this complex thread but based on the first original question... you have:

Two-drive system: /dev/sda and /dev/sdb

Labelled:

- "OS" /dev/sdb
- "DATA" /dev/sda

on /dev/sdb you have:

Windows XP is /dev/sdb1
Ubuntu 10.04 LTS is /dev/sdb2

Please boot your pc from Ubuntu live cd and using the System → Administration → gparted tool please delete the /dev/sdb2 partition (i mean the Ubuntu ext4 partition and other /dev/sdb.. marked as swap partition , please first right click on the swap partition and select swapoff) then apply the pending operation.

Shutdown you pc.

Then please put your OS driver as primary and your DATA disk as secondary using bios or change internal disk jumpers.

Be also sure there are not any bios master boot record virus protection active.

Then using the Window install cd please install or fix the mbr on the Windows disk now the primary disk.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/bootcons_fixmbr.mspx?mfr=true

Try to start Window... then install Ubuntu from live cd by selecting the unused space at install step.

This is my usual install configuration when i install Ubuntu in dual mode and it never fails.

Hth

Revision history for this message
Rajinder Sandhu (sandy744) said :
#26

or you can change the bios priority to booting from 160 GB so it will check 160 GB hdd for booting and start the next sequence. As Mr.Marcobra has mentioned above .how to remove ubuntu and then recovering/fixing your XP with reference link.
that should fix it...atleast after removing Ubuntu now you can boot with xp cd and then fix the mbr by fixmbr command and then reboot the pc without cd and then see if it starts xp..
Be assured your data is safe....even if we go on the last stage of reinstalling XP your data remains intact, you will loose nothing. but may be another image of XP running the previous can be deleted later on when everything is working fine. .
regards
Rajinder

Revision history for this message
delance (olivier-delance) said :
#27

Sorry, but you have an unusual configuration with a PATA and a SATA disks, and a boot which goes first on SATA.
The procedure given by Marco Braida looks good, as this configuration can confuse:
   myself !
   XP repair CD
   and Ubuntu.
Some versions of XP repair CD refuse to put Windows boot in MBR if they detect non windows partition on a disk.

So as explained Marco:
   - you have to remove non Windows partition, both /dev/sdb2 and /dev/sdb6
   - you have to remove PATA disk so Windows repair CD will put MBR on first disk, and first disk will be SATA disk (I don't know how behave XP CD with PATA disk)
After Ubuntu see your PATA disk as first disk, so if after reinstalling Ubuntu you boot directly on XP, you'll have to force Grub2 to install its boot in MBR of second disk.

Revision history for this message
Steve Hensley (planete) said :
#28

I appreciate the help everyone has tried to give me, but I think the "language" issue was complicating this to the point where it is now just too far gone. I've repeated some things I've said a few times, and yet no one seems to understand. Thanks anyway, but I'm not going to try to resolve this.

Please understand that--as I said earlier--FIXMBR (or FDISK /MBR) does not solve this problem or remove the boot loader. The FIXBOOT command does. It is accessed from the Windows Recovery Console.

I have deleted the Linux partitions and kept my XP partition and data. I kept the hard drives the way the BIOS configures them by default. I understand Linux/grub doesn't "like" this, but that's just too bad.

I am a proponent of open-source software and the entire open-source community. I recommend open-source software to my clients whenever possible. I was hoping to test Linux to see if it would be a good "fit" for my clients. Unfortunately, I still can't recommend it. Windows XP, Vista and 7 have more than their share of problems, but I won't be able to convince anyone to switch if they have problems like this.

Thank you all again for your time and patience. You can consider this problem "solved" if you'd like, but to me, reformatting partitions and re-installing an operating system is not a "solution".

Steve

Can you help with this problem?

Provide an answer of your own, or ask Steve Hensley for more information if necessary.

To post a message you must log in.