LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2009, 11:40 PM   #1
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Rep: Reputation: 33
Cool plz help me to reinstall grub


I had reinstalled my windows OS , so i need to change my MBR , but when i tried it in GRUB , its showing some strange errors

i'll show what i've done and the error got

grub> find /boot/grub/stage1
(hd0,5)

grub> root (hd0,5)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,5)/boot/grub/stage2
/boot/grub/menu.lst"... failed

Error 22: No such partition

Please help me , i forgot to take the cd key of windows , now no linux too , help me guys ..
 
Old 02-24-2009, 12:30 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Boot from media of the Linux that is installed in your machine and enter the rescue mode.
You will probably need to chroot.
Once that is done just reinstall the grub with

grub-install /dev/sda

Assuming your drive to be sda. Look what is it named.
 
Old 02-24-2009, 01:27 AM   #3
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,098
Blog Entries: 3

Rep: Reputation: 325Reputation: 325Reputation: 325Reputation: 325
for some reason the file boot is not on (hd0,5) it says there is no such thing as a (hd0,5) are you sure it is there another thing hate to say this but windows restore disk likes to wipe out the whole system and restore everything back to oem just one big partition good luck I pray that did not happen to you. how many partitions does windows see let me guess drive C for the fist partition then what .and look at your partitions. hd0,5 in windows world would be what drive F
Quote:
Error 22: No such partition
get a live cd boot it copy any thing you need and then reinstall.

Last edited by Drakeo; 02-24-2009 at 01:31 AM.
 
Old 02-24-2009, 02:13 AM   #4
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Original Poster
Rep: Reputation: 33
Cool

Quote:
Originally Posted by linuxlover.chaitanya View Post
Boot from media of the Linux that is installed in your machine and enter the rescue mode.
You will probably need to chroot.
Once that is done just reinstall the grub with

grub-install /dev/sda

Assuming your drive to be sda. Look what is it named.
May i knw , "what is this boot from media of Linux that is installed"?
I just took the first option when CD booted, "Try without installing"
Is this correct .
And when i took terminal nad just checked /boot/grub/menu.list , there is no file like that ..?

Sounds i've made a mistake ,right ? but my contents of ubuntu are still there in my system , only the problem for MBR

While installing i had formatted only C: drive.. is this ok, i can still find my other partition and its content both from windows and Ubuntu

Am I confusing?
 
Old 02-24-2009, 02:48 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
It is not clear what you are talking about. If you are using a LiveCD then there is no way it will install the grub and you wont find the file.
Boot from the LiveCD, open terminal and type

sudo grub-install /dev/sda

To find what your hdd is named type

sudo fdisk -l
 
Old 02-24-2009, 09:21 AM   #6
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Original Poster
Rep: Reputation: 33
Unhappy

Quote:
Originally Posted by linuxlover.chaitanya View Post
It is not clear what you are talking about. If you are using a LiveCD then there is no way it will install the grub and you wont find the file.
Boot from the LiveCD, open terminal and type

sudo grub-install /dev/sda

To find what your hdd is named type

sudo fdisk -l
What steps would u take normally to reinstall a grub , the steps that i had done is shown below , is there any mistake let me knw please

1. Inserted Ubuntu cd , and tried first option itself "Try ubuntu without installing in the system"

Do u normally take this option and after take terminal , i dont knw any other way to take terminal

2 . Then i performed operations which i had given in my first thread

And even i tried sudo grub-install and all , but no use , i had provided
my fdisk output below

ubuntu@ubuntu:~$ sudo fdisk -l
omitting empty partition (5)

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa13ba13b

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2611 20971520 c W95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary.
/dev/sda2 2611 5222 20971520 7 HPFS/NTFS
Partition 2 does not end on cylinder boundary.
/dev/sda3 5223 9729 36202477+ 5 Extended
Partition 3 does not end on cylinder boundary.
/dev/sda4 9545 9729 1485981 82 Linux swap / Solaris
Partition 4 does not end on cylinder boundary.
/dev/sda5 5223 9544 34716402 83 Linux



please help me to get my ubuntu back , i will be grateful , help

Last edited by vibinlakshman; 02-24-2009 at 09:22 AM.
 
Old 02-24-2009, 07:42 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,226

Rep: Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350
Quote:
grub> root (hd0,5)
Quote:
/dev/sda5 5223 9544 34716402 83 Linux
Your fdisk output shows your partitions go up to 5 (sda5) and you are trying to install Grub to root partition of sda6 (hd0,5) which does not exist.

Try: root (hd0,4)
setup (hd0)
quit
 
Old 02-24-2009, 07:54 PM   #8
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Original Poster
Rep: Reputation: 33
Cool

Quote:
Originally Posted by yancek View Post
Your fdisk output shows your partitions go up to 5 (sda5) and you are trying to install Grub to root partition of sda6 (hd0,5) which does not exist.

Try: root (hd0,4)
setup (hd0)
quit


No way dude

grub> root (hd0,4)

grub> setup (hd0)

Error 17: Cannot mount selected partition

Any idea !!
 
Old 02-24-2009, 08:06 PM   #9
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Original Poster
Rep: Reputation: 33
Thumbs down

So no one out there who knws grub editing ..
Oh man this is disgusting , i wonder how do find solutions for these stuffs. I just experimented with grub to make sure every suggestions were true or not ..But failed ..

OK thank u , all who helped me ..

To all new folks , dont try with grub , it will harm u !!!!!!!
 
Old 02-24-2009, 08:59 PM   #10
louieb
Member
 
Registered: Jun 2006
Location: Texas
Distribution: Ubuntu 8.04
Posts: 94

Rep: Reputation: 17
root (hd0,5) would be correct. But from what you have posted something has happened to your /boot/grub/menu.lst if that is correct then post #2 by linuxlover.chaitanya should work. Did you try it? What happened?
Code:
 sudo grub-install /dev/sda
More that most want to learn about grub can be found here. IDBS GRUB Page
 
Old 02-25-2009, 03:44 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
What?

grub-install /dev/sda did not work?

Why? I guess that is what you need. Instead of going into live cd mode if you can enter the rescue mode then it will more useful but even if you are booting off live cd and then in terminal type
Code:
sudo grub-install /dev/sda
that should install boot loader in MBR. And that is what you want I guess.
 
Old 02-25-2009, 03:45 AM   #12
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Post got double posted though I click reply only once.

Last edited by linuxlover.chaitanya; 02-25-2009 at 03:47 AM.
 
Old 02-25-2009, 07:14 AM   #13
vibinlakshman
Member
 
Registered: Dec 2008
Location: Kerala, India
Distribution: Ubuntu 11.10
Posts: 334

Original Poster
Rep: Reputation: 33
Wink Sorry nothing worked...!!

Quote:
Originally Posted by linuxlover.chaitanya View Post
Post got double posted though I click reply only once.
Sorry to say nothing had worked , i was learning bit about how to edit grub , unfortunately i had experimented with my own system , so whatever all my friends posted didnt worked , so i need to install two OS once again normally . Neither grub-install worked , nor the former method .

Dont worry i'll definitely come with this solution , nobody had come across this error , right , thats what the problem ..

Thanks for every one ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub error 17, and wont reinstall using grub-install! chiefreborn Linux - General 6 06-06-2007 10:29 AM
Reinstall grub jaygee02 Ubuntu 4 01-22-2007 02:01 AM
meauto uninstalled - NEED to reinstall, PLZ help tom_mcfadden MEPIS 7 09-16-2005 10:09 AM
reinstall windows, reinstall GRUB too? leupi Linux - Software 1 05-07-2005 10:50 AM
Reinstall GRUB Staticreator Linux - Software 0 08-10-2003 04:14 PM


All times are GMT -5. The time now is 04:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration