Matthew Rosewarne on 28 Jul 2008 07:53:23 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] reinstalling grub


On Sunday 27 July 2008, Art Alexion wrote:
> I have been frustrated in my efforts to revive my Kubuntu Hardy system. 
> While I am hoping that grub is the sole issue, there is an unlikely
> possibility that there is a problem with the primary SATA hard drive.  The
> drive (sda) has three partitions: sda1=/boot, sda2=/, and sda5=swap.  sda1
> & 2 are ext3, sda1 being primary and sda2, LVM.

Out of curiosity, why is swap on a separate partition, instead of just being 
on an LV?

Also, just for the sake of clarity, you shouldn't think of / as being on 
/dev/sda2, since it's actually on LVM.  As far as the machine is aware, 
/dev/sda2 is a PV and / is on /dev/mapper/chubby-root.
	
> I tried restoring grub by booting a feisty or gutsy alternate install disk,
> using the restore boot and executing 'grub-install /dev/sda1'.  It would
> find /boot and then hang.  Eventually I found a pseudo-gui ncurses "install
> grub feature that seemed to work, but when I tried booting, it got stuck
> repeating "Loading stage 2".
>
> Thinking this may be related to trying to use an older version than
> currently installed on the hard drive I burnt hardy regular and alternate
> install disks.  The alternate install seemed to freeze on 'grub-install
> /dev/sda1', and the gui-like command wanted to partition the drive first.
> The 'ls /dev/sda<tab> showed the partitions, and the partitioner saw them
> as well.  The lvm '/' partition showed up twice, as sda2 and
> as /dev/mapper/chubby/root.
>
> Booting from the regular live install gave me access to the full array of
> command line to run grub-install, but from konsole, the command failed,
> with the error that it couldn't fine /boot.  Konqueror's media:/ kio saw
> the boot partition and mounted it, showing all the files that I expected
> there.  It did not show the kvm '/' partition.

Unless you did it in a chroot, /dev/sda1 would not be mounted as /boot.  When 
you were using the alternate install cd, it was probably trying to use the 
cd's /boot instead of sda1.  When using the live install, /dev/sda1 was 
probably mounted at /media/sda1, and LVM was probably not active.

> I gound a web page that suggested running
> # grub
>
> > root (hd0,0)
> > setup (hd0)
>
> grub found hd0 with the <tab>, but couldn't find boot.  I went through and
> tried all of the hd's incase sda was't hd0 (there is also an hda on the
> system) with the same result.

Bear in mind that if you have a separate boot partition, it won't show up as 
"(hdX,Y)/boot" (that would be /boot/boot!).  The /boot partition would 
presumably have contents like "(hdX,Y)/grub/" and 
"(hdX,Y)/vmlinuz-2.6.25-2-646".

Also note that "root (hdX,Y) is actually specifying where grub should look for 
its root, so it means /boot instead of /.

> Yep, I don't have a recent backup of /home and didn't save it in a separate
> partition, so I don't want to repartition and blast everything.

Well, if you don't manage to get the thing to boot, you can still get your 
data off the LV (so long as the disk is still OK).

> Please give me your thoughts on the following points:
>
> * Is there something I am missing in the above steps?

You should probably be running grub-install in a chroot if you aren't already.

How to set up and enter the chroot:
	mkdir /{chroot-dir}
	mount /dev/mapper/{VG-rootLV} /{chroot-dir}
	mount /dev/sda1 /{chroot-dir}/boot
	mount /dev /{chroot-dir}/dev -o bind
	mount /proc /{chroot-dir}/proc -o bind
	mount /sys /{chroot-dir}/sys -o bind
	chroot /{chroot-dir} /bin/sh

> * Does the lvm have something to do with my problem?

No, anything dealing with / is handled by the kernel, not grub.

> * I'd like to try backing up the "/" partition and reinstalling the system,
> but wonder about the easiest way to do this as the live CD doesn't see it.

LVM was probably not ac	tive; try running "vgchange -a y".  If it doesn't find 
the vgchange program, you need to install the "lvm2" package.

> * Would knoppix do any of this better? I don't have a copy at home.

Probably not, they're both Debianish.

> * any other suggestions?

Watch out for snakes!

Attachment: signature.asc
Description: This is a digitally signed message part.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug