Grub Error: 22 after re-install dual boot... noob

Asked by jetandein

I had a good running Ubuntu 8.04 that could dual boot to windows XP... I bought a new monitor (actually a wide-screen t.v.) and it wouldn't display Ubuntu properly. A bunch of people tried to help and got stumped on how to fix it so I decided to just reinstall Ubuntu to see if that would help.

I put in my Ubuntu CD and when I got to the partition step I told it to reformat the / partition and told it where my home partition is and not to reformat and didn't tell it about any other partition or hard drive.

It went through the rest of the install process fine and told me to restart so I did and when it got to grub it gives:
Error: 22 Partition not found
or something close to that... It also does it for recovery mode. For windows it say something like:
ntldr is missing press: ctrl alt delete to restart

So now I am here using the Ubuntu Boot CD... Please help!

I also checked using the boot CD and my drives and partitions are still there... I did get scarred for a minute that all my pictures and movies would be gone but they're not...

Also I warn you that I know very little about Linux so if you could be very detailed in your instructions to fix this problem that would help a bunch!

Thanks in advance!
Jon

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu grub Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Zied ALAYA (zied.alaya) said :
#1

Good morning Jon,
Begin by fix your boot on Windows:
 - boot your windows CD install, then in the mode command type: fixmbr

Now try to reintall your Ubuntu.

I don't know a lot why you have this error since you did a new install.
in deed, generally we have this error when the partition where the OS is deleted.

Revision history for this message
Tom (tom6) said :
#2

Errr, i'm not sure about this Windows disks tend to reformat by default
https://help.ubuntu.com/community/DataRecovery

Revision history for this message
Tom (tom6) said :
#3

I think Zied meant to say just try booting into the Windows on your HARDdrive, not using the cd or recovery disk! I would start (as i often do) by checking the hardware. Has a lead become dislodged? Can you open the case (with the mains power turned off) and touch the metal outsides of the case to remove static from your fingers, then make sure the leads into the hard drives are secure.

Good luck and take care with this!
Regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#4

Ahhh sorry chaps. I didn't see the part you said about having a boot cd! Sorry Zied! That was the right answer. Poking around inside the case is risky and it's probably best to avoid it if possible.

Apols, good luck and regards from
Tom :)

Revision history for this message
jetandein (jetandein) said :
#5

Well now I'm confused...
What do you mean by:
"boot your windows CD install"???

Are you talking about a different CD then the one that lets you use Ubuntu off of the CD drive? That is the only CD I have... also I know that it is not hardware issue as i can access the drives fine off the boot CD... I'm pretty sure the problem is that Grub is looking in the wrong place or something...

Revision history for this message
Tom (tom6) said :
#6

Right. That's answered a few things i was worried about. Thanks :)

I think now it might be worth trying to fix the grub problem by reinstalling grub! Boot up the Ubuntu Cd and get to a working desktop, we call this a "LiveCd session", go up to the top taskbar (panel) and click on

Applications - Accessories - Terminal

and into the terminal/command window/console type

sudo grub

it asks for your normal user password, not your SuperUser/Root one. That's the sudo part. The grub part opens up a grub command-line which is different from the normal linux command-line. On this try ...

find /boot/grub/stage1

This should tell us where the grub is at the moment, something like (hd1,2) now use the numbers that your machine gives you to try this but my example of (hd1,2) is very unlikely to be right on your machine. Grub is meant to be read by the macine and so it counts from 0. So your 1st hard-drives 2nd partition is (hd0,1) but in linux it would be sda3 (or in some other distros it might be hda3). Anyway back to my example ...

root (hd1,2)

setup (hd0)

quit

That should get you bcak to the normal linux command-line and allow you to reboot into Ubuntu?
Good luck and regards from
Tom :)

Revision history for this message
jetandein (jetandein) said :
#7

I booted using the CD opened up a terminal and typed:

sudo grub

it didn't ask for a password... It just opened up the boot prompt and I typed:

find /boot/grub/stage1

It said:

(hd2,2)

So I typed:

root (hd2,2)

and then typed:

setup (hd0)

It said a bunch of things with "success" and "yes" after it and then I typed:

quit

I rebooted and it got to grub and gave the usual:

Error: 22 Partition not found

message... that give you any ideas?

Revision history for this message
Tom (tom6) said :
#8

Right, so you can boot into a LiveCd which can see the drive and can even manage to install grub onto the drive but you still can't boot into Windows or anything else?

I would seriously backup your pictures and everything onto external drive or dvd's or something. I have a friend that always only starts his backing up when he hears grinding noises coming from his drive. At least this doesn't seem that serious but it's got to be a good plan to back-up now!

It might be easier if you could free the cd/dvd drive by using a different distro that could load into ram rather than run off the cd all the time. For this i would use either sliTaz or Wolvix Hunter (or Cub)
http://distrowatch.com/table.php?distribution=wolvix
definitely something i could find a cd/dvd burner in if i wanted.

Good luck and regards from
Tom :)

Revision history for this message
jetandein (jetandein) said :
#9

Well I have about 200 gigs of stuff on the drive so I think backing up is out of the question... Is there a way to find out what Grub is doing to see if it is looking in the wrong place?

Revision history for this message
Tom (tom6) said :
#10

You've just installed it carefully making sure it points to the right place. That was what the "find ... stage1" was about. Sorry, i didn't explain that at the time because i'm still a bit hazy on what those commands do.

Ok, in a LiveCd session go up to the "Places" menu on the top taskbar (panel) and look through the "media" until you find the Ubuntu one. Open the "boot" folder and then the "grub" one and open "menu.lst" all the lines starting with # are ignored, we call them "commented out" so most of the useful stuff is right down at the end.

I'm too tired now but maybe we could have a go at editing this tomorrow. You use the firefox web-browser on the LiveCd to navigate straight into this thread in launchpad don't you? that usually makes things easier.

Another simpler answer might be to just install Ubuntu to another space on your drive. Ideally you'd need 15Gb free to do that but i'm using 10Gb with no troubles at the moment. Just follow these 'dual-boot' instructions and let it's grub rewrite the mbr again and hopefully it will give you options for booting into Xp and trying the old Ubuntu too lol
https://help.ubuntu.com/community/WindowsDualBoot

Good luck and regards from
Tom :)

Revision history for this message
jetandein (jetandein) said :
#11

Well I took out most of the begging as it had a lot of #s and this is what was left:

title Ubuntu 8.04.1, kernel 2.6.24-19-generic
root (hd2,2)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=04647a1c-0f3c-4096-98d7-864896b39a5d ro quiet splash xforcevesa
initrd /boot/initrd.img-2.6.24-19-generic
quiet

title Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
root (hd2,2)
kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=04647a1c-0f3c-4096-98d7-864896b39a5d ro single
initrd /boot/initrd.img-2.6.24-19-generic

title Ubuntu 8.04.1, memtest86+
root (hd2,2)
kernel /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdc1
title Microsoft Windows XP Professional
root (hd2,0)
savedefault
makeactive
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1

Revision history for this message
jetandein (jetandein) said :
#12

So I figured something out...

I let my comp get to grub and I hit e to edit and then where it said (hd2,2) I tried a few different #s and changing it to (hd0,2) booted up to Ubuntu and it even had my old background and everything. So now all I need is a way to get it to do that automatically... I haven't tested out if I can get windows to boot but will try soon. Any suggestions on how to get it to boot to the right partition on the right drive every time?

Revision history for this message
Tom (tom6) said :
#13

Applications - Accessories - Terminal

into the terminal/command window/console enter

cd /boot/grub
ls
sudo cp menu.lst menu.010509
ls
sudo gedit menu.lst

note the "ls" is lower-case "LS" and shows a LiSt of what's in the folder, the second one should show that the CoPy command created a new file with a date-stamp as a backup copy of the menu.lst file. The first "sudo" command will ask for your normal user password, not your SuperUser/Root one but wont let you see stars or anything to give-away how many letters you have typed in - for security reasons. The second one probably wont unless it's taken you over 15minutes to type in "ls" lol. In the gedit text-editor it should be easy to change the "root (hd2,2)" to "root (hd0,2)". Also change the Ubuntu parts that say "generic root=UUID=..." to "generic root=/dev/sda3"

Hopefully this hould completely fix it. Otherwise boot up a LiveCd and use the CoPy command in the same way as before but swap it round so the old menu.lst gets put back to the way it was.

Good luck and regards from
Tom :)

Can you help with this problem?

Provide an answer of your own, or ask jetandein for more information if necessary.

To post a message you must log in.