LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tried to do dual-boot in Ubuntu, won't load WinXP. How to fix MBR? (https://www.linuxquestions.org/questions/linux-newbie-8/tried-to-do-dual-boot-in-ubuntu-wont-load-winxp-how-to-fix-mbr-847607/)

kyleryner 12-01-2010 02:02 AM

tried to do dual-boot in Ubuntu, won't load WinXP. How to fix MBR?
 
Hi all,

Im still a newbie at Linux., although I did dabble in it for a while and even managed to install some dualboot systems a couple of years ago on old laptops (until I reformatted and sold them). I still try them out using Live CDs/USBs from time to time.

With Ubuntu 10 and LinuxMint 10 providing much better UI experience, I want to install Linux again on my laptop as a dualboot..

I managed to install Ubuntu 10 on my IBM Thinkpad X40 from a LiveCD/USB Flashdisk. (I had to research extensively to figure out how to do this)

Using a Windows Partition software, I had to manually make 2 partitions (Ext4 and Swap). I dont recall having to do that before, i seem to remember it was done for me automatically..

Booted Ubuntu LiveCD again and from there installed a multi-boot system with the ff choices:

* Ubuntu 10.10,
* Ubuntu 10.10 safemode
* memtest
* Windows XP Professional (SDA1)
* (forgot the name, but its the Hidden Recovery Partition) (SDA2)



* Ubuntu runs fine when selected, I can access the C drive (Windows and Data files)

* Choosing WindowsXP, NOTHING HAPPENS, screen blinks and then goes back to the GRUB menu.

* Choosing the last option, i can see the IBM Recovery progress bar, then BSOD. (I thought I destroyed this partition, but when i boot and press the blue ACCES IBM button on the laptop, it successfully enters it so i dont mind it not working in the GRUB menu)

My question: How do I fix the MBR so i can boot WindowsXP again?



I tried to research and here's what i found so far from many similar threads in various forums:

1. I THINK my problem was in installing Ubuntu form the LiceCD/Flash Disk, in the partition settings I set BOOT From Windows XP Professional (SDA1).

2. I need to do a FIXBOOT command from windows, (but i cant access windows)

3. I can use Windows Setup CD and use the Recovery Console to fix the MBR, but my problem is I dont have a CD drive or the Setup CD, I can only reinstall using the hidden partition (restore to factory settings)

4. I read of a software in Linux SuperGrub/Supergrub2 . I dl'd the ISO but i dont have a CD drive or diskette drive to boot from, I only can boot from a flash disk, and i dont see steps on how to make a bootable flash disk that runs SuperGrub.

5. I downloaded and ran TestDisk in Linux, it says my heads don't match (255 vs 240), but when i tried to see if i can change geometry, it seems it will mess with the partitions I made.

6. If i can boot back to Windows, I can maybe use EasyBCD or Vistabootpro to make a multi-boot system to replace Grub. (I used Vistabootpro on my desktop to dual-boot Windows7 and WinXP)


So bottomline, I need help in figuring out what to do next to restore Windows XP or make it that GRUB can launch it from its menu. . I did try to research as best as I could, but it seems there are many variations of this problem with different scenarios and different solutions.

Hope someone can give advice..

Thanks in Advance!

yasaswisrikanth 12-01-2010 02:31 AM

1.ubuntu allows to dualbooting windows and itself.But it have to be done once you first install windows and then ubuntu.

2.you have to select the default layout that is selected by ubuntu, if you create partitions manually then problems might occur.

3.another best way is install ubuntu inside windows any drive(minimum 4 GB) using wubi.exe provided by livecd.

4.You can ask for a free livecd by creating an account at ubuntu.org.

5.If you want to install linux from usb there is a software available for making installable usb for almost any linux distro.

kyleryner 12-01-2010 04:10 AM

Quote:

Originally Posted by yasaswisrikanth (Post 4176680)
1.ubuntu allows to dualbooting windows and itself.But it have to be done once you first install windows and then ubuntu.

2.you have to select the default layout that is selected by ubuntu, if you create partitions manually then problems might occur.

3.another best way is install ubuntu inside windows any drive(minimum 4 GB) using wubi.exe provided by livecd.

4.You can ask for a free livecd by creating an account at ubuntu.org.

5.If you want to install linux from usb there is a software available for making installable usb for almost any linux distro.

hi yasaswisrikanth,

thanks for the reply.

1. My laptop already has Windows XP, so i installed Ubuntu alongside it and want to dualboot it. The Linux Install did in fact make a multi-boot menu (I think its GRUB2) and shows me the choices. My problem is, WindowsXP shows up as one of the choices but when i select it, nothing happens (wont boot into Windows XP or even give an error message)

2. Choosing the default layout did not work for me, I only had 2 choices: Try Ubuntu, Install Ubuntu. When I choose Install, another 2 choices.. Erase Entire Disk and Make Manual Partitions... then I couldnt get anywhere else till i made my own EXT and SWAP partitions.

3.I've used wubi before, and i liked it. But after a few months the partition got corrupted, i read thats the problem with wubi, the linux install gets corrupted easily when something goes wrong with windows or something. So now i wanted to make a "true" linux install.

4. I already downloaded and tried out ubuntu.10.10-desktop-i386.iso as well as ubuntu.10.10-netbook-i386.iso. (at first I wanted to install netbook version since i have a small and few years old laptop, but i decided to install desktop version since it seems to have more features?)

5. I use universal-usb-installer.1.8.1.2 to make usb-bootable linux livecds for both Ubuntu 10 and linuxmint 10, i tried installing both, they gave me the same initial problem of setting partitions/boot area till i finally made my own partitions. I am however wanting to make SUPERGRUB2 bootable as a flashdisk, bec so far i read i can only make bootable cd or diskette, and my laptop doesnt have either drive.

As I said, now my laptop can boot Ubuntu no problem, and i can even see my Windows Drive C with all my old data, I just cant boot into WindowsXP anymore.

My last resort would be to backup my files using Ubuntu (because I am dumb enough not to backup my files first before attempting all this.. anyway this is my secondary pc with mostly non-essential and easily replacable files) and then to reinstall WindowsXP fresh (using IBM recovery) Its just gonna be a pain and will take forever.

Anyway, I appreciate the help..

Hope someone can give me some additional advice...

thanks again...

yancek 12-01-2010 03:41 PM

If you can boot Ubuntu, post the contents of the /boot/grub/grub.cfg file which contains your Grub menu. It should show an entry for xp, if not someone who uses Grub2 should be able to help you. You could check the Grub2 tutorial in the link below, Section 5.A:

http://www.dedoimedo.com/computers/grub-2.html

kyleryner 12-02-2010 04:41 AM

Quote:

Originally Posted by yancek (Post 4177468)
If you can boot Ubuntu, post the contents of the /boot/grub/grub.cfg file which contains your Grub menu. It should show an entry for xp, if not someone who uses Grub2 should be able to help you. You could check the Grub2 tutorial in the link below, Section 5.A:

http://www.dedoimedo.com/computers/grub-2.html

hi yancek,

thanks for the reply.

well in my quest for a solution, i inadvertently corrupted Ubuntu.. I tried one solution I read, installed LILO (it says it will fix the MBR) but it ended up making Ubuntu NOT bootable, so no Ubuntu, no WindowsXP... (although I could still use the LiveCD on the USB flashdisk..whats the term for that anyway, LiveUSB? )

Grub menu still shows options.. I tried the Ubuntu (Recovery) selection.. showed a bunch of messages.. ended with "could not find etc etc ". I rebooted again, Ubuntu started up! then said i had a corrupt something something, rebooted again and now Ubuntu is fine once again in my laptop..

Im just amazed that it seemed it recovered on its own bec I dont know what i did exactly (except choose the Ubuntu Recovery selection) and it fixed itself. Now if only Windows could that as well..

Also, I just wanted to say that its hard to find CURRENT solutions for my problem since searching online mostly shows older posts, which when I tried to do I find out is already outdated.

Some of the things I downloaded and tried:

LILO, SuperGrub2 (couldnt figure out how to boot it from USB), Testdisk (just for Partitions I guess,not MBR), MS-SYS. (This one, MS-SYS seemed to be a good solution, but as i said it seemed outdated or I cant figure out how to run it properly).

I can only follow basic commands in using Terminal.. mostly Sudo install, Sudo apt-get, that sor of thing. Anything more than 3 lines and i get nervous.. :D

anyway, sorry for rambling..

Now that i have Ubuntu back, Ill post the Grub contents already (will do it in the next post)

Thanks again.

kyleryner 12-02-2010 04:52 AM

Quote:

Originally Posted by yancek (Post 4177468)
If you can boot Ubuntu, post the contents of the /boot/grub/grub.cfg file which contains your Grub menu. It should show an entry for xp, if not someone who uses Grub2 should be able to help you. You could check the Grub2 tutorial in the link below, Section 5.A:

http://www.dedoimedo.com/computers/grub-2.html

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="6"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro splash quiet splash
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
echo 'Loading Linux 2.6.35-23-generic ...'
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro single splash
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro splash quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro single splash
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 2e88fc8688fc4db9
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "Windows NT/2000/XP (on /dev/sda2)" {
insmod part_msdos
insmod fat
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 1b33-0a00
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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


Thats my grub entry..

Note it has 2 each of Ubuntu, Ubuntu Recovery and Memtest.
I can select Windows XP Professional (sda1), screen just blinks for a half second, then back to menu.
"Windows NT/2000/XP" (sda2) is the laptop's hidden partition where the Windows Install and other maintenance are located. Choosing it will show the IBM Recovery progress bar, but it ends in Blue Screen of Death. However when i just pust the ACCESS IBM button on the laptop when booting, it goes in properly with no problem.

Windows files and my data can be seen within Ubuntu, I already backed up my data on a USB external HD.

Just dont know how to fix the Grub or MBR so Windows XP can boot again.

Im just wondering why there is no easy one click solution available in linux for this (sort of like a Regcleaner for example). I imagine this a a very common problem especially since newbies tend to go for dual boot system since they still need Windows to be around in case Linux gets too intimidating for them.. :)

Hope some Grub2 experts can help.

Thanks!!

Desdd57 12-02-2010 05:00 AM

Wow - and this is "Newbie" stuff ??

EDDY1 12-02-2010 05:03 AM

Your ubuntu-live-cd is all you need.
You've already most likely installed grub to mbr.
Desktop version:
boot live-cd
when prompted choose
"try ubuntu"
wait until you see an icon that says "examples"
double click "examples icon"
press arrows to expand these directories starting with:
File sytem
usr
share
applications
now all you have to do is find "terminal" and open it
enter commands
sudo apt-get install grub-pc
sudo os-prober
sudo update-grub
reboot

kyleryner 12-02-2010 05:54 AM

Quote:

Originally Posted by EDDY1 (Post 4178014)
Your ubuntu-live-cd is all you need.
You've already most likely installed grub to mbr.
Desktop version:
boot live-cd
when prompted choose
"try ubuntu"
wait until you see an icon that says "examples"
double click "examples icon"
press arrows to expand these directories starting with:
File sytem
usr
share
applications
now all you have to do is find "terminal" and open it
enter commands
sudo apt-get install grub-pc
sudo os-prober
sudo update-grub
reboot

hi Eddy1,

thanks for the help.

I actually have Ubuntu 10.10 installed and running on the laptop already (it was messed up but got better) and of course I also have the LiveCD in USB flashdisk form.

At first I tried out your tips from Ubuntu running off my hd (not the livecd). I did not notice any error messages, i dont think there were but im not sure because i was eager to reboot). No change, GRUB still shows the selections, but Windows XP still wont boot when clicked. (not even any error message, screen just blinks for a while like its gonna do something then back to Grub menu again. Why doesnt it even say "not found" or something?

I then rebooted using LiveCD (from USB flashdisk), thinking maybe its different and repeated same steps. This time I noted the messages:

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@ubuntu:~$ sudo apt-get install grub-pc
Reading package lists... Done
Building dependency tree
Reading state information... Done
grub-pc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ubuntu@ubuntu:~$ sudo os-prober
/dev/sda1:Microsoft Windows XP Professional:Windows:chain
/dev/sda2:Windows NT/2000/XP:Windows1:chain
/dev/sda5:Ubuntu 10.10 (10.10):Ubuntu:linux
ubuntu@ubuntu:~$ sudo update-grub
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
ubuntu@ubuntu:~$


"error: cannot find a device for / (is /dev mounted?)."
rebooting also showed no change.

hoping for more ideas....

thanks again!

kyleryner 12-02-2010 06:14 AM

just to be sure,

I rebooted Ubuntu from my harddisk (not LiveCD) and did the steps again:

I was right before, there was no error messages: Says generating grub.cfg...done



allen@allen-ThinkPad-X40:~$ sudo apt-get install grub-pc
[sudo] password for allen:
Reading package lists... Done
Building dependency tree
Reading state information... Done
grub-pc is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-2.6.35-22 linux-headers-2.6.35-22-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
allen@allen-ThinkPad-X40:~$ sudo os-prober
/dev/sda1:Microsoft Windows XP Professional:Windows:chain
/dev/sda2:Windows NT/2000/XP:Windows1:chain
allen@allen-ThinkPad-X40:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-23-generic
Found initrd image: /boot/initrd.img-2.6.35-23-generic
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Professional on /dev/sda1
Found Windows NT/2000/XP on /dev/sda2
done


Why is it showing different results from the LiveCD? (USB) Is there a difference?

The LiveCD way showed errors, this one didn't...


and @Desdd57,

Yes, this is newbie stuff for me since I cant even get past the 1st step (on how to install Linux alongside WindowsXP! :-)


Im really hoping i can still find a way.. i know it just needs a tiny peice of code in the MBR to tell it to do this, but i cant find the way to do it!

Otherwise i will have to reinstall windows xp and linux (maybe linuxmint this time). But then ill be back to square one on how to properly install a dual-boot system.. (there are plenty of similar posts out there on this, but i STILL cant figure it out!!) hence, the newbie thing again :)

impert 12-02-2010 06:36 AM

Quote:

I tried one solution I read, installed LILO (it says it will fix the MBR) but it ended up making Ubuntu NOT bootable, so no Ubuntu, no WindowsXP... (although I could still use the LiveCD on the USB flashdisk..whats the term for that anyway, LiveUSB? )

Grub menu still shows options.. I tried the Ubuntu (Recovery) selection.. showed a bunch of messages.. ended with "could not find etc etc ". I rebooted again, Ubuntu started up! then said i had a corrupt something something, rebooted again and now Ubuntu is fine once again in my laptop..
You've been thrashing about a bit . . . Maybe your MBR is not as it should be.
Code:

sudo apt-get install grub-pc
which you have apparently run, installs grub 2, but not to the MBR. For that you need, from within your Ubuntu installation:
Code:

sudo grub-install
sudo grub-update

After which all should be rosy . . .

kyleryner 12-02-2010 08:02 AM

Quote:

Originally Posted by impert (Post 4178077)
You've been thrashing about a bit . . . Maybe your MBR is not as it should be.
Code:

sudo apt-get install grub-pc
which you have apparently run, installs grub 2, but not to the MBR. For that you need, from within your Ubuntu installation:
Code:

sudo grub-install
sudo grub-update

After which all should be rosy . . .

hi impert,

I've had so many responses from people who've been trying to help me with this problem. Im very grateful and humbled. Linuxquestions is really the best Linux forum out there!

yes, ive been thrashing about a bit.. ive been trying out different methods to restore being able to boot Windows XP. I think the first mistake i made was when i first installed Ubuntu and i had to make manual partitions (1 EXT, 1 for Swap) then I had to choose where to place the Boot (sorry, cant remember the exact details now, can do that later if i reboot to the LiveCD again and try the Install button again)

I did try your code,

the results were

Quote:

allen@allen-ThinkPad-X40:~$ sudo grub-install
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory
--grub-setup=FILE use FILE as grub-setup
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-probe=FILE use FILE as grub-probe
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already exists
--force install even if problems are detected
--disk-module=MODULE disk module to use

INSTALL_DEVICE can be a GRUB device name or a system device filename.

grub-install copies GRUB images into /boot/grub (or /grub on NetBSD and
OpenBSD), and uses grub-setup to install grub into the boot sector.

If the --root-directory option is used, then grub-install will copy
images into the operating system installation rooted at that directory.

Report bugs to <bug-grub@gnu.org>.
allen@allen-ThinkPad-X40:~$ sudo grub-update
sudo: grub-update: command not found
allen@allen-ThinkPad-X40:~$

so the messages I got were

sudo grub-install
install_device not specified.

sudo grub-update
command not found

(this is from running Ubuntu off my HD installation in the laptop, NOT the live CD)

anyway, thanks for help impert.
Is there anything else I can try?

yancek 12-02-2010 09:48 AM

Check the link for the Grub tutorial I posted earlier. For reinstalling Grub2, Section 4.G, for updating Grub2, Section 4.C;
To reinstall Grub2, boot into Ubuntu and run the command: sudo grub-install /dev/sda (assuming your hard drive is sda?)
to update Grub2 run the command: sudo update-grub. It is "update-grub" not "grub-update".

I don't use Grub2 so I haven't tried these myself. Might be good to review the tutorial.

EDDY1 12-02-2010 10:37 AM

Windows takes 2 partitions
having windows xp and windows xp pro takes 4.

EDDY1 12-02-2010 10:41 AM

Quote:

Found Windows NT/2000/XP on /dev/sda2
done
I think this is windows xp recovery partition.

EDDY1 12-02-2010 02:29 PM

I think you should post output of fdisk -l /dev/sda
so someone can tell you what's there.
You'll find that xp is most likely still there.

impert 12-02-2010 05:47 PM

Quote:

I did try your code,

the results were

Quote:
allen@allen-ThinkPad-X40:~$ sudo grub-install
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.
A thousand apologies. The fault is mine for not checking what I wrote before posting. I'm sorry for wasting your time.
That should have been
Code:

sudo grub-install (hd0)
sudo update-grub


EDDY1 12-02-2010 06:34 PM

The problem you're experiencing is that you can only have 4 main partitions. When you installed ubuntu it only recognized the first 3 + ubuntu.

syg00 12-02-2010 07:30 PM

Unfortunately you have got some bad (unfortunate) advice in this thread. It's hard to know what you have where now. From Ubuntu (or the liveUSB if you have to), go to sf.net and get, and run, the bootinfoscript. That will create a RESULTS.txt - post that. It will tell us what boot loader code is where, what partitions, ...
We can't help without (correct) data.

kyleryner 12-03-2010 12:10 AM

Quote:

Originally Posted by yancek (Post 4178306)
Check the link for the Grub tutorial I posted earlier. For reinstalling Grub2, Section 4.G, for updating Grub2, Section 4.C;
To reinstall Grub2, boot into Ubuntu and run the command: sudo grub-install /dev/sda (assuming your hard drive is sda?)
to update Grub2 run the command: sudo update-grub. It is "update-grub" not "grub-update".

I don't use Grub2 so I haven't tried these myself. Might be good to review the tutorial.

@yancek,

I did try to read the very detailed grub tutorial at http://www.dedoimedo.com/computers/grub-2.html.
However Im afraid it's a bit too technical for a newbie like me.. :-).
I can only do a few Sudo commands from the Terminal, anything more and i might do more damage...

I did however from that link, saw another link http://www.dedoimedo.com/computers/d...-7-ubuntu.html on How to Install Windows 7 and Ubuntu side by side (Dual-boot). I find it to be very informative and I think Ill be using that guide sometime soon (even if Im using XP, now Win7)

kyleryner 12-03-2010 12:11 AM

Quote:

Originally Posted by impert (Post 4178850)
A thousand apologies. The fault is mine for not checking what I wrote before posting. I'm sorry for wasting your time.
That should have been
Code:

sudo grub-install (hd0)
sudo update-grub


@impert,

no worries. was able to try the correct command, still no luck though. thanks anyway.

kyleryner 12-03-2010 12:16 AM

Quote:

Originally Posted by EDDY1;4178881
I think you should post output of fdisk -l /dev/sda
so someone can tell you what's there.
You'll find that xp is most likely still there.

The problem you're experiencing is that you can only have 4 main partitions. When you installed ubuntu it only recognized the first 3 + ubuntu.

@Eddy1,

Im sure XP is still there, i can see and access it from within Ubuntu. Its Booting it thats been giving me problems.

As for partitioning, I got lost there. I had 2 Windows Partition (1 XP, 1 Hidden for Recovery) and I CREATED 2 new partitions for Linux (1 EXT, 1 Swap). Didnt know I needed more. I do remember a couple of years ago I managed to dual boot (even triple boot) Ubuntu without all these issues and worrying about partitions etc. (unfortunately i forgot how I did that and it was a few iterations ago of Ubuntu)

kyleryner 12-03-2010 12:18 AM

Quote:

Originally Posted by syg00 (Post 4178921)
Unfortunately you have got some bad (unfortunate) advice in this thread. It's hard to know what you have where now. From Ubuntu (or the liveUSB if you have to), go to sf.net and get, and run, the bootinfoscript. That will create a RESULTS.txt - post that. It will tell us what boot loader code is where, what partitions, ...
We can't help without (correct) data.

@syg00,

Thanks so much for the tip! I did what you said and here is the contents of Results.txt (it's a bit long) ..

Quote:

Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #5 for (,msdos5)/boot/grub.

sda1: _________________________________________________________________________

File system: ntfs
Boot sector type: Grub 2
Boot sector info: Grub 2 is installed in the boot sector of sda1 and
looks at sector 72659640 of the same hard drive for
core.img, but core.img can not be found at this
location. No errors found in the Boot Parameter Block.
Operating System: Windows XP
Boot files/dirs: /BOOT.INI /ntldr /NTDETECT.COM

sda2: _________________________________________________________________________

File system: vfat
Boot sector type: Windows XP: Fat32
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM /COMMAND.COM

sda3: _________________________________________________________________________

File system: Extended Partition
Boot sector type: Unknown
Boot sector info:

sda5: _________________________________________________________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 10.10
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda6: _________________________________________________________________________

File system: swap
Boot sector type: -
Boot sector info:

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders, total 78140160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 * 63 61,493,039 61,492,977 7 HPFS/NTFS
/dev/sda2 61,493,040 69,945,119 8,452,080 12 Compaq diagnostics
/dev/sda3 69,945,342 78,139,391 8,194,050 5 Extended
/dev/sda5 69,945,344 76,781,567 6,836,224 83 Linux
/dev/sda6 76,783,616 78,139,391 1,355,776 82 Linux swap / Solaris


blkid -c /dev/null: ____________________________________________________________

Device UUID TYPE LABEL

/dev/sda1 2E88FC8688FC4DB9 ntfs IBM_PRELOAD
/dev/sda2 1B33-0A00 vfat IBM_SERVICE
/dev/sda3: PTTYPE="dos"
/dev/sda5 a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ext4
/dev/sda6 6c153206-3916-4349-b309-d5448e4d3073 swap
/dev/sda: PTTYPE="dos"

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sda5 / ext4 (rw,errors=remount-ro,commit=600)


================================ sda1/BOOT.INI: ================================

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

================================ sda2/boot.ini: ================================

[boot loader]
timeout=0
default=C:\
[operating systems]
multi(0)disk(0)rdisk(0)partition(4)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
C:\ = "PC-DOS"

=========================== sda5/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="6"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro splash quiet splash
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
echo 'Loading Linux 2.6.35-23-generic ...'
linux /boot/vmlinuz-2.6.35-23-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro single splash
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-23-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro splash quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 ro single splash
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a35ecd33-bd2d-4281-a0ee-337895fcc5a0
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 2e88fc8688fc4db9
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "Windows NT/2000/XP (on /dev/sda2)" {
insmod part_msdos
insmod fat
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 1b33-0a00
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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

=============================== sda5/etc/fstab: ===============================

# /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 nodev,noexec,nosuid 0 0
# / was on /dev/sda5 during installation
UUID=a35ecd33-bd2d-4281-a0ee-337895fcc5a0 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=6c153206-3916-4349-b309-d5448e4d3073 none swap sw 0 0

=================== sda5: Location of files loaded by Grub: ===================


36.2GB: boot/grub/core.img
37.2GB: boot/grub/grub.cfg
38.8GB: boot/initrd.img-2.6.35-22-generic
38.8GB: boot/initrd.img-2.6.35-23-generic
38.6GB: boot/vmlinuz-2.6.35-22-generic
36.0GB: boot/vmlinuz-2.6.35-23-generic
38.8GB: initrd.img
38.8GB: initrd.img.old
36.0GB: vmlinuz
38.6GB: vmlinuz.old
=========================== Unknown MBRs/Boot Sectors/etc =======================

Unknown BootLoader on sda3

00000000 5f df 9e 94 8b 5f f3 e6 83 aa 28 0b 80 ad ae 86 |_...._....(.....|
00000010 1b 05 18 d2 87 ac b4 c8 81 e9 47 5c da b3 ad 9d |..........G\....|
00000020 55 b8 bf 68 62 ff 2b 71 2e e9 ff a0 51 97 52 92 |U..hb.+q....Q.R.|
00000030 9c 9d 25 1f cd 47 e2 83 a7 9e 9e 08 5f 85 09 a5 |..%..G......_...|
00000040 b0 bb 4e 16 6a bd 47 4b ad 57 91 e7 d0 4a 6f b0 |..N.j.GK.W...Jo.|
00000050 ad ba 9e 27 30 6b 0a 6a 77 2f c7 41 7d 3d 97 7e |...'0k.jw/.A}=.~|
00000060 71 cc 43 a1 5c d4 4d 2f 9f ff 01 c4 85 bc d1 b0 |q.C.\.M/........|
00000070 41 63 a6 8e fb bc 3b 68 d5 02 ed b3 9b 13 68 ac |Ac....;h......h.|
00000080 99 44 26 bc da 20 a3 7f 90 22 63 d3 b1 d6 6a b8 |.D&.. ..."c...j.|
00000090 9d 66 14 34 c6 83 49 9d c7 dd 27 5e c0 76 55 7a |.f.4..I...'^.vUz|
000000a0 e1 a2 40 f2 ac 68 1f 17 f2 48 de b8 6a b1 25 4f |..@..h...H..j.%O|
000000b0 fe 18 7d 1d 38 a4 a1 f9 5e 3b 9f ba 47 f4 14 34 |..}.8...^;..G..4|
000000c0 5d 2f 1b 3f 98 20 d9 d9 48 6d 41 0b ca e8 0b 8e |]/.?. ..HmA.....|
000000d0 ae 97 14 ed c8 4a 20 94 7a d9 43 12 4a a1 74 0f |.....J .z.C.J.t.|
000000e0 fb 8c 00 d4 ba b4 cb 80 f3 29 98 84 dd 52 b0 88 |.........)...R..|
000000f0 23 60 9b c7 60 50 28 0d 4e f6 2a a1 e2 b4 7b 81 |#`..`P(.N.*...{.|
00000100 7e c3 77 35 90 40 75 c6 49 1a ab 4c 7b 37 ee 54 |~.w5.@u.I..L{7.T|
00000110 ba a9 9e 86 c2 40 84 e1 55 6f 8e 67 05 8f c3 2f |.....@..Uo.g.../|
00000120 70 51 fd 9f fe 33 d4 17 30 da 68 48 22 68 29 6e |pQ...3..0.hH"h)n|
00000130 1c d7 5b 90 4f b4 a0 1c 6b 75 36 e0 5c 96 fe 42 |..[.O...ku6.\..B|
00000140 86 26 76 3c 69 f5 19 94 2b c2 48 d9 8c 38 e5 f1 |.&v<i...+.H..8..|
00000150 d5 a6 a9 e8 5e 11 ae 08 ca 14 fc 76 e9 4a e2 07 |....^......v.J..|
00000160 57 fd 97 f8 80 00 32 f6 38 3f 60 8f 39 e9 51 30 |W.....2.8?`.9.Q0|
00000170 7f 64 8f 97 37 f2 4a ed b1 fb 90 12 ff 6a 67 5c |.d..7.J......jg\|
00000180 b4 5d 83 9f 4e 85 b0 97 ad 8b 76 9a 74 b6 6a d3 |.]..N.....v.t.j.|
00000190 c2 dc 3e 72 7f c2 4a c7 87 a3 9a 84 b0 56 e4 d6 |..>r..J......V..|
000001a0 13 5e da 03 20 18 50 e1 70 75 1c 4b 06 95 88 9c |.^.. .P.pu.K....|
000001b0 d4 e7 b8 4f a0 5b 56 f1 7d f4 14 91 c8 68 00 fe |...O.[V.}....h..|
000001c0 ff ff 83 fe ff ff 02 00 00 00 00 50 68 00 00 fe |...........Ph...|
000001d0 ff ff 05 fe ff ff 02 50 68 00 00 b8 14 00 00 00 |.......Ph.......|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200

hope that helps...

EDDY1 12-03-2010 01:01 AM

This is my output of fdisk and I only have 2 os'es

Quote:

root@debianperfectionplus:/home/topgun# fdisk -l /dev/sda

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbace8ac7

Device Boot Start End Blocks Id System
/dev/sda1 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 6375 51097600 7 HPFS/NTFS
/dev/sda3 6375 19458 105088001 5 Extended
/dev/sda5 * 6375 6417 340992 83 Linux
/dev/sda6 6417 7511 8787968 83 Linux
/dev/sda7 7512 7876 2928640 83 Linux
/dev/sda8 7876 8379 4034560 82 Linux swap / Solaris
/dev/sda9 8379 8427 389120 83 Linux
/dev/sda10 8427 19458 88601600 83 Linux
I basically have 3 primary partitions 2 of them were for windows if I add another wins it would have to be in my extended because it'll create 2 more primary partitions and you can only have 4

syg00 12-03-2010 04:00 AM

Looking at that, your XP system is gone. Somehow, you (or the installer) has installed grub2 to the XP partition. That ain't ever going to work - except wubi maybe, but I've never tried it.

Simple fixes (fixboot/fixmbr) aren't going to be sufficeient to fix this - you'll need to re-install XP. And then fix grub2 probably - it's a better boot-loader than M$oft.

kyleryner 12-03-2010 06:50 AM

SUCCESS!!

I managed to fix my dual-boot problem!

This is what happened:

From my very first post, I had an idea that the problem is the Ubuntu Install messed Window's MBR. Research showed the solution is to boot to Windows CD and use Recovery Console. Problem is I dont have a CD drive in the laptop. (at the same time, since Im not 100% sure that was the problem, I thought it could be a GRUB or Linux Partition issue)

I was looking for Linux-fixes that will fix Windows MBR without the need for Windows CD. There were some promising fixes I read (installing MS-SYS, SuperGrub2 etc) but it seemed what I read was outdated or Im back with the no-cd drive problem.

Along the way I tried everything that anyone can suggest to me.

Some of the tips here actually helped me arrive at the conclusion that my first thought was right: i just need to fix it if i can only access Windows Recovery.

(for example, the Grub Tutorial guide posted here showed me a guide on how to dual boot Windows and Ubuntu. The guide actually showed step by step what procedures to do.. and STILL THE GUIDE SHOWED WINDOWS WONT BOOT. "Dont Panic!!" , the guide says, simple solution pop in Windows Recovery CD and it will fix it! (Unfortunately the guide didnt show us how to do that if the laptop doesnt have a CD drive)

So I searched "How to boot Windows Recovery from USB" and similar searches.

The results were few, and have DIFFERENT approaches, some very complicated, some not so. Many need you to use the Windows Setup CDs (which I'll have to dig up), some need BARTPE, some requires you to boot to a CDDrive (in a PC), some just needs to access the i386 folder, and then finally I found this site:

Creating a USB bootable XP recovery console

It was easy to follow, required only a small download file, and I was done in a few minutes!
(it didnt need or ask for the Windows CD or i386 folders). Took up little space in the USB disk.) Booted my laptop successfully, it entered windows recovery console and ended in a Command Prompt (I was expecting a windows GUI, but I guess its more like a command line interface) I typed "FIXBOOT" and in 1 second it says its FIXED! Rebooted, I still have GRUB2 as the loader, chose Windows XP and it BOOTED!! Yaaaayyy!! :)

LOL! It was that EASY and FAST and it took me several days to figure it out!

I am just wondering why there is no LINUX script that can do the same thing, figure out where
Windows OS is, get the Boot info and rewrite the MBR.. from what i've seen, this problem pops up more often than you think...

Anyway, it seems the final solution seemed to be Windows-related and not really Linux issue. I just thought there was something that could be done from within Linux.

I'll be marking this thread as SOLVED and I typed up all of this in case some poor noob in the future does a search and maybe stumble here.. :)

I'd like to thank EVERYONE though for their patience and effort in trying to help me here. For me its not about the results, its about the way people try to help you any way they can. For that Im really grateful. LQ is one of the friendliest and helpful forums Ive been in, now that I have both Windows and Ubuntu on my laptop, I think Ill be needing more help soon! :-P

Cheers!

EDDY1 12-03-2010 07:22 AM

Congrats glad you could resolve that issue.
Success is always nice.


All times are GMT -5. The time now is 04:30 PM.