PDA

View Full Version : Grub and MBR



grandad
02-22-2009, 02:12 PM
Hi Guy's. I have had a lot of problems since I installed onto my USB Hard Drive. My hard drive got mangled and I am stuck with Grub interfering with my Win XP boot.

I have backed up my MBR and using the Knoppix 'Live' cd have entered the following.

dd if=/dev/null of=/dev/hda1 bs=446 count=1

I thought that this would remove Grub and leave me with a clean MBR. But I keep getting refered to the dd--help files which are not being a whole lot of use to me.

Could one of the knowlegeable members please tell me if I have written this command correctly and if it is the right one to get rid of Grub from my MBR. Much appreciate any help you can give me on this. It is more than a bit worrying. Thanks Grandad Walt

hal8000
02-22-2009, 03:30 PM
Hi Walt.
What that command does is write 0's from (dev/null) into the master boot record but keeping your partition table intact.
This will get rid of grub but you wont be able to load windows as you have no bootloader now.

So, to get XP back, start with either Knoppix 5.1.1 or Knoppix 5.3.1
Install a Debian programm called install-mbr

From a terminal (make sure network is configured and working)

su
apt-get install install-mbr

install-mbr /dev/hda

Notice that the command is /dev/hda this installs new standard bootloader code into the mbr of the first hard drive.

After this windows should load, however it may be worth checking that the partition (windows always likes the first partition is set to active)
so, still as root:

fdisk /dev/hda

type p to print the hard drive partition table, there should be an * against your windows partition. If not, press a, then 1 (or window partition)
then w to write changes and reboot.

More info on install-mbr below
http://pwet.fr/man/linux/administration_systeme/install_mbr

Replace hda with sda if your internal hard drive is sata. You now have to reinstall grub to load linux. This experience is something
most linux users go through, some more than others. Hope that helps.

grandad
02-22-2009, 07:29 PM
Hi there Hal8000. You are a pal and no mistake.Well I tried the code you sent me, but it seems like the Apt-get command does not work when you are using the Knoppix 'live' cd. Seems It does work,...... but only when you have it installed to the Hard Drive. It works in Debian okay, but I no longer had Debian. Did I? Groan!
Well that wiped the grin off my face for a while, but then I started looking deeper into the Knoppix Hacks and found the following. Sudo install-mbr /dev/hda The outcome was that it took Grub right out of the MBR and .......would you believe it......never ripped up the MBR. Cor! That was a relief. I had made a backup of it just in case.

So now I have my win XP back in shape except for a couple of minor glitches, which I got rid of by doing a system Restore to an earlier point. But I still do not have Debian on my hard drive. Seems I am going to have to do some research, because I partitioned the drive okay. Ahem! Sort of! Only every time Debian booted it kept telling me that I had not made a swap file. I had, but obviously not right.
The mysterious thing is that it still booted up great. I made a right muck of it somewhere though because although I gave a password that I was familiar with (Debian sugested I use my first name for a user name) it would never recognise that password and I couldn't get into it to sort it out. Dratt!
Yeh well! Guess it is back to the learning curve for this old guy. Must dig into the mysteries of Debian Partions. Guess I am rambling Guy's. Sorry about that. Thanks again. What would I do without you? Regards Grandad Walt.

grandad
02-23-2009, 02:29 PM
Hi Hal8000. Got stuck in this morning and printed out Sudo fdisk -l and this is what I got back from the terminal. I will just put it down as it printed out. OK?

Units=cylinders of 16065 * 512=8225280 bytes

Device. Boot. Start. End. Blocks. Id. System
/dev/hda1 * 1 2433 19543041 7 HPFS/NTFS

Disk/dev/sda: 80.0GB, 80026361856 bytes
255 heads. 63 sectors/track. 9729 cylinders.
Units=cylinders ofg 16065 * 512=8225280 bytes

Device Boot Start. End. Blocks. Id. System.
/dev/sda1 1 25550 20482843+ 7 HPFS/NTFS
/dev/sda2 2551 9562 56323890 7 HPFS/NTFS


Disk/dev/sdb: 4047 MB, 404750848 bytes
4 heads, 32 sectors/track, 61759 cylinders
Units=cylinders of 128 * 512=65536 bytes

Device. Boot. Start. End. Blocks. ID. System.
/dev/sdb1 * 1 61760 3952623+ b W95 FAT32
Knoppix@Knoppix:~$

Hope that this makes some sort of sense to you and that it might help you in some way to get a grasp of my situation. I have logged in to the Debian forums and will ask around on there to see if I can get some sort of a walk through with the Debian installer.(it seemed so simple, but wasn't) and maybe I shall be able to have another go. Regards Grandad Walt.

grandad
02-25-2009, 03:51 PM
Hi Guy's. Guess what? I now have Debian 4.0 up and running on my computer. I can't get over the amount of help I have been given. This forum is really the greatest. Still love my Knoppix though and I feel that we shall be having a long and happy relationship. But Debian is now in full swing and I am one very happy bunny. Thanks a lot guy's. You are the best. Grandad Walt.

hal8000
02-27-2009, 08:55 PM
Hi Hal8000. Got stuck in this morning and printed out Sudo fdisk -l and this is what I got back from the terminal. I will just put it down as it printed out. OK?

Units=cylinders of 16065 * 512=8225280 bytes

Device. Boot. Start. End. Blocks. Id. System
/dev/hda1 * 1 2433 19543041 7 HPFS/NTFS

Disk/dev/sda: 80.0GB, 80026361856 bytes
255 heads. 63 sectors/track. 9729 cylinders.
Units=cylinders ofg 16065 * 512=8225280 bytes

Device Boot Start. End. Blocks. Id. System.
/dev/sda1 1 25550 20482843+ 7 HPFS/NTFS
/dev/sda2 2551 9562 56323890 7 HPFS/NTFS


Disk/dev/sdb: 4047 MB, 404750848 bytes
4 heads, 32 sectors/track, 61759 cylinders
Units=cylinders of 128 * 512=65536 bytes

Device. Boot. Start. End. Blocks. ID. System.
/dev/sdb1 * 1 61760 3952623+ b W95 FAT32
Knoppix@Knoppix:~$

Hope that this makes some sort of sense to you and that it might help you in some way to get a grasp of my situation. I have logged in to the Debian forums and will ask around on there to see if I can get some sort of a walk through with the Debian installer.(it seemed so simple, but wasn't) and maybe I shall be able to have another go. Regards Grandad Walt.

Yes , this makes sense 3 HD's and their partitions.
If you install Debian or Knoppix install using a linux filesystem i.e. reiser or ext3 not a windows file system.
HTH

hal8000
02-27-2009, 09:03 PM
Hi Guy's. Guess what? I now have Debian 4.0 up and running on my computer. I can't get over the amount of help I have been given. This forum is really the greatest. Still love my Knoppix though and I feel that we shall be having a long and happy relationship. But Debian is now in full swing and I am one very happy bunny. Thanks a lot guy's. You are the best. Grandad Walt.


I've not seen you forums.debian.org unless you have a different user name. All linux forums are great, the fastest and mot busiest seems ubunti forms at the moment, but that can always change.