# Grub! (SOLVED)

## aproan

well, this is my scheme.

I had 1 sata HD and had it with both windows and linux.

Yesterday I bought an IDE HD and installed windows on it.

However, my GRUB got erased from the MBR. I am trying to get into my /dev/sda3 (where everything is) or my /dev/sda1 (where /boot is) to be able to get grub up and running.

I've tried the livecd and the minimal install and both stop, halt, working at "sata_sil loading..."

So I tried "gentoo nodetect" but this will make my drives be not detected and therefore i cannot chroot into it, and thus do grub-install.

This is what I planned on doing:

```

# mount /dev/sda3 /mnt/gentoo

# mount -t proc /proc /mnt/gentoo/proc

# mount -o bind /dev /mnt/gentoo/dev

# chroot /mnt/gentoo /bin/bash

# grub-install /dev/sda3
```

 by the way should I mount /dev/sda1 (my /boot)?Last edited by aproan on Tue Feb 13, 2007 8:46 pm; edited 1 time in total

----------

## desultory

Do you have access to other live CDs which can access the filesystem types used by your installed system?

----------

## aproan

let me know what livecd I should download.

I have tried Knoppix and it doesn't chroot. This is probably because my knoppix is not a 64 bit knoppix, what livecds are there for amd64's you would suggest?

Is there a way to solve my problem using a floppy? Via knoppix I can read my grub.conf if that is worth something.

----------

## desultory

 *aproan wrote:*   

> I have tried Knoppix and it doesn't chroot. This is probably because my knoppix is not a 64 bit knoppix, what livecds are there for amd64's you would suggest?

 If you are unable to boot the Gentoo amd64 live CDs on that machine, it would be worth trying a Fedora amd64 rescue CD or perhaps an Ubuntu amd64 install CD.

 *aproan wrote:*   

> Is there a way to solve my problem using a floppy?

 If you have access to one with grub installed on it, then it would be quite easy to solve this with a floppy.

 *aproan wrote:*   

> Via knoppix I can read my grub.conf if that is worth something.

 Presently that is not worth much, but it might be of use later.

----------

## aproan

i tried Ubuntu amd64 install cd. I try the "starting" options and it freezes, the loader seems to be loading forever, but my machine is not reading anything.

I am not sure what to do now, you mentioned  *Quote:*   

> If you have access to one with grub installed on it, then it would be quite easy to solve this with a floppy. 

 

How can I install grub into a floppy, from a windows xp machine?

btw, what do you guys think the problem might be, I just connected an IDE hard drive.

----------

## whig

Adding a hard drive can upset the order the _bios_ sees the drives, which causes grub (and booting generally) to be confused. The bios may have the option to either boot the sata or ide drive as the first to try.

A 32 bit knoppix can make a grub floppy - refer grub homepage.

----------

## aproan

http://www.gnu.org/software/grub/manual/html_node/Creating-a-GRUB-boot-floppy.html

So I should boot knoppix, and then do

```
     # cd /usr/lib/grub/i386-pc

     # dd if=stage1 of=/dev/fd0 bs=512 count=1

     1+0 records in

     1+0 records out

     # dd if=stage2 of=/dev/fd0 bs=512 seek=1

     153+1 records in

     153+1 records out

     #
```

??

----------

## whig

stage1 and stage2 are more likely to be on your /dev/sda1 (knoppix will have a mountpoint for it).

----------

## aproan

ok. i've got the floppy up and running. however, i am now presented with a command line interface of GRUB, which I have never used. I can get my grub.conf but i am still not sure how to get this working.

My plan is to get into my linux system and then do the grub-install, by the way i've been able to check, by using fdisk, that my /dev/sda1 doesn't have the star to become a "booting" partition.

----------

## whig

If you can get a grub command line you are just about there  :Smile: 

> kernel (hd1,0)/boot/kernel_image root=/dev/sda3 ...

The hd1 might not be accurate - grub has tab completion - definitely use tab completion to check what you enter. kernel_image is the filename of your last good kernel.

... indicates other options (like initrd, if any).

Once that command line is right do a

> boot

(got to say, all this could be avoidable if the sata disk is set to be the boot disk, in bios.)

Good luck!

----------

## aproan

after a lot of trial and error i've been able to get into my linux system.

I noticed I had a very big mistake, my /dev/sda1 in fdisk didn't have the boot "tag" (*).

However, now I can use grub to get into Linux but not into Windows! I am not sure what to do, and I have tried changing the (hdX,0) where X has been 0,1. 

Below are my fdisks and followed by my grub.conf if you can give me any idea on how to fix it ill really appreciate it.

```
Disk /dev/hdc: 120.0 GB, 120034123776 bytes

255 heads, 63 sectors/track, 14593 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/hdc1   *           1        9727    78132096    c  W95 FAT32 (LBA)

/dev/hdc2            9728       14593    39086145    f  W95 Ext'd (LBA)

/dev/hdc5            9728       14593    39086113+   b  W95 FAT32
```

```

Disk /dev/sda: 80.0 GB, 80000000000 bytes

255 heads, 63 sectors/track, 9726 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        4864        4896      265072+  83  Linux

/dev/sda2            4897        5409     4120672+  82  Linux swap / Solaris

/dev/sda3            5410        9726    34676302+  83  Linux
```

```

default 0

timeout 30

splashimage=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux 2.6.18-gentoo-r6

root (hd0,0)

kernel /boot/kernel-genkernel-x86_64-2.6.18-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3

initrd /boot/initramfs-genkernel-x86_64-2.6.18-gentoo-r6

title=Windows XP SP2

rootnoverify (hd1,0)

makeactive

chainloader +1
```

----------

## whig

Snippet from the grub site, *Quote:*   

> 4.2.6 DOS/Windows
> 
> GRUB cannot boot DOS or Windows directly, so you must chain-load them (see Chain-loading). However, their boot loaders have some critical deficiencies, so it may not work to just chain-load them. To overcome the problems, GRUB provides you with two helper functions.
> 
> If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command map (see map), like this:
> ...

 (I haven't needed to use the map command myself)

----------

## aproan

fixed. thanks a lot. 

hoping to see what comes new with Grub 2.

----------

