dual boot problem lucid/XP after vbox clone xp vm

Asked by matrixunloaded

I am a noobie, who has messed up big time. I have a dual boot configuration of XP and Lucid (upgraded from Karmic last night). Everything worked perfectly, including the preservation of my XP virtual machine (not to be confused with the dual boot version of XP). Having had only one XP VM, I tried to clone it. I found a link that would allow me to create a clone of the VM without the necessity of reinstalling the OS manually (and all the apps) here:

http://www.unixmen.com/linux-tutorials/896-how-to-clone-or-copy-a-virtual-disk-in-virtualbox

This worked fine after using the "VBoxManage internalcommands sethduuid <name of new xp.vdi>". I now have two XP VMs.

However, it seems to have messed up my ability to boot into xp from grub2. Lucid boots up fine, but XP (which is on sda1 in grub) just leaves a blinking cursor. My suspicion is that it has something to do with the UUID.

I found this info if it helps:

~$ sudo blkid

/dev/sda1: UUID="5E2C398A382E2B62" TYPE="ntfs"
 <-- this is the one I am trying to boot into
/dev/sda5: UUID="1ad401de-83c3-4977-a562-8a9efafefe66" TYPE="ext4"

/dev/sda6: UUID="f6bd937f-5dee-4845-86f8-683d8d297522" TYPE="swap"

/dev/sdb1: LABEL="MS2 S750" UUID="D6488C30488C1183" TYPE="ntfs"
<-- this is another hd with xp, which i also cannot boot into

Any help is greatly appreciated!

Question information

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

In file /boot/grub/menu.lst, localize the block of text with XP, and update uuid with new one.

Revision history for this message
matrixunloaded (fstclair) said :
#2

I am using grub2 so there is no menu.lst. I did go into grub.cfg and checked that the UUID for sda1 is correct and also tried running sudo update-grub. the ntfs partitions are still not bootable. Here is are the menu entries in grub.cfg for the ntfs partitions:

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

Any suggestions?

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

Sorry, I answered other question and gained some knowledge of Grub2.
Boot with Ubuntu, and do a
      sudo grub-install /dev/sda
This will rebuild the boot file with new UUID.

Revision history for this message
matrixunloaded (fstclair) said :
#4

delance,

I tried:

sudo grub-install /dev/sda

which completed without error, but still the same blinking cursor on reboot when selecting xp on sda1.

I then ran:

sudo grub-install /dev/sda1

which completed without error, but still the same blinking cursor on reboot when selecting xp on sda1.

what next? Thanks!

Here is full grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/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
  load_env
fi
set default="0"
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
}
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
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.32-22-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 linux /boot/vmlinuz-2.6.32-22-generic-pae root=UUID=1ad401de-83c3-4977-a562-8a9efafefe66 ro quiet splash
 initrd /boot/initrd.img-2.6.32-22-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-22-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 echo 'Loading Linux 2.6.32-22-generic-pae ...'
 linux /boot/vmlinuz-2.6.32-22-generic-pae root=UUID=1ad401de-83c3-4977-a562-8a9efafefe66 ro single
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-2.6.32-22-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 linux /boot/vmlinuz-2.6.32-21-generic-pae root=UUID=1ad401de-83c3-4977-a562-8a9efafefe66 ro quiet splash
 initrd /boot/initrd.img-2.6.32-21-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 echo 'Loading Linux 2.6.32-21-generic-pae ...'
 linux /boot/vmlinuz-2.6.32-21-generic-pae root=UUID=1ad401de-83c3-4977-a562-8a9efafefe66 ro single
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-2.6.32-21-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.31-20-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 linux /boot/vmlinuz-2.6.31-20-generic-pae root=UUID=1ad401de-83c3-4977-a562-8a9efafefe66 ro quiet splash
 initrd /boot/initrd.img-2.6.31-20-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.31-20-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 echo 'Loading Linux 2.6.31-20-generic-pae ...'
 linux /boot/vmlinuz-2.6.31-20-generic-pae root=UUID=1ad401de-83c3-4977-a562-8a9efafefe66 ro single
 echo 'Loading initial ramdisk ...'
 initrd /boot/initrd.img-2.6.31-20-generic-pae
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
 insmod ext2
 set root='(hd0,5)'
 search --no-floppy --fs-uuid --set 1ad401de-83c3-4977-a562-8a9efafefe66
 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 ntfs
 set root='(hd0,1)'
 search --no-floppy --fs-uuid --set 5e2c398a382e2b62
 drivemap -s (hd0) ${root}
 chainloader +1
}
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
 insmod ntfs
 set root='(/dev/sdb,1)'
 search --no-floppy --fs-uuid --set d6488c30488c1183
 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 ###

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

Probably Grub2 called Windows boot-loader, but this latest one is broken.

fixing windows MBR of disk a:

     sudo apt-get install ms-sys
     sudo ms-sys -m /dev/sda
     sudo ms-sys -m /dev/sdb

Why do you have two XPs, on a virtual machine moreover ? Usually the simplest is the best.

Summary for myself:

Grub 2
/dev/sda1: UUID="5E2C398A382E2B62" TYPE="ntfs" <-- this is the one I am trying to boot into
/dev/sda5: UUID="1ad401de-83c3-4977-a562-8a9efafefe66" TYPE="ext4"
/dev/sda6: UUID="f6bd937f-5dee-4845-86f8-683d8d297522" TYPE="swap"

/dev/sdb1: UUID="D6488C30488C1183" TYPE="ntfs" <-- this is another hd with xp, which i also cannot boot into

Revision history for this message
matrixunloaded (fstclair) said :
#6

delance,

I tried your solution but could not get the package ms-sys even with universal enabled. After trying something called testdisk, which generated a log, but no positive results, I Googled some more and found I should burn a live CD of lucid, which I did. After that I installed lilo,after which I could get ms-sys installed and get back my sda1 xp partition. However, I have now lost the Lucid partition.

Is there a way now to non-destructively reinstall grub2 so as to preserve the xp partition on sda1 and have available my old grub2 menu?

BTW, I know you asked why I had two xp partitions on two drives in addition to two XP VMs. This is exactly the reason. I want to be sure that the dual boot is working fine before nixing my old xp standalone drive (sdb1).

Any help is greatly appreciated!

If you need additional info, please let me know.

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

You're right. I forgotten the package was removed from Ubuntu repository.
          http://packages.debian.org/etch/i386/ms-sys/download
and double click on downloaded file to install.
Lilo is an old multi-boot software, which was used before Grub. And it is less and less used, which means you will probably have no help from community. ms-sys probably installed MBR where you have lilo installed. It is THE classical problem, even also with Grub.
You have not lost your Ubuntu partition, but the lilo software, which means that you cannot boot on it for the moment.
For me the situation is not clear.
Can you boot on Ubuntu Live CD, and in a terminal window enter command:
     sudo parted -l && sudo blkid
and post the results.
Grub2 is not bulletproof. In theory, you can install again Grub2 without overwriting Windows MBR. In practice, there are sometimes some problem. But the best is to start to follow standard procedure before going into complex solution.

Please, for the moment are you working on real hardware or on a simulation of it in a Virtual Machine ?

If you have two drives, the best solution is:
   - having XP disk as first one, repair Window's MBR
   - switching both disk (I know it look strange)
   - installing Ubuntu on what is now the first disk
Ubuntu will install Grub2 on first sector of Ubuntu disk, and Windows has still its MBR on first sector of Windows disk.
And surprise, Ubuntu detect the MBR on second disk, and add in menu a chain to Windows MBR.
I reproduced it with success on a Virtual Machine, and moreover its my actual hardware configuration (but with Grub1).
If it fails, you simply have to switch again the disk to recover Windows.

Revision history for this message
matrixunloaded (fstclair) said :
#8

delance,

I booted from a Live CD into Lucid. Below is the output:

ubuntu@ubuntu:~$ sudo parted -l && sudo blkid
Model: ATA WDC WD3000HLFS-0 (scsi)
Disk /dev/sda: 300GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 154GB 154GB primary ntfs boot
 2 154GB 300GB 146GB extended
 5 154GB 294GB 140GB logical ext4
 6 294GB 300GB 5963MB logical linux-swap(v1)

Model: ATA ST3750640AS (scsi)
Disk /dev/sdb: 750GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

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

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

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

/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="5E2C398A2C395DE9" TYPE="ntfs"
/dev/sda5: UUID="1ad401de-83c3-4977-a562-8a9efafefe66" TYPE="ext4"
/dev/sda6: UUID="f6bd937f-5dee-4845-86f8-683d8d297522" TYPE="swap"
/dev/sdb1: LABEL="MS2 S750" UUID="D6488C30488C1183" TYPE="ntfs"

BTW, the reason I have the dual boot configuration on /sda is to use my velociraptor 10000 rpm for both OSs and to use /sdb for data storage. I could not find documentation for the "-l &&" parameters for parted. Could you explain what they stand for?

Thanks for all your continuing help!

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

The command is "parted -l" which provides both UUID and file system information.
&& is only to put both commands on same line
-------------------------------------------------------------------------------------------------------------------------------------------------------
Disk /dev/sda: 300GB VELOCIRAPTOR!
 1 154GB UUID="5E2C398A2C395DE9" TYPE="ntfs" boot
 5 140GB UUID="1ad401de-83c3-4977-a562-8a9efafefe66" TYPE="ext4"
 6 6GB UUID="f6bd937f-5dee-4845-86f8-683d8d297522" TYPE="swap"

Disk /dev/sdb: 750GB DATA
 1 750GB primary ntfs boot

dual boot configuration of XP and Lucid (upgraded from Karmic last night) with grub2
XP (which is on sda1 in grub) just leaves a blinking cursor => overwriting of MBR
--------------------------------------------------------------------------------------------------------------------------------------------------------
We can do anything while Windows MBR is not fixed.
So
1- do a backup of /home directory to an external disk (doing a backup is always a good idea!)
2-download and install ms-sys
           http://packages.debian.org/etch/i386/ms-sys/download
3-fix MBR
           sudo ms-sys -m /dev/sda
4-check if Windows boot
5-check if Grub2 was broken (unfortunately it is probable, and we will have after to repair it)
6-if Grub2 is broken, boot under Live CD and run
           sudo grub-install /dev/sda
and tell me if it works after (truly, I never tried so I don't know) i.e. both XP and Lucid boot.

Revision history for this message
matrixunloaded (fstclair) said :
#10

I have successfully repaired the windows MBR and can boot into windows fine. However,

Grub2 is not working. I tried your suggestion (sudo grub-install /dev/sda) from live CD and got this:

/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
No path or device is specified.
Try `/usr/sbin/grub-probe --help' for more information.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

I am clueless as what this means. The partitions sda1 and sda5 appear to be mounted since they are accessible through Places on the menu. I have tried various options of grub-probe, bu cannot make any sense out of them, either.

Here is the latest status:

ubuntu@ubuntu:~$ sudo parted -l && sudo blkid
Model: ATA WDC WD3000HLFS-0 (scsi)
Disk /dev/sda: 300GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 154GB 154GB primary ntfs boot
 2 154GB 300GB 146GB extended
 5 154GB 294GB 140GB logical ext4
 6 294GB 300GB 5963MB logical linux-swap(v1)

/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="5E2C398A2C395DE9" TYPE="ntfs"
/dev/sda5: UUID="1ad401de-83c3-4977-a562-8a9efafefe66" TYPE="ext4"
/dev/sda6: UUID="f6bd937f-5dee-4845-86f8-683d8d297522" TYPE="swap"

(BTW I disconnected /sdb to "simplify" things).

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

I will try today to reproduce your problem, as you are not alone in this situation.

Else I find a solution with CD Live.
Else you will have to reinstall Ubuntu.

If you have time, you can prepare second case by:
    downloading and burning CD of Ubuntu 10.04
    doing a backup of /home folder on an external device (a backup is always a good idea!)

Revision history for this message
matrixunloaded (fstclair) said :
#12

delance,

I fixed it just now. Here is how:

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

Afterwards:

sudo update-grub to make the grub.cfg up to date.

A link I found discussed this: http://ubuntuguide.net/how-to-restore-grub-2-after-reinstalling-windows-xpvistawin7

The only problem I have now is that I get an error on boot that "disk drive for /media/sda1 is not ready yet or not present", but i I think this is just an incorrect UUID in fstab. I haven't had time to work on it yet, but here is a link to that problem:

http://www.nyutech.com/2009/03/make-ubuntu-mount-partitions-and-drives.html

Many thanks for all your responses and help!