LinuxQuestions.org
Help answer threads with 0 replies.
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 05-01-2006, 01:46 PM   #1
Parmeisan
LQ Newbie
 
Registered: May 2006
Location: Canada
Distribution: Ubuntu
Posts: 5

Rep: Reputation: 0
Deleted partition causing boot problems


Hi.

My system was previously set up as a dual boot with WinXP (hd1) and Ubuntu (breezy badger, hd2). As is probably common, hd3 and hd5 were being used for the swap. My problem started when I needed to give more space to the Windows partition. GParted wouldn't let me decrease hd2 and then use that space for hd1 (not surprising, since the used data meant that the new space had to be non-contiguous with hd1) so I went and decreased hd2, copied all that data into the new space (hd4) and then deleted it and increased hd1. Yes, I know that it was stupid to try resizing it in the first place, and even stupider to do the copy and delete in one session without checking the data first, but the fact is it's done.

Now when GRUB starts I get an Error 22 from which I can do nothing. What I *can* do is boot to a LiveCD version of Ubuntu, from which I have been able to access hd4 by mounting it. (For anyone in a similar situation, type "sudo mkdir /mnt/four" and "sudo mount /dev/hda4 /mnt/four" though you would have to substitute hda4 for whichever you need, and "four" can be substituted by a different folder name as desired). I have also created a boot floppy of grub which has (from advice in linuxquestions.org/questions/showthread.php?t=359223) enabled me to successfully boot Windows. All my data is preserved there, too, which leads me to believe the problem is with grub or the bootloader. However when I try to boot Ubuntu the same way, I get the following errors:

Quote:
grub> root (hd0,3)

Filesystem type is ext2fs, partition type 0x83
(This when gparted clearly tells me that the filesystem type is ext3)

and

Quote:
grub> chainloader +1

Error 13: Invalid or unsupported executable format
... which would lead me to believe the problem is worse. Also, I've tried changing menu.lst and even fstab, to no avail, though I'll freely admit I could be doing it wrong. Anyway, if those commands above don't work straight off the grub command line, I doubt that running similar commands from menu.lst is going to do any better. (For those unfamiliar with Ubuntu, menu.lst seems to be the same as what grub.config is in other distros).

So, I know all my stuff is still there. Surely there's some way to fix the bootloader so that I don't have to remount each time? (I'd rather not have to reformat, even though I backed up everything I need, even before partitioning).

Thanks!
 
Old 05-01-2006, 02:06 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
This is very confusing.
First, what partitions do you have now--including sizes? (And the total size of the harddisk)

If you can boot Windows from a GRUB floppy, it means that there is a "menu.lst" file somewhere. In the Linux install, it should be in /boot/grub. Please post the contents of that file. In the SAME PARTITION--in /boot, you should see a kernel file (vmlinuz) and maybe a file like "initrd". Assuming that these files are in place, we then need to look at "menu.lst" to see if the references are correct. (Since you have been moving things around, chances are that they are not.)

If things get too messy, you may need to re-install Linux.
 
Old 05-01-2006, 02:25 PM   #3
Parmeisan
LQ Newbie
 
Registered: May 2006
Location: Canada
Distribution: Ubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
The partition sizes I will have to log into gparted to get because I'm not experienced enough to know another way, so I'll get back to you with that when I've had a chance. But I can tell you that it's *approximately*:
hd1: WinXP ~8GB
hd2: nonexistant
hd3: something to do with swap, ~500MB
hd4: Ubuntu ~11GB
hd5: "subpartition" (appears under hd3 with gparted), ~500MB
(Total is 20GB)

The menu.lst file originally read:

Quote:
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specifiv kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
# kopt=root=/dev/hda2 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,1)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery mode) single
# altoptions=(recovery mode) single

## nonaltoption boot targets option
## This option controls options to pass to only the
## primary kernel menu item.
## You can have ONLY one nonaltoptions line
# nonaltoptions=quiet splash

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## ## End Default Options ##

title Ubuntu, kernel 2.6.12-9-386
root (hd0,1)
kernel /boot/vmlinuz-2.6.12-9-386 root=/dev/hda2 ro quiet splash
initrd /boot/initrd.img-2.6.12-9-386
savedefault
boot

title Ubuntu, kernel 2.6.12-9-386 (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.12-9-386 root=/dev/hda2 ro single
initrd /boot/initrd.img-2.6.12-9-386
boot

title Ubuntu, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin
boot

### 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/hda1
title Microsoft Windows XP Home Edition
root (hd0,0)
savedefault
makeactive
chainloader +1
though it now reads:

Quote:
.
.
.
title Ubuntu, kernel 2.6.12-9-386
root (hd0,3)
kernel /boot/vmlinuz-2.6.12-9-386 root=/dev/hda4 ro quiet splash
initrd /boot/initrd.img-2.6.12-9-386
savedefault
boot

title Ubuntu, kernel 2.6.12-9-386 (recovery mode)
root (hd0,3)
kernel /boot/vmlinuz-2.6.12-9-386 root=/dev/hda4 ro single
initrd /boot/initrd.img-2.6.12-9-386
boot

title Ubuntu, memtest86+
root (hd0,3)
kernel /boot/memtest86+.bin
boot
.
.
.
Neither works.

fstab originally read:

Quote:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda2 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 none swap sw 0 0
/dev/hdb /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
and currently reads:

Quote:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda4 / ext3 defaults,errors=remount-ro 0 1
/dev/hda5 none swap sw 0 0
/dev/hdb /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
The files in boot are:
abi-2.6.12-9-386
config-2.6.12-9-386
initrd.img-2.6.12-9-386
memtest86+.bin
System.map-2.6.12-9-386
vmlinuz-2.6.12-9-386

And boot/grub:
device.map
e2fs_stage1_5
fat_stage1_5
jfs_stage1_5
menu.lst
minix_stage1_5
reiserfs_stage1_5
stage1
stage2
xfs_stage1_5

Thanks for the quick reply and I hope this other information helps. I'll try to post the sizes within a couple of hours but I have a meeting coming up and I'm not sure how long it will take. If there's anything else you need to know, maybe I can grab that at the same time.
 
Old 05-01-2006, 05:21 PM   #4
Parmeisan
LQ Newbie
 
Registered: May 2006
Location: Canada
Distribution: Ubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
hd1: ntfs, 10.18GiB
hd4: ext3 (apparently), 7.89GiB
hd3: extended, 572.63MiB
hd5: linux-swap, 572.60MiB (This is inside of "extended")
hda totals 18.63

That leaves 0.81MiB unaccounted-for.

I should also mention that this Error 22, it happens right after the text comes up that grub is loading - no menu or anything - and that commenting out the Ubuntu versions (everything shown in the second quote box above) gives the same error, as does changing it to hd0,3 and hda4 respectively. Nothing I've done has affected the error that grub - the one that loads automatically when I press power - gives. The other grub, the one I'm loading off of a disk, gives me a command line and, as mentioned, succeeds in booting hd0,0 but doesn't know what to do with hd0,3. hd0,1 it tells me doesn't exist (no surprise there) and hd0,2 it will try to load but not do anything, at least not right away. I stopped it because I didn't think loading the swap partition was really a good idea, I just needed to make sure I had the right number with hd0,3.

May also be relevant that this is a Dell Latitude laptop - posted here and not the laptop section since Newbie seemed to be the more important thing here.

Quote:
If you can boot Windows from a GRUB floppy, it means that there is a "menu.lst" file somewhere.
To make the floppy, I used the site ...* (since I couldn't get the commands listed elsewhere on the 'net to do anything for me) and the altered menu.lst from /mnt/four/boot/grub. (So if it's using this, then why do I get Error 13 instead of Error 22??)

For reference's sake, (from ...*)
Quote:
13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).

22 : No such partition
This error is returned if a partition is requested in the device part of a device- or full file name which isn't on the selected disk.
Questions:
- Is there an easy way to just change the name of the partition?
- Do you think (part of) the problem is because it's not ext3, as it says? If so, can/should I change this?
- Might reinstalling Grub do anything? Would it automatically rewrite its menu.lst file for me?


* For some reason it's no longer letting me link. Guess I need to have 3 posts before I can do that. So I'll try to remember to provide these links when I post again.
 
Old 05-01-2006, 06:18 PM   #5
Parmeisan
LQ Newbie
 
Registered: May 2006
Location: Canada
Distribution: Ubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
Hi, it's me, *again*.

Links from previous post:
* i30www.ira.uka.de/~ud3/mkgrubdisk/
** http://www.gnu.org/software/grub/man...e2-errors.html

Link that eventually led to the temporary solution I'm about to post:
http://www.linuxforums.com/forums/lo...p/t106101.html

I can't believe it took me so long to try this, but I finally typed in the lines

Quote:
root (hd0,3)
kernel /boot/vmlinuz-2.6.12-9-386 root=/dev/hda4 ro quiet splash
initrd /boot/initrd.img-2.6.12-9-386
boot
just like in the menu.lst file, only into the grub command line (via the floppy). I was expecting to at least be able to pinpoint the error, but what happened is that it booted perfectly. Now the question is, how do I automate this? Clearly the menu.lst file is not being accessed correctly by Grub, or some other error that is preventing those commands from being run as expected. Considering that the error I'm getting is telling me that the partition doesn't exist, perhaps there's another file that needs to also be changed?

Also, if you're going to tell me to reinstall Grub, I'm going to need help with that.

Thanks again!
 
Old 06-22-2006, 10:14 AM   #6
Parmeisan
LQ Newbie
 
Registered: May 2006
Location: Canada
Distribution: Ubuntu
Posts: 5

Original Poster
Rep: Reputation: 0
Someone where I work noticed me typing all that stuff to load linux, and he was able to tell me how to fix Grub.

In my particular case, I just had to type into the terminal:
"sudo su" to switch to root, then typed in my password
"grub" to run grub
"root (hd0,3)" to tell grub where my linux partition is
"setup (hd0)" to reinstall grub onto the main part of the hard drive
"quit" to exit grub

Of course it's also important that menu.lst be fixed. And then it works! w00t!

A good explanation can be found here: http://www.sorgonet.com/linux/grubrestore/

PS. I'm sorry that this thread is so convoluted, and perhaps I should have started a new thread when I better understood what the problem was. But at least now anyone in a similar position to mine might realize faster what they need to do.
 
  


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
Deleted linux partition, how to boot Windows partition? mysak Linux - General 3 12-14-2005 04:22 PM
deleted linux partition adn the boot loader was deleted also,now i have only gnu grub boris199 Linux - Laptop and Netbook 2 01-29-2005 04:53 PM
accidently deleted /boot partition :( aditya_ic Linux - General 7 07-29-2004 02:37 AM
Deleted XP partition - Can't boot linux mansonmuni Linux - Hardware 6 12-25-2003 11:18 PM
Linux Partition deleted -- how to boot now?? tacSHooter Linux - Newbie 2 12-26-2002 01:10 PM


All times are GMT -5. The time now is 01:55 PM.

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