Can't access XP after Ubuntu Feisty install

Asked by Qiming Liu on 2007-05-02

I am running on 1.8GHz P4 with 512mb RAM and ONE 40gb harddisk.

Before install I had four partitions to my harddisk, approx sizes were:

3gb FAT32 Partition 1
3gb NTFS Partition 2
16gb NTFS Partition 3
16gb NTFS Partition 4

I had XP Home edition SP2 installed on partition 3, and backed up everything from partition 4 to leave it for Ubuntu install.

I installed from the Ubuntu Feisty CD onto partition 4, re-formatting the partition to ext2 format and selecting partition 1 as the swap space.

the install process went smoothly and it did not touch partition 3 (which had the XP installation) at all.

now when I boot, grub does not give me a dual boot choice. I have edited menu.lst from the boot grub folder, adding the XP boot command (tried this for every partition number) and this still does not work.

It is frustrating because I can access all the files on my XP partition from ubuntu file explorer and I can see that the windows sytem folders are all intact and unchanged, but grub wouldn't boot it!

any help would be greatly appreciated.

QL

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Massimo Forti
Solved:
2007-05-06
Last query:
2007-05-06
Last reply:
2007-05-06
Massimo Forti (slackwarelife) said : #1

Thanks for your question, to undestand we can know your grub config. Can you post your /boot/grub/menu.lst file.

Thanks many

Qiming Liu (qooroo) said : #2

Please note that the partition numbers in my question are just for clarity and do not match the partition numbers below

I added the windows boot sequence just before the line:

### BEGIN AUTOMAGIC KERNELS LIST

hope this helps, thanks a lot.

QL

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 2

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

title Windows 95/98/NT/2000
root (hd0,5)
makeactive
chainloader +1

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=3001d075-cafa-4fc0-82a6-8a6dc9a0d7dc ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,6)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=1

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,6)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=3001d075-cafa-4fc0-82a6-8a6dc9a0d7dc 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,6)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=3001d075-cafa-4fc0-82a6-8a6dc9a0d7dc ro single
initrd /boot/initrd.img-2.6.20-15-generic

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

### END DEBIAN AUTOMAGIC KERNELS LIST

Massimo Forti (slackwarelife) said : #3

Why windows hd0,5, your partitions are primary or logical, if you have done 4 primaty partition you have winxp on hd0,3. Finally in consol you must do:

$: sudo sudo update-grub

to update the grub boot loader.

thanks

Qiming Liu (qooroo) said : #4

thanks for your reply.

my partition numbers are very messy because I've sectioned off other parts...long story.

I've tried windows hd0,0 hd0,1 hd0,2 hd0,3 hd0,4 hd0,5 already, and they all do not work :(

QL

Riku Eskelinen (kingi89) said : #5

This could be some weird kind of problem with WinXP boot loader. If, for example, GRUB has overwrote XP's boot loader at hd0,0 and now Windows is unable to boot. I'm not sure, though. You might choose to recover WinXP's boot loader by doing Recovery Install from XP Installation media, and then try to install GRUB again from Alternate Install CD.

Qiming Liu (qooroo) said : #6

I'm trying to make this work because I don't really want to reinstall every program on my XP partition. Does a recovery install damage the programs already installed on windows? thx

Massimo Forti (slackwarelife) said : #7

I can ask to post the result of:

$: sudo cfdisk /dev/sda

thanks

Riku Eskelinen (kingi89) said : #8

Qiming Liu: "Does a recovery install damage the programs already installed on windows? "
Nope, it just reinstalls Windows' fatal system files (including the boot loader). But DO NOT select R to use Recovery Console, but accept EULA and select the Win partition and then select Recovery. More info: http://www.michaelstevenstech.com/XPrepairinstall.htm

Qiming Liu (qooroo) said : #9

this looks promising :)

                                  cfdisk 2.12r

                              Disk Drive: /dev/sda
                        Size: 40020664320 bytes, 40.0 GB
              Heads: 255 Sectors per Track: 63 Cylinders: 4865

    Name Flags Part Type FS Type [Label] Size (MB)
 ------------------------------------------------------------------------------
                            Pri/Log Free Space 8.23
    sda5 Logical NTFS 2681.45
                            Logical Free Space 518.20
    sda6 Logical NTFS [] 16787.80
    sda7 Logical Linux ext2 16796.03
    sda2 Boot Primary Linux swap / Solaris 3224.31

     [ Help ] [ New ] [ Print ] [ Quit ] [ Units ]
     [ Write ]

                               Print help screen

Massimo Forti (slackwarelife) said : #10

You have a big mistake !!! you have sda5,6,7 logical and sda2 on the end of yuor h.d. primary. It's not a good situation, the standard is primary partition in the fisrt sectors, not in the end.
But we can try to resolve it. Now change you menu.lst with:

hd(0,6)

than

$: sudo sudo update-grub

after reopen the cfdisk and choose sda2, disable the boot option [boot] and enble it on sda7

thanks

Qiming Liu (qooroo) said : #11

really appreciate this.

2 quick qs: "But we can try to resolve it. Now change you menu.lst with: hd(0,6)" like this:

title Windows 95/98/NT/2000
root (hd0,6)
makeactive
chainloader +1

and "after reopen the cfdisk and choose sda2, disable the boot option [boot] and enble it on sda7" do select "write" option after I change the boot flag settings?

thank you so much.

Massimo Forti (slackwarelife) said : #12

Yes, perfect.

thanks

Massimo Forti (slackwarelife) said : #13

No, no write change. Not do it

Qiming Liu (qooroo) said : #14

I have unselected "boot" on sda2 and I have selected "boot" on sda7.

Should I now select [Write] ? If I do it says:

     Are you sure you want write the partition table to disk? (yes or no):

                 Warning!! This may destroy data on your disk!

which looks frightening. is this the right thing to do?

and after I do this should I restart my computer normally?

thx a lot

Massimo Forti (slackwarelife) said : #15

don't write, it is not importatnt, we try to change it after, don't worry

Sorry for my erros, but I'm tired

thanks

Qiming Liu (qooroo) said : #16

"after reopen the cfdisk and choose sda2, disable the boot option [boot] and enble it on sda7"

I cannot do this without selecting [Write], I think.

If I change the boot flag from sda2 to sda7 and select [Quit], the change is not saved.

I really appreciate your help.

Massimo Forti (slackwarelife) said : #17

Hi, yes, if you don't select write you can nor change the boot partition, but it's no so importat now. What is important is to boot your windows xp.
I read well you post today (yesterday night I was very tired sorry), you windows xp is in the second partition of you pc (sda6), this because the linux partition works in this mode:

(hard disk configured on IDE 1 master in ubuntu 7.04)
sda1 (1° partition of primary) (grub hd0,0)
sda2 (2° partition of primary) (grub hd0,1)
sda3 (3° partition of primary) (grub hd0,2)
sda4 (4° partition of primary) (grub hd0,3) (usually an extended partition)

after this you are not be able to do primary partition, you must use logical partition and it works in this mode:

sda5 ---> logical partition
        sda6 (1° partition of logical) (grub hd0,4)
        sda7 (2° partition of logical) (grub hd0,5) (I was tired, it's hd0,5)
        [.....]

logical is a big container of partition, if you want delete it you must delete before the partitions under and after the logical.
I hope th have axplained the concept. (You can find more information here: http://www.novell.com/documentation/suse91/suselinux-adminguide/html/ch07s04.html)

But you have set the sda1 an extended partition (probably when you have installed win) this has cused you logical partition in first part of your hard disk.

Now you have write well istruction:

title Windows 95/98/NT/2000
root (hd0,5)
makeactive
chainloader +1

You insert it in your menu.lst, reinstall grub with:

$: sudo sudo update-grub

and reboot.

let me know.

thanks

Qiming Liu (qooroo) said : #18

Hi :) after writing

title Windows 95/98/NT/2000
root (hd0,5)
makeactive
chainloader +1

rebooted, does not work :( "Error 12: Invalid device requested"

I have tried this for hd0,0 hd0,1 hd0,2 hd0,3 hd0,4 as well, and get the same message (or "partition does not exist") EXCEPT for hd(0,1) which gives "Error 13: Invalid or unsupported executable format"

I'm also not sure about this:

sda1 (1° partition of primary) (grub hd0,0)
sda2 (2° partition of primary) (grub hd0,1)
sda3 (3° partition of primary) (grub hd0,2)
sda4 (4° partition of primary) (grub hd0,3) (usually an extended partition)
sda5 ---> logical partition
        sda6 (1° partition of logical) (grub hd0,4)
        sda7 (2° partition of logical) (grub hd0,5) (I was tired, it's hd0,5)
        [.....]

If you look in my menu.lst at the Ubuntu boot sequence, it has

title Ubuntu, kernel 2.6.20-15-generic
root (hd0,6)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=3001d075-cafa-4fc0-82a6-8a6dc9a0d7dc ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
quiet
savedefault

I don't know where hd(0,6) is...

Massimo Forti (slackwarelife) said : #19

If you want to reinstall GRUB

Insert your ubuntu live cd and let it boot into GNOME desktop. Now open a terminal

Code:
$ sudo grubthe above will put you into grub shell. in grub shell enter these commands

Code:
grub> find /boot/grub/stage1this will return a value in (hd?, ?) format where it will find /boot/grub. '?' will be replaced by actual numbers to find the specific partition of your disc. [Ex. (hd0,7)]

Code:
grub> root (hd?,?)Use the value from the find command [Ex. (hd0,7)]. This will also tell you the filesystem type of the above partition.

Now, the following command will install the GRUB into the MBR.

Code:
grub> setup(hd0)
grub> quit
Hope this will help.

=============================================================================================

3. Grub Error 12 (from gentoo grub how-to)

Situation

Code Listing 3.1: Grub Output

12 : Invalid device requested.

This error is returned if the device strings syntax is correct but other than that, an error occurred that isn't defined by any other error.

Solution

When you installed grub in your boot record using the interactive commands, did you execute the two lines below in the grub prompt?

Code Listing 3.2: Interactive installation commands

grub> root (hd0,0)
grub> setup (hd0)

(hd0,0) must be replaced with your boot partition and (hd0) with the HDD you have chosen. Remember that (hd0) will install the bootloader in the Master Boot Record of the first hard disk, the primary master.

==============================================================================================

I write mini how-to for general situation, you have done so:

--> free space
/dev/sda1 --> extended (35 gb)
      ---> sda5 --> 1° logical (h0,4) --> NTFS data
      ---> free space
      ---> sda6 --> 2° logical (h0,5) --> NFTS WinXP
      ---> sda7 --> 3° logical (h0,6) --> EXT2 Linux
/dev/sda2 --> primary - swap

Qiming Liu (qooroo) said : #20

Many thanks for your replies.

I've tried reinstalling grub as you suggested above, but windows still won't boot (same error 12 pops up).

I feel like giving up - I can still access the files from my windows partition so at least I haven't lost files. Can you tell me if it's possible for me now to reinstall windows onto that 16gb NTFS partition while keeping my current Ubuntu to get dual boot?

thank you very much.

Massimo Forti (slackwarelife) said : #21

I think you must before do a beckup of all your data using ubuntu. Insert a dvd and copy all your windows data. After do that you can reinstall all, I think you must do this type o partition:

/dev/sda1 1° primary partition NTFS [boot] winXp [10 gb]
/dev/sda2 2° primary partition NTFS for all data [20 gb]
/dev/sda3 3° primary partition EXT3 Linux [9 gb]
/dev/sda4 4° primary partition swap for Linux

This is a good sistuation and you will not have problems. To do it you can use ubuntu live cd 7.04 and gparted, a very userfrendly partition tool (like partition magic) if you have problem I'm here.

thanks

Qiming Liu (qooroo) said : #22

Massimo...really need help. spent a whole day on this and it STILL doesn't work!

okay.

I've wiped my harddisk completely. then installed windows. after this my harddisk had ONE partition of 40gb with windows on it.

then I installed ubuntu 7.04. after install, nothing loads. I get "error loading operating system" at start.

I've now booted from the ubuntu CD and I can see that in my ubuntu partition, in /boot/ the GRUB folder is missing! i don't think it's installed! I tried your "reinstall GRUB" method above, but "find /boot/grub/stage1" gives me "file not found", since the GRUB folder is missing!

can I install grub now? i can only boot with the ubuntu cd.

my cfdisk now is:

                                  cfdisk 2.12r

                              Disk Drive: /dev/sda
                        Size: 40020664320 bytes, 40.0 GB
              Heads: 255 Sectors per Track: 63 Cylinders: 4865

    Name Flags Part Type FS Type [Label] Size (MB)
 ------------------------------------------------------------------------------
    sda1 Primary NTFS [] 10923.18
    sda2 Boot Primary Linux ext3 27842.58
    sda5 Logical Linux swap / Solaris 1250.25

     [Bootable] [ Delete ] [ Help ] [Maximize] [ Print ]
     [ Quit ] [ Type ] [ Units ] [ Write ]

                 Toggle bootable flag of the current partition

thank you

Massimo Forti (slackwarelife) said : #23

Hi, now you have a good partition, you can see all data windows in this partition ???

Thanks

Qiming Liu (qooroo) said : #24

yes I can see everything, but I can't boot into anything!!

I get "error loading operating system" at start, can't boot into windows or ubuntu. I can only boot from CD at the moment, and my GRUB folder is missing. help!

Best Massimo Forti (slackwarelife) said : #25

If you can reinstall ubuntu, this can solve your problem, if it don't work, we must do chroot (is not so easy).

Thanks

Qiming Liu (qooroo) said : #26

Thanks Massimo Forti, that solved my question.

Qiming Liu (qooroo) said : #27

SUCCESS! finally! reinstalling ubuntu did it. though i now have 2 small linux swap partitions (1 left over from first corrupted ubuntu install) but i don't care, dual boot works!

Thank you so much for your help! =]