How to recovery/repair Linux Ubuntu 12.04 BootLoader/GRUB after installing Windows XP


#1

Dear Sir,

after Installation of Windows XP on Existing Ubuntu 12.04 Computer with different partitions. Now My Computer is directly booting with windows XP Not Showing Ubuntu 12.04 options During the Boot Time. It Happened now only after installation of Windows Xp in Different Partition With Ubuntu Linux 12.04.

I heard that it is possible to recovery OR Repair Linux Ubuntu Bootloader OR GRUB whenever windows Xp gets installed

I am heartily requesting you to help me in this regard in very Detailed manner and STEP BY STEP. It’s my Humbly Request to you Sir.

Thankful to you Sir,

Basavaraj From India


#2

Hi Basavaraj,

Do you use/have UEFI boot loader?

Normally, you install windows first and then you install Linux.

Lubos


#3

Dear Sir,

Do you use/have UEFI boot loader?

>> Normally I have used Default boot loader which usaully comes with ubuntu 12.04 OS During Installation Time.

Normally, you install windows first and then you install Linux

>> I usually install windows xp first then install linux. It is correct Sir.

unfortunataly My windows Xp was giving problem and tried to solve it. But I Could not Solve it.

I started newly installation of windows xp and installation is done . Now problem is that it is not showing ubuntu linux OS during the boot time.

For that, is there any trick to recover OR Repair ?

My computer should show both OS During boot time as it was previous .


#4

Dear Sir ( Lubos ),

Please Help me! Because I don’t have much knowledge in Lunix OS.

That is why, EveryTime I put my Questions to you Sir.

Sometimes you give Answers immediatly and Sometimes makes delay.

I am totally depending you Sir.

Sincerely,

Thanking you,


#5

Hi Basavaraj,

can you please boot some Linux live cd such us ubuntu Live and paste here an output of

# fdisk -l

command. First we need to determine your partition table.

lubos


#6

Hi Basavaraj,

Here is a step-by-step manual on how to recover grub boot loader after reinstalling Windows XP and thus rendering dual boot not functional.

Here we assume that you are:

  • not using UEFI boot loader
  • your root partition of Ubuntu installation contains boot mount and is located under /dev/sda6.
  • your primary bootable disk is /dev/sda
  • below was tested on grub version 1.99. To see your grub version execute:
$ sudo grub-install -v
grub-install (GRUB) 1.99

Recover MS Windows - Ubuntu dual boot with Ubuntu Live/installation CD:

  • download Ubuntu Installation / Live cd
  • boot from Ubuntu Installation / Live cd - usb, burned cd etc.
  • during boot select “Try Ubuntu” , do not select install !!!
  • Check your partition table. Here is example:
ubuntu@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 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: 0xbf45bf45

   Device Boot      Start         End      Blocks   Id  System
[B]/dev/sda1   *          63    20482874    10241406    7  HPFS/NTFS/exFAT[/B]
/dev/sda2        20482936    37746687     8631876    f  W95 Ext'd (LBA)
/dev/sda5        20482938    24579449     2048256    e  W95 FAT16 (LBA)
[B]/dev/sda6        24580096    33161215     4290560   83  Linux[/B]
/dev/sda7        33163264    37746687     2291712   82  Linux swap / Solaris

As you can see we have MS Windows installed on /dev/sda1 and Linux on /dev/sda6 partition.

  • mount your Ubuntu linux partition

  • check you current grub config file:

less /mnt/boot/grub/grub.cfg

alternatively edit it if you need to do some changes. If the boot was working prior to your windows xp installation you should not do any changes.

  • install / reinstall grub with:
$ sudo grub-install --root-directory=/mnt/ /dev/sda
Installation finished. No error reported.
  • Reboot your system, remove bootable CD and you should have your dual boot menu ready when the system starts.

Hope this helps…

Lubos


#7

Dear Sir,

Thank you for your reply. Now, This moment, I am not working on this issue…

give me time Sir, Because I am suffering form fever and my health is not supporting for now.

I will meet you after 2 or 3 days

Yours,

Basavaraj From India.


#8

Dear Sir,

sorry Sir Because of my Health I was not good… so I could not come on Internet… Now I am fine Sir.

Now Today I inserted Ubuntu Live CD and clicked on DashHome and searched Terminal, opened it , Typed the following command as shown in previous Reply

$ sudo grub-install --root-directory=/mnt/ /dev/sda
Installation finished. No error reported.

At End, I got message like “Installation finished. No error reported.”

Then I removed Ubuntu live CD and rebooted the Computer, thereafter, it is giving this kind of Following Error…

===================GNU GRUB version 1.99-21ubuntu3=======================================

Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions.

grub>


#9

Hi,

Please boot your Live DVD and paste here output of the following command:

# fdisk -l

thanks


#10

Dear Sir,

I am again kindheartedly requesting you is that why is not getting success to me? Problem Over problem…

I have followed all the commands systematically without any Errors… Actually I am troubling for this…Please do me help. It is my always request to you sir.

as per your previous reply, I have run the following command Here is the OUTPUT…

ubuntu@ubuntu:~$ 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 / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000a6689

Device Boot Start End Blocks Id System
/dev/sda1 * 63 102398309 51199123+ 7 HPFS/NTFS/exFAT (Windows XP “C “Drive)
Partition 1 does not start on physical sector boundary.
/dev/sda2 102398371 976771071 437186350+ f W95 Ext’d (LBA) (Extended Partition )
Partition 2 does not start on physical sector boundary.
/dev/sda5 102398434 307210994 102406280+ 7 HPFS/NTFS/exFAT (logical Drive)
Partition 5 does not start on physical sector boundary.
/dev/sda6 307211058 511991549 102390246 7 HPFS/NTFS/exFAT (logical Drive)
Partition 6 does not start on physical sector boundary.
/dev/sda7 511991808 531523583 9765888 82 Linux swap / Solaris (swap Partition)
/dev/sda8 531525632 976771071 222622720 83 Linux (root Partition)
ubuntu@ubuntu:~$

Please do help

Kind Regards,

Basavaraj From India…


#11

Dear Sir,

Please do help sir, Have you got my mail Sir?

I am waiting for your reply

Thanking you,

Kind Regards,

Basavaraj From India


#12

Dear Sir,(Lubos)

Please kindly do the help as early as possible I am waiting for reply sir…again I repeat my sentence is that I have kept a lot of hopes on you.

booted Live DVD and pasted here output of the following command:

#fdisk -l

ubuntu@ubuntu:~$ 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 / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000a6689

Device Boot Start End Blocks Id System
/dev/sda1 * 63 102398309 51199123+ 7 HPFS/NTFS/exFAT (Windows XP “C “Drive)
Partition 1 does not start on physical sector boundary.
/dev/sda2 102398371 976771071 437186350+ f W95 Ext'd (LBA) (Extended Partition )
Partition 2 does not start on physical sector boundary.
/dev/sda5 102398434 307210994 102406280+ 7 HPFS/NTFS/exFAT (logical Drive)
Partition 5 does not start on physical sector boundary.
/dev/sda6 307211058 511991549 102390246 7 HPFS/NTFS/exFAT (logical Drive)
Partition 6 does not start on physical sector boundary.
/dev/sda7 511991808 531523583 9765888 82 Linux swap / Solaris (swap Partition)
/dev/sda8 531525632 976771071 222622720 83 Linux (root Partition)
ubuntu@ubuntu:~$

Please heartily requesting you to help me continuously

Please do help … please do help… please do help

meanwhile, I am trying hard to solve this issue by searching on google site… still now not get result… So Therefore please do help…

I will give you each and every command’s output… eagerly waiting for your reply…

warm and kindheartedly regards,

From Basavaraj, India.


#13

Did you mount your linux root partition before you have executed your commands. Boot your Live CD and execute:


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

Paste any output from both above commands here. Also include content of your /mnt/boot/grub/grub.cfg file.

Lubos


#14

Dear sir,

Please Do help…

           Did you mount your linux root partition before you have executed your commands  

                I mounted it before successfully as per knowledge..I am sure about it.


           
          #sudo mount /dev/sda8 /mnt    pressed ENTER Button.  nothing has come
          #

          # sudo mount grub-install --root-directory=/mnt /dev/sda  Pressed ENTER Button  I got following output.

             Installation finished. No error reported.

         #gedit  /mnt/boot/grub/grub.cfg  Then I pressed ENTER Button .... The following is output.........


            # 

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=“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
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
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
if background_color 44,0,30; then
clear
fi

END /etc/grub.d/05_debian_theme

BEGIN /etc/grub.d/10_linux

function gfxmode {
set gfxpayload="${1}"
if [ “${1}” = “keep” ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ “${recordfail}” != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ “${linux_gfx_mode}” != “text” ]; then load_video; fi
menuentry ‘Ubuntu, with Linux 3.2.0-56-generic-pae’ --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
linux /boot/vmlinuz-3.2.0-56-generic-pae root=UUID=b0c94712-8c10-451b-a726-ea49dd5c5052 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.2.0-56-generic-pae
}
menuentry ‘Ubuntu, with Linux 3.2.0-56-generic-pae (recovery mode)’ --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
echo ‘Loading Linux 3.2.0-56-generic-pae …’
linux /boot/vmlinuz-3.2.0-56-generic-pae root=UUID=b0c94712-8c10-451b-a726-ea49dd5c5052 ro recovery nomodeset
echo ‘Loading initial ramdisk …’
initrd /boot/initrd.img-3.2.0-56-generic-pae
}
submenu “Previous Linux versions” {
menuentry ‘Ubuntu, with Linux 3.2.0-23-generic-pae’ --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=b0c94712-8c10-451b-a726-ea49dd5c5052 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.2.0-23-generic-pae
}
menuentry ‘Ubuntu, with Linux 3.2.0-23-generic-pae (recovery mode)’ --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
echo ‘Loading Linux 3.2.0-23-generic-pae …’
linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=b0c94712-8c10-451b-a726-ea49dd5c5052 ro recovery nomodeset
echo ‘Loading initial ramdisk …’
initrd /boot/initrd.img-3.2.0-23-generic-pae
}
}

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 reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
linux16 /boot/memtest86+.bin
}
menuentry “Memory test (memtest86+, serial console 115200)” {
insmod part_msdos
insmod reiserfs
set root=’(hd0,msdos8)’
search --no-floppy --fs-uuid --set=root b0c94712-8c10-451b-a726-ea49dd5c5052
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)” --class windows --class os {
insmod part_msdos
insmod ntfs
set root=’(hd0,msdos1)’
search --no-floppy --fs-uuid --set=root 1828716228714034
drivemap -s (hd0) ${root}
chainloader +1
}

END /etc/grub.d/30_os-prober

BEGIN /etc/grub.d/30_uefi-firmware

END /etc/grub.d/30_uefi-firmware

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

Thanking you,


#15

Dear Sir,

I am very honestly saying is that…Now I don’t have words to express my views or thoughts or feelings But one thing Always remembering is that I would like to have your help ALWAYS.

But tell me something about this Error. It is immense request to you . again I put one very very important to you sir is that. It is My Humbly and profound obeisance respect to you Sir.

Please do help Continuously,

Warm & Kindheartedly Regards,

Basavaraj From India…


#16

When you get to the grub:

Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions.

grub>

Enter:

grub> geometry (hd0)
grub> find /boot/grub/stage1
grub> find /sbin/init
grub> find /boot/vmlinuz
grub> find /boot/grub/grub.conf

and post results here…


#17

Dear sir,

I swithed on the computer. while booting, It showed the GRUB> Error…

in front of GRUB> geometry (hd0) I pressed the Enter Button.

error: unknown command ‘geometry’

And Then I tried other command that is…

Grub> find /boot/grub/stage1 againg It showed like this…

erro: unknown command ‘find’

please do the help as early as possible…

I am very thankful to you sir.

you have mentioned that Enter Code … Where to enter this Code Sir?

Enter:
Code:

grub> geometry (hd0)
grub> find /boot/grub/stage1
grub> find /sbin/init
grub> find /boot/vmlinuz
grub> find /boot/grub/grub.conf

and post results here…


#18

Dear Sir,

Lubos Sir, Please Do help me as early as possible . I have kept hope on you…

is there anything required additionally? Please let me know

My computer remains in same condition ( i.e. GRUB>)

Please do help. I will come tomorrow but your answers must be there to my question.


#19

[QUOTE=Basavaraj;2565]Dear Sir,

Lubos Sir, Please Do help me as early as possible . I have kept hope on you…

is there anything required additionally? Please let me know

My computer remains in same condition ( i.e. GRUB>)

Please do help. I will come tomorrow but your answers must be there to my question.[/QUOTE]

Please do help !


#20

Hi,

What output does the following command return?

grub> ls -al]