how to reinstall grub

Martin Laberge mlsoft at videotron.ca
Fri Nov 21 22:46:30 UTC 2008


On Friday 21 November 2008 14:33:48 nepal wrote:
> My next task is to install grub again. 
> As my hd0 is the drive I have had problems with, is it best 
> to install grub to the boot sector of my second drive, and 
> would I refer to it as hd1?
> 
> i.e. grub-install hd1.
> 
> should I run --recheck as an option.
> 
> I can set the second drive to be checked first in the boot 
> sequence within the bios until I have the problems with hd0 
> sorted out. Is this the best way for now?
> 
> nepal.
> 

if your hd0 is failing (problems with)
then you should remove the hd0 from your computer.

then the only disk (hd1) will have to be set as the first and only disk (hd0)
with jumpers sometime, without jumpers some other time, depending of your bus and cables.

when your only one good (hd0) disk is in place,
reboot with a ubuntu/kubuntu cdrom, and go to the try ubuntu mode.

then open a konsole, sudo bash, and do the following

sudo bash			# you sudo to a bash prompt
password: xxxjjxhhxh		# you enter the password if needed (not needed on cdrom boot image, 
				# but yes, if done from another bootable disk) (and it is not xxxjjxhhxh the real password, lol)
mkdir /mydisk			# you create a place to mount your system you want to be bootable
mount /dev/sda? /mydisk		# you mount the partition containing a bootable system, in this place 
				# (please replace the sda? by sda[and the real partition number you want]
cd /mydisk			# you are in the partition you want to be bootable
chroot /mydisk			# you change the root directory for all the next commands until you exit
grub-install /dev/sda		# you install grub to the first disk boot sector, and tell it to boot my now root system
exit				# you return to your original root
reboot				# you reboot, (what a surprise!) and remove the cdrom

then, you watch it reboot, and startup again with the system you wanted to be the master one.

(dont forget, this disk may have many systems on it (dual/trial/... boot) but you choosed one to be the master one)

after this, you have one of your partitions who is the master one, 
and can modify the menu.lst at your will, to include other systems to be bootable too)

-- 
Martin Laberge
mlsoft at videotron.ca
Tel:(418)521-6823
30 Years of Unix Admin, and still learning...




More information about the kubuntu-users mailing list