LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   altered partition table, Grub2 will not load, how-to chroot? (http://www.linuxquestions.org/questions/linux-general-1/altered-partition-table-grub2-will-not-load-how-to-chroot-699424/)

kyrand0047 01-23-2009 02:38 PM

altered partition table, Grub2 will not load, how-to chroot?
 
I have a multiple linux setup. it worked well, but after change of partition table grub2 will not load. (cannot read partition table) am trying to chroot back in to do an os-probe in order to update-grub.

original os: debian/lenny on sda11 (which was sda14 before partition table change... I feel like a right monkey)

currently running ubuntu 8.10 live cd. all is amd64.

the live cd does os-probe correctely (after grub2 install).

however, i am able to chroot into sda11 (which seems to mount okay - possibly ext2 instead of ex3) but i can't use os-prober: error message is "cannot find list of partitions!"

any help is apreciated!


my immediate thoughts are: could I just edit some config files so that sda14 is changed to sda11? or.... possibly that would be all that is required to get the system rebooting?

ajlewis2 01-23-2009 03:06 PM

You probably can boot using grub command line.
http://linuxbasics.org/tutorials/adv...b_command_line

Once you are booted into lenny, you can then you can run 'update-grub' from the command line and then 'grub-install'. That should rewrite a proper menu.lst and then install grub again into the mbr. Normally I would not reinstall it in the mbr, but since you have actually rewritten the partition table, it might be a good idea.

kyrand0047 01-23-2009 03:15 PM

ahhh yes, if it was grub legacy....
 
I had a look at your link, an none of the commands seems to work. hence the tag grub_2_.

Actually i am thinking of some way of rewriting the mbr with grub legacy in order to boot the system. but as of yet i am unsure....

by-the-by the link was great, much that i didn't know about grub!

but if i'm completely off the mark (though the commands in the linked tutorial does not work on my

grub rescue>

from grub2) do tell me...

the only commands that are available in grub rescue are, according to its help:
boot
cat
dump
exit
help
insmod
ls
lsmod
rmmod
root
set
unset

other than that, no commands seems to be accepted

ajlewis2 01-23-2009 03:57 PM

Quote:

Originally Posted by kyrand0047 (Post 3418921)

however, i am able to chroot into sda11 (which seems to mount okay - possibly ext2 instead of ex3) but i can't use os-prober: error message is "cannot find list of partitions!"

Since you are able to chroot into sda11, then you could run the update-grub and grub-install from there.

I don't know os-prober. Is that found on your lenny install as well as the live cd? I ask, because you said you ran it while chroot on the lenny system.

You may also run into the problem of /etc/fstab in lenny having the wrong partition number listed for / and possibly other partitions if you have them mounted at boot. You'll want to edit that as well.

You may want to use a grub disk: http://www.supergrubdisk.org/index.php?pid=6 I have seen them in other places, but found this just now in google. That way I think you will have all the commands available.

kyrand0047 01-23-2009 05:31 PM

I think, again, that there are important differences between grub legacy (0.96) and grub2 (1.96). your links provide nice info, but after trying them out there is no response.

am currently trying to install a new version of lenny on a spare partition to see if I can overwrite the mbr that way..

but to follow up: the relevant grub commands work on the live cd, however, I don't seem to be able to find the right directories to bind in order for the commands to work on sda11 -- I keep getting the reply "cannot read partitions"

_anyways_: am currently installing a new version of debian on sda8 in order to see if I can fix the problem from that angle. However, I am still very much interested in suggestions as to how I should get out of the, perhaps, badly described predicament

ajlewis2 01-23-2009 05:43 PM

I thought that if you make a grub disk from that site, it would be legacy grub and the commands would work to allow you to boot. I'm wondering why it would not. I do understand what you mean about not being able to use the commands on grub2. I have not used the grub commandline with grub2 as far as I know.

I have used a grub floppy to boot Linux on a system that would not load grub, however. But your idea of installing debian on another partition should fix it. Good idea.

kyrand0047 01-23-2009 05:58 PM

thanks for your "emotional support",

I'm no grub-wiz but all I know is that the grub-commands that I listed are the only ones that I can use. AND, they don't seem to do the job, at least not according to your links (they always seem to use some grub(-legacy?) commands that doesn't work for me.

but as I said, and thanks for supporting the idea, installing lenny on another partition - I hope - will work.

keep you posted :)

still.... if anyone has a grub2 "grub rescue"-related idea, that's going to be very much appreciated since i am thinking to migrate to grub2 on a prety much permanent basis. (grub-invaders is just toooooo niiice :) lol)

kyrand0047 01-23-2009 06:14 PM

big ouch!!!!

apperently did the mistake of installing grub2 via the lenny-installer. this ended up giving me the error: " you need to load the kernel first" on all the correctly detected drives/kernels. strange.... I'm giving up for the night.... But, will report back later (most likely after a re-install odf lenny on sda8 but this tim using grub-legay instead of grub2)

thanks for now ajlewis2....

kyrand0047 01-25-2009 07:55 AM

Ok, have decided drastic measures.... although im able to boot most of my partitions, the partition table is giving me troubles. So, as the machine is not absolutely essential for me I am going to scrap it and start from scratch.

(if nothing, I have learned that messing about with logical partitions and their numbering can really screw things up :( )

syg00 01-25-2009 08:09 AM

Is grub2 now considered stable ?.
I haven't allowed it on any of my systems yet - must have a look at it on a stand-alone test system one day.

ajlewis2 01-25-2009 10:01 AM

Quote:

Originally Posted by kyrand0047 (Post 3420529)
(if nothing, I have learned that messing about with logical partitions and their numbering can really screw things up :( )

You are not the first to find this out. I remember fondly my own first and last experience doing the same thing. :-) I'm glad you do not have a big data loss, etc.

jwyllie83 02-25-2011 05:57 PM

Fixed
 
In case anyone stumbles on this and needs an answer, I figured out the problem.

This error message is in os-prober, called from update-grub. It triggers if /sys/block is missing, which it is if you forget to mount /sys in your chroot'd environment.

Type the following, outside of the chroot environment:

mount -o bind /sys /path/to/chroot/sys

and you're good to go.


All times are GMT -5. The time now is 09:22 PM.