Skip to content

Grub

It happens ever so often you want to reinstall grub, here is a way to get it done with the live cd for debian.

First boot into the live cd, and open a root terminal.

install grub-pc

Now in debian. grub does not seem to be installed, so setup the network and issue :

install
apt-get update apt-get install grub-pc

It will probably fail, because the disk is not mounted. Untried : do this next bit first ?

mount the correct partition.

Of course i presume, there once was a working grub installation on one of the disks since it called it 're-install' so identify which disk with

list disks
fdisk -l

Mainly you would want to mount the disk :

mount
mkdir sda5 mount /dev/sda5 sda5

And you could try to chroot and run update-grub now, but that left me with this error :

error
grub-probe: error: cannot find a device for / (is /dev mounted?)

To resolve this, mount some more system directories first before changing root :

more mounts
mount -o bind /dev /sda5/dev mount -o bind /dev/pts /sda5/dev/pts mount -o bind /proc /sda5/proc mount -o bind /run /sda5/run mount -o bind /sys /sda5/sys chroot sda5 /bin/bash update-grub

MBR

Now if you still don't get a grub screen it might be because windows is still in the way. You could fix that by running :

You could always save the complete MBR with :

save the MBR first
dd if=/dev/sda of=MYMBR bs=512 count=1

Now destroy it.

Master Boot record
fdisk /MBR

From windows, however the xp version i installed did not have that command. It can be done on linux as well, by clearing the MBR's code.

clearing the MBR
dd if=/dev/zero of=/dev/sda bs=446 count=1

The MBR is code up to byte 446, where the partition table starts. So do not write more that that !!!

To be on the safe side.