0

I had dual boot set up with my previous Ubuntu installation which allowed me either to use Windows XP or Ubuntu. This worked successfully.

I have upgraded to Ubuntu 14.4. The new Gnu Grub menu does not show my Windows XP installation on the start-up menu. So I am unable to access Windows.

results of sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa89aa89a

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   976751999   488375968+   7  HPFS/NTFS/exFAT

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062131

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048   195311615    97654784   83  Linux
/dev/sdb2       195311616   625137344   214912864+   7  HPFS/NTFS/exFAT
John Orion
  • 2,801
  • open a terminal and type in sudo update-grub and see if it finds the windows install. – John Orion Jun 05 '16 at 21:44
  • 1
    May be best to see details: Post the link to the Create BootInfo summary report. Is part of Boot-Repair: https://help.ubuntu.com/community/Boot-Info – oldfred Jun 06 '16 at 16:44

1 Answers1

0

First I would run sudo os-prober and see if it finds the Windows installation. If it is not installed run sudo apt-get install os-prober then run it and if it finds Windows run sudo update-grub and it should create the menu item.

If this doesn't work then I would run sudo fdisk -l (-l is for List) and look for your hard drive. It will look something like this:

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000702fc

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1  *        2048 33554431 33552384  16G 83 Linux
/dev/sda2       33556478 41940991  8384514   4G  5 Extended
/dev/sda5       33556480 41940991  8384512   4G 82 Linux swap / Solaris
/dev/sda6       41940991 50950020  8250580  16G 0b FAT32

Again this is only an example yours will look different and may be labeled differently. I don't actually have a Windows XP partition on the system so I 'faked' it on this example.

For this I would assume that my Windows XP is installed on /dev/sda6 This will be important for the following step.

Now we need to create a custom menu item for GRUB

Open terminal and type:

sudo gedit /etc/grub.d/40_custom

you can substitute gedit with your favorite editor but it needs to be run as sudo to be able to edit the file.

add the following to the very end of the 40_custom file (if the file is completely blank then you typed in something wrong or you don't have grub2 and these instructions will not work for you... double check to see if you have a /etc/grub.d folder)

menuentry "Windows XP" {
set root=(hd0,6)
chainloader (hd0,6)+1
}

Explanation for this entry... you will need to change the hd0,6 in the entries to match your Windows partition. The hd0 refers to sda, if you have more than one hard drive and your windows partition is on sdb then you would need to use hd1 instead but for you, I'm assuming that you are on sda which you determined by the fdisk command you ran earlier. The ,6 in my example is because we determined that the Windows installation was on /dev/sda6 - sda(hd0)6

Once you modified the 40_custom file it should look something like this

#!/bin/sh
exec tail -n +3 $0
# 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.

#echo 'Adding 40_custom menu entries' >&2

menuentry "Windows XP" {
set root=(hd0,6)
chainloader (hd0,6)+1
}

save the file and run sudo update-grub it should add a menu item for Windows XP ... try and reboot and check to make sure it boots into Windows If you did everything correctly you should be all set.

From the new information giving the 40_custom file should look like this:

#!/bin/sh
exec tail -n +3 $0
# 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.

#echo 'Adding 40_custom menu entries' >&2

menuentry "Windows XP" {
set root=(hd0,1)
chainloader (hd0,1)+1
}

Due to problems with "Invalid Signature" we need to do some more work

You need to open terminal and enter sudo blkid look for the UUID for /dev/sda1 and copy it. then you will need to edit the 40_custom with the following:

#!/bin/sh
exec tail -n +3 $0
# 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.

#echo 'Adding 40_custom menu entries' >&2

menuentry "Windows XP" {
insmod ntfs 
set root=(hd0,msdos1)
search --no-floppy --fs-uuid --set 822CB74E2CB73BCB
chainloader +1
}

(edited with the information given in comments)

save the file and sudo update-grub again and try once more .. hopefully now you wont get the Invalid Signature

John Orion
  • 2,801
  • Hi Thanks for your very detailed post. However no success I'm afraid. The GRUB menu showed an entry for Windows XP but gave the error message "No such partition". I also received error messages when I used the Gedit editor. I have tried to send screen shots of the error messages but this oversteps the character number limit. – Paul I'Anson Jun 06 '16 at 13:58
  • add them to the question ... just edit your question and add them ... or just copy and paste in the text of the messeges – John Orion Jun 06 '16 at 14:21
  • if you can add the text from sudo fdisk -l also .. just the part that shows the disk partitions the /dev/sda lines – John Orion Jun 06 '16 at 14:22
  • if the errors you got were in the terminal when launching gedit but gedit still launched that is ok .. sometimes when you use sudo to launch a gui program you get some errors which is normal. If you got the menu then the gedit worked properly and you were able to create the file as root so the reason it said that no partition means you got the hd0,whatever line wrong so if you post the results of sudo fdisk -l like I did in my example .. I should be able to edit my answer so that its the proper setting for your setup – John Orion Jun 06 '16 at 14:40
  • Disk /dev/sda: 500.1 GB, 500107862016 bytes

    Device Boot Start End Blocks Id System /dev/sda1 * 63 976751999 488375968+ 7 HPFS/NTFS/exFAT

    Disk /dev/sdb: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors Units = sectors of 1 * 512 = 512 bytes

    Device Boot Start End Blocks Id System /dev/sdb1 * 2048 195311615 97654784 83 Linux /dev/sdb2 195311616 625137344 214912864+ 7 HPFS/NTFS/exFAT I hope this is enough info after editting

    – Paul I'Anson Jun 06 '16 at 14:55
  • ok I updated my answer with the proper line that should be in the 40_custom file . let me know if that was already what you had .. or if that fixed it for you :) remember to use sudo update-grub after saving the changes to enable them – John Orion Jun 06 '16 at 15:35
  • No luck I'm afraid. I had used those values before. I got the error message "Invalid signature" when I used the Windows XP item on the GRUB menu – Paul I'Anson Jun 06 '16 at 15:54
  • ok what happens when you do sudo os-prober do you get any result? also try changing the line chainloader (hd0,1)+1 to chainloader +1 then sudo update-grub .. then see if it still gives you invalid sig – John Orion Jun 06 '16 at 16:02
  • Nothing to see, I'm afraid – Paul I'Anson Jun 06 '16 at 16:07
  • ok try the changing of the chainloader line and see if that helps .. if not .. I have one more thing we can try – John Orion Jun 06 '16 at 16:13
  • I've changed the chainloader line but still getting "Invalid signature" message – Paul I'Anson Jun 06 '16 at 16:15
  • ok .. try sudo mv /boot/grub/device.map /boot/grub/device.map.bak then sudo update-grub then try again and see if that changes the error message – John Orion Jun 06 '16 at 16:17
  • mv: cannot stat ‘/boot/grub/device.map’: No such file or directory
    I got this error message when I tried to run command. I also reran sudo update-grub. Error message still "Invalid signature"
    – Paul I'Anson Jun 06 '16 at 16:31
  • sorry .. guess that was old grub not grub 2 for the renaming of the map file :( ... ok .. i updated the answer again with a couple of more items to add to the 40_custom .. hopefully these will work :D – John Orion Jun 06 '16 at 16:33
  • Sorry still "Invalid signature" message. menuentry "Windows XP" { insmod ntfs set root=(hd0,1)

    search --no-floppy --fs-uuid --set <UUID="822CB74E2CB73BCB" TYPE="ntfs"> for search --no-floppy --fs-uuid set 63243C176F24E783

    chainloader +1 } This is what I entered into 40_custom. Is it correct?

    – Paul I'Anson Jun 06 '16 at 16:54
  • you should have the 822 number .. the 632 number was just an example so your line should read search --no-floppy --fs-uuid --set 822CB74E2CB73BCB and also notice that I added insmod ntfs in there too ... I will modify the answer again with the exact proper lines. – John Orion Jun 06 '16 at 17:01
  • I typed this into Gedit menuentry "Windows XP" { insmod ntfs set root=(hd0,1)

    search --no-floppy --fs-uuid --set 822CB74E2CB73BCB

    chainloader +1 } Still "Invalid signature". Looks like I have a broken PC. Can I thank you for your time and extreme patience. It is much appreciated. I'm off for dinner. Best wishes Paul

    – Paul I'Anson Jun 06 '16 at 17:14
  • you can copy the last one i made .. should be exactly what your 40_custom should look like .. once the file matches with the last entry i made in my answer then save it and update grub again ... and i'm almost out of ideas :( If this doesnt work the last idea I have is to change the set root=(hd0,1) to set root=(hd0,msdos1) if that doesn't work I would suggest you create a new question dealing with "Invalid Signature" and maybe someone else will have some ideas on a fix and you can link this one to it so they can see what we have already tried – John Orion Jun 06 '16 at 17:18
  • ok have a good dinner ... you can try my last item and then like i say if that doesnt work .. sorry to say ... im stumped... you may ask the question again with the new issue Invalid Signature since we at least got you a working menu that at least points in the right place but unfortunately I still have something wrong or I missed something and maybe someone else will spot my mistake – John Orion Jun 06 '16 at 17:32
  • Hi Me again. To let you know problem is solved. I went on to Ubuntu Forums and was given this link https://help.ubuntu.com/community/Boot-Repair which installed a Windows item on the GRUB startup menu. Again, many thanks for your efforts – Paul I'Anson Jun 07 '16 at 08:38