
On Sat, 28 Sep 2013 18:42:32 +1000, Craig Sanders <cas@taz.net.au> wrote:
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
It was always my understanding that /boot was just a directory in /. here is the disc layout Device Boot Start End Blocks Id System /dev/sda1 2048 40962047 20480000 83 Linux /dev/sda2 40962048 229378047 94208000 5 Extended /dev/sda3 229378048 234440703 2531328 82 Linux swap / Solaris /dev/sda5 40964096 229378047 94206976 83 Linux I thought I'd try "mount /dev/sda2 /mnt/boot" just to see what happens, and when I do I get... "mount: you must specify the filesystem type" , so thought it best to not separately mount /mnt/boot
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
went through the whole process, purged grub and reinstalled. "apt-get install grub" says it is going to install grub-legacy, which doesn't seem right, so installed grub-pc instead, but at the end of the installation it pops up a screen asking if I want grub installed on /dev/sda (and displayed ???) or /dev/sda1 (which it thought was /), neither worked, so I had to try a manual install, which said no errors. On reboot, I have the "grub>" prompt. So, given the disc layout above, which I recall was about 20GB for / and about 90GB for /home, do you still think I should be separately mounting /mnt/boot, and, was it correct to install grub-pc, or should I have installed grub-legacy? Many thanks for your help (and to all the others who have been helping as well), but it seems that we are not there yet. Hopefully some of the above will provide some more clues to those of you with knowledge of these things Cheers, -- Regards, Terry Duell