On Sat, Sep 28, 2013 at 01:56:16PM +1000, Terry Duell wrote:
> I haven't explicitly mounted /boot on /mnt, as previous advice never  
> mentioned this.

this may be where you are going wrong.

if you are trying to reinstall grub, then it needs access to not only
your root filesystem, but your /boot directory as well. if /boot is
just a directory on / then mounting / alone as /mnt will be sufficient.
if /boot is a separate partition, then it must also be mounted, as
/mnt/boot.

for example, if your rootfs (/) is /dev/sda1 and your /boot is /dev/sda2
then to get to a good, working chroot environment for fixing a broken
grub you'd do something a lot like this:

1. boot a live cd and get a root shell. if your installed distro is
64-bit then your live-cd must also be 64-bit otherwise you will not be
able to chroot into it. i tend to use clonezilla because it has 64 and
32 bit versions and has every repair tool you might ever need. sometimes
i use gparted.

2. run the following commands:

    mount /dev/sda1 /mnt
    mount /dev/sda2 /mnt/boot
    for i in proc dev sys dev/pts ; do mount -o bind /$i /mnt/$i ; done
    chroot /mnt

3. now you can fix your system.  e.g. by installing and/or configuring grub2.

running 'grub-install /dev/sda' may be sufficient.

if your grub config is completely hosed, you may find it better/easier
to just purge all currently installed grub packages and start from
scratch:

    dpkg --force-depends --purge $(dpkg -l '*grub*' | awk '/^[hi]/ {print $2}')
    apt-get install grub

note, though, that this scorched-earth purge and reinstall will only
work if you either still have the downloaded grub packages in your
/var/cache/apt/archives directory, a convenient debian-installer CD/DVD
to get the packages from, or if you have a working internet connection
from your live CD.

4. anyway, when you have finished fixing your grub configuration, you
need to unmount the filesystems (in the reverse order you mounted them)
and then reboot.

    exit   # exit from the chroot.
    for i in dev/pts sys dev proc /boot / ; do umount /mnt/$i ; done
    sync
    shutdown -r now



BTW, the above is tested and known to work for many boot problems - i've
done repairs like this so many times on so many different systems now
(both real and vm) i can do it entirely from memory (although i have
helper aliases defined in my PXE-bootable clonezilla). steps 1, 2 and
4 are the basis of pretty nearly every rescue/repair operation. step 3
varies according to the nature of the problem.


> which said there were no errors, however a reboot doesn't give a grub  
> menu, just provides a grub prompt ie "grub>".

that sounds like grub without a config file. which is about what you'd
expect if you didn't have /boot mounted when you ran update-grub or
grub-install.


craig

-- 
craig sanders <[email protected]>
_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to