Dual boot XP Ubuntu - 2 disk

Asked by delance

Daniel said 14 hours ago:

I have a similar problem in that after re-installing grub in Ubuntu 9.10 on /dev/sda (Windows XP hard drive), I'm unable to boot into Windows. I tried using the Windows XP cd to repair the mbr but the cd just hangs up. Also tried restoring Windows MBR using "sudo install-mbr" which also didn't work. I found a reference to "install ms-sys" which is supposed to write Microsoft compatible boot records but I couldn't find this app. It's not listed in the Synaptic Package Manager. I have Ubuntu 9.10 installed on a second hard drive. Does anyone have a solution to this problem? I want to restore the Windows MBR without having to completely re-install Windows.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

You can fix MBR with Windows or with Ubuntu.

1) Windows - the logical way
Insert installation or repair Windows CD. Boot on it. Then
          FDISK.EXE /MBR

2) Linux - the other way
Now ms-sys is not in Ubuntu repository.
You should download it at
         http://packages.debian.org/etch/i386/ms-sys/download
Double-click on package to install it. And after
        sudo ms-sys -m /dev/sda

Check you can boot on Windows.
Check you have grub2 menu (which is less probable).
Else we will have to play with Live CD!
We can't install dual boot if Windows doesn't boot. Else Grub2 will be unable to detect Windows.

After the best is to switch both disk, and to install Ubuntu on new first disk.

Revision history for this message
Tom (tom6) said :
#2

Hi :)

Please can you copy this link
https://answers.launchpad.net/ubuntu/+question/111624
into that thread so that Daniel can get his answer from here. Ideally it would be good if he could subscribe to this thread.

Also it would be handy to get the link into the thread where Daniel posted his question
Thanks and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#3

I tried "ms-sys" [sudo ms-sys -m /dev/sda] but still can't boot either system. When I try to boot I get a screen showing " MBR 123FA:" but system is unresponsive. I tried booting using Windows XP cd but it doesn't respond either. It loads the cd and shows, "press any key..." but hangs up and won't boot. I'm only able to boot Ubuntu from floppy.
Is there a way to make the Windows XP cd work?

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

You should be able to boot on Windows XP CD or from Ubuntu CD, so you have a problem.
Can you check the order of devices in your BIOS ?
Perhaps you have hard disk before DVD.

@Tom, I'm afraid you are right. It becomes a little complicated to manage.

Revision history for this message
Tom (tom6) said :
#5

Hi :)

@ David, please subscribe to this thread to save having to keep checking the thread for updates. Once you subscribe you will automatically be sent any comments as emails directly to you. To subscribe please see up at the top right-hand corner of the thread, somewhere around there.

@ Delance, in helping people we sometimes have to do things that are a little unusual. The aim is to help people get used to asking questions in the forums and to try to make it easier for them to do so. Sometimes things do go a little wonky but everyone benefits when they see you have gone the extra mile as you have done here. It is appreciated :)

@ David if a number of different Cds are failing in the cd/dvd-drive then could you try another cd/dvd-drive, perhaps an external one, perhaps one salvaged from an old 'dead' machine or borrowed. Please also have a look to see if the underside of the Cds are particularly badly scratched (we can try to advise on how to deal with that) or if the Cds have become dirty as happens over the years. Please let us know!

Good luck and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#6

When I boot up I can press the "esc" key which brings up the boot menu wherein I can choose which device I want to boot from, ie hdd, cd, floppy. Anyway, let me backtrack a bit. I had Windows XP working fine until the latest kernel updates for 9.10 came out. At that time I had Windows booting normally and had to boot Ubuntu from floppy. I decided to re-install grub so that I could take advantage of the latest kernel update. I was able to re-install grub by mounting the boot partition and running "sudo grub-install --root-directory=/media/root /dev/sda". After that I was unable to boot windows but Ubuntu booted without having to use floppy disk. That brings me to where I am now. After this, I tried "sudo install-mbr" and "sudo ms-sys" to no avail.
Hope this gives you enough information to figure this out.
I did subscribe to this thread, thanks for pointing that out, Tom.

Revision history for this message
Tom (tom6) said :
#7

Hi :)

Ahah, this question is different from what i previously thought. If you can boot into Ubuntu that is installed on the hard-drive then this 'should' be easier. First we need the results of

sudo fdisk -l

where "-l" is a lower-case "-L" then we could help guide you through the process outlined in this guide
https://help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD
except that we don't need to use the LiveCd session and so we also don't need to reboot before doing the

sudo update-grub

at the end. Hopefully this should fix it but i have a funny feeling that it wont work quite as smoothly as it 'should'. I have a feeling that you might well end up in exactly the same position afterwards but at least we will know that we have done the right things from the right places.
Good luck and regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#8

Hi again :)

The previous thread was this one, i think?
https://answers.launchpad.net/ubuntu/+source/firefox/+question/111124
but there are significant differences (hopefully) and we have not yet reached the stage of having nothing else left to try except using the Windows Cd to fix it's own boot-loader before re-fixing our own one. I think first is to re-install grub2 when booted into the hard-drive install of Ubuntu. We only reach the stage of needing the Windows Cd if the grub2 does list Windows (&made sure it is correctly listed) and Windows still not co-operating. So we are quite a long way from that and we have plenty of chance to get lucky before we get there :)

Good luck and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#9

Hi Tom,
Here's the output from "sudo fdisk -l"

daniel@daniel-desktop:~$ sudo fdisk -l
[sudo] password for daniel:
Disk /dev/sda: 163.9 GB, 163928604672 bytes
240 heads, 63 sectors/track, 21175 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Disk identifier: 0x02730272

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 771 5828728+ b W95 FAT32
/dev/sda2 772 21174 154246680 f W95 Ext'd (LBA)
/dev/sda5 772 21174 154246648+ 7 HPFS/NTFS

Disk /dev/sdb: 40.0 GB, 40027029504 bytes
255 heads, 63 sectors/track, 4866 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2006c604

   Device Boot Start End Blocks Id System
/dev/sdb1 1 4379 35174286 83 Linux
/dev/sdb2 4380 4866 3911827+ 5 Extended
/dev/sdb5 4380 4866 3911796 82 Linux swap / Solaris

By the way, I upgraded from Ubuntu 9.04 to 9.10 which means that I still have grub, not grub2. Right?

Revision history for this message
Daniel (djr1215) said :
#10

I just ran "grub-install -v" and it showed that I have GRUB 0.97

Revision history for this message
Tom (tom6) said :
#11

Daniel

Brilliant move :) yes, you have grub1 not grub2 and because it is 9.10 you now have an easy choice of remaining with grub1 or moving to grub2. I would probably suggesting trying to fix this with the grub1 technique first. However since we are all moving to grub2 i will give the grub2 answer first

For grub2

sudo mount /dev/sdb1 /mnt

sudo grub-install --root-directory=/mnt/ /dev/sda

Notice that there are 3 spaces in each line. Most people forget the space before and after "/dev/sdb1" & "--root-directory=/mnt/". Note that this will "fix" the Mbr to point at the linux boot-loader. It also installs grub2 to your /boot/grub folder (where it should be) rather than the weird experimental area that 9.10 tried to use as an intermediate step before the proper wide-scale adoption of grub2. Finally this next command should put the changes into grub2 and force it to scan for other operating systems.

sudo update-grub

Now the option to boot into Windows should be in the boot-menu and hopefully that should let you boot into Windows now.

For grub1

This link
https://help.ubuntu.com/community/WindowsDualBoot#Ubuntu%209.10%20&%20earlier
which says to run these commands

sudo grub

find /boot/grub/stage1

This should give the result "hd(1.0)" if it says anything else then the next few commands need to be changed

root (hd1,0)

setup (0)

quit

The "quit" should get you back onto a normal command-line again rather than the grub one you have been using since the "sudo grub" command
Good luck and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#12

Tom,
I tried the grub1 option which restored my grub and enables me to boot Ubuntu normally but I still can't boot Windows. It shows up on the menu.lst for grub but won't boot. Is there any other way to restore Windows? I tried the Windows cd but it just hangs up. I'm thinking I should try unplugging the hard drive with linux and try booting Windows with the cd in the other drive.

Revision history for this message
Daniel (djr1215) said :
#13

I just ran across this thread on an online forum that discusses the exact issue I'm having. It's at http://www.ozzu.com/mswindows-forum/won-boot-t73477.html. The solution seems to be to hide the linux boot partition as it interferes with being able to boot the Windows cd. If you could take a look at this thread and let me know if you think this would solve my dilemma I'd appreciate it.
By the way, I tried unplugging the linux hard drive and booting Windows from the other hard drive. Didn't work.

Revision history for this message
Tom (tom6) said :
#14

Hi :)

There are a few different issues that cause this type of problem & i don't know the forum you linked me to so i don't know how much i trust it. It looks like a reasonable set of answers. I worry about Windows forums sometimes as i have seen some really bad advice or stuff like "Look, ponies". I haven't checked out their thread thoroughly but skims nicely!

If you can unplug the linux drive and try out there answers then that would be ideal but please back-up your data first as the Windows answers often seem to end up reinstalling and wiping data. It does seem to be a Windows problem but i am sure i have read something in Community Documentation or in the release notes for 10.04 about this issue. I need to look it up but at the moment i have to go out, sorry chap.
http://www.ubuntu.com/getubuntu/releasenotes/1004

With one machine that would never boot from Cd i tried all the usual
https://help.ubuntu.com/community/BootFromCD
tricks and then tried unplugging all the hard-drives and ever since then it has happily booted from Cd (when asked to) no matter what has been plugged in. Almost as tho i had got the machine worried about it's long-term future! lol

Good luck and regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#15

Hi again

If you could copy&paste the menu.lst into here i could check that looks ok compared to your fdisk output when i get back from laundrette

Good luck and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#16

Here's the menu.lst copied (except for comments):

title Ubuntu 9.10, kernel 2.6.31-14-generic
uuid ca74f0df-0ba9-4e5b-8867-9257889273cf
kernel /boot/vmlinuz-2.6.31-14-generic root=UUID=ca74f0df-0ba9-4e5b-8867-9257889273cf ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
quiet

title Ubuntu 9.10, kernel 2.6.31-14-generic (recovery mode)
uuid ca74f0df-0ba9-4e5b-8867-9257889273cf
kernel /boot/vmlinuz-2.6.31-14-generic root=UUID=ca74f0df-0ba9-4e5b-8867-9257889273cf ro single
initrd /boot/initrd.img-2.6.31-14-generic

title Ubuntu 9.10, kernel 2.6.28-16-generic
uuid ca74f0df-0ba9-4e5b-8867-9257889273cf
kernel /boot/vmlinuz-2.6.28-16-generic root=UUID=ca74f0df-0ba9-4e5b-8867-9257889273cf ro quiet splash
initrd /boot/initrd.img-2.6.28-16-generic
quiet

title Ubuntu 9.10, kernel 2.6.28-16-generic (recovery mode)
uuid ca74f0df-0ba9-4e5b-8867-9257889273cf
kernel /boot/vmlinuz-2.6.28-16-generic root=UUID=ca74f0df-0ba9-4e5b-8867-9257889273cf ro single
initrd /boot/initrd.img-2.6.28-16-generic

title Ubuntu 9.10, memtest86+
uuid ca74f0df-0ba9-4e5b-8867-9257889273cf
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

title Other operating systems:
root

title Windows/XP
root (hd0,0)
chainloader +1
savedefault
makeactive

Revision history for this message
Daniel (djr1215) said :
#17

Is there any way to mount the boot partition (/dev/sda1) to find out exactly what's on it?
I looked at the Windows hard drive using Palimpsest Disk Utility and it shows /dev/sda1 as an "unrecognized" partition. Isn't that where the grub bootloader is located? Why would it show as "unrecognized"?

Revision history for this message
Tom (tom6) said :
#18

Hi :)

No, sda1 is a "Recovery Partition" for Windows and apparently it is used for making a "Recovery Cd" for Windows. So it doesn't have the boot-loader on it although somewhat weirdly it is marked as the boot partition by that little star. Ahh, you ,might be able to mount it using something like this

mount -t fat32 /dev/sda1 /media/sda1

but i would check that command by try

mount -h

to see that it looks about right.
Sorry i missed your posting the other day! I think the menu.lst looks just about right but i would put the "chainloader" part at the end of the Windows stanza. Actually now that i look at it the menu.lst is also pointing at sda1 as the boot-partition fro Windows. It could be the source of the whole problem. Ok, first lets back-up menu.lst and check we can see the back-up

cd /boot/grub
ls
sudo cp menu.lst menu.lst.270510
ls

Note "ls" is a lower-case "LS" and shows a list of what is in the dircetory/folder. The old "dir" also works but is less pretty and is not colour coded. The second time should show the new file "menu.lst.270510" has been added. Ok, now to edit the "menu.lst"

gksudo gedit menu.lst

you don't have to use gedit, just switch it for your favourite text-editor. I tend to use gedit because it is the basic one included in Ubuntu, just as "kate" is in Kubuntu. Ok, so for this first edit i would change the Windows stanza to this

title Windows/XP
root (hd0,0)
savedefault
makeactive
chainloader +1

Then save and reboot the machine to see if that works. If it doesn't then just edit menu.lst again (no need to back-up a second time) this time try this

title Windows/XP
root (hd0,4)
savedefault
makeactive
chainloader +1

Grub1 always counts from 0 so (0,4) refers to sda5 which is where the large Windows partition is. It is extremely unusual for any Windows to use a separate boot partition unless using a linux boot-loader. However it is very normal to have a recovery partition at the front of a Windows machine, particularly laptops but also many other machines nowadays. The Windows Recovery Cd is worth being able to access because it should contain all the drivers for the machine and they can be a bit painful to get by other means.

Sorry for the late reply!
Good luck and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#19

I tried all of the options you suggested. Nothing worked. I'll keep working on this on my own. Thanks for your help.

Revision history for this message
Tom (tom6) said :
#20

Hi

So it is booting into Ubuntu but just not quite starting up Windows?

Revision history for this message
Daniel (djr1215) said :
#21

Yes, that's correct.

Revision history for this message
Tom (tom6) said :
#22

Hi again :)
Looking back over my last long answer the

mount -t fat32 /dev/sda1 /media/sda1

wouldn't have worked because it needed to be sudoed i think? Try this instead

sudo mount -t fat32 /dev/sda1 /media/sda1

The password is your normal login password for the normal user on this system, not the Superuser, and you get no stars as you type. Now it should appear in your "Places" menu on the top taskbar/panel or in

cd /media
dir

Hopefully that should show something like an iso file or something that can be used to make a Windows Recovery Cd?
https://help.ubuntu.com/community/WindowsRecoveryCd#Have%20a%20Windows%20recovery%20CD/DVD%20available
Good luck and regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#23

Hi ?

Has the question been resolved yet or is it still a problem? If it is still a problem please could you re-post the question to the new team at Launchpad here?
https://answers.launchpad.net/ubuntu/+source/grub/+addquestion

Good luck and regards from
Tom :)

Revision history for this message
Daniel (djr1215) said :
#24

I was not able to resolve the problem with either the Linux or Windows solutions. Even the Windows Recovery tools wouldn't work. It gave me messages stating the the disk was "unreadable". I tried using the "fixmbr" command and the "fixboot" command--nothing worked. I finally gave up on trying to restore Windows and went ahead and reformatted the hard disk and reinstalled Windows. I believe the problem resulted from Grub overwriting the Windows boot sector and I was never able to recover it. There should be an easier solution for this problem than having to reformat the disk and reinstall the OS.

Revision history for this message
Tom (tom6) said :
#25

Hi

I am sorry to hear the troubles you went through to get Windows working on your system and i agree there should be an easier way
Many apols and regards from
Tom

Can you help with this problem?

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

To post a message you must log in.