GRUB error 17
Autor: Vagner Zampieri | Publicado: 2011-12-10T12:09:00-08:00

Estava formatando as minhas partições, utilizando o Live CD do Ubuntu 11.04 e o GParted, quando fui reiniciar a máquina me deparei com o chato erro do GRUB error 17, alguns de vocês já devem ter resolvido isso, mas como nunca tinha formatado partições fui atrás do erro, achei este link falando do assunto e consegui adaptar para minha realidade.
O erro acontece quando as partições não estão organizadas e o GRUB precisava ficar na partição do Linux, coisa que não acontecia, então fiz o seguinte:

Antes de começar, TENHA CUIDADO. 

Entrei fazendo boot novamente pelo CD, abri o terminal. Virei root.

sudo -i
Listei as partições com:

fdisk -l

A minha saída foi:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4dc5fddf
&nbsp;Device&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Boot&nbsp;&nbsp; Start&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Blocks&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Id&nbsp;&nbsp;&nbsp;&nbsp; System
/dev/sda1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80293+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; de&nbsp;&nbsp;&nbsp; Dell Utility
/dev/sda2&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1926&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15383099&nbsp;&nbsp;&nbsp; 7 &nbsp;&nbsp;&nbsp;&nbsp; HPFS/NTFS
/dev/sda3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18184&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 19457&nbsp;&nbsp;&nbsp;&nbsp; 10233405&nbsp;&nbsp;&nbsp; db&nbsp;&nbsp; CP/M / CTOS / ...
/dev/sda4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1926&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18183&nbsp;&nbsp;&nbsp;&nbsp; 130590720&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp; Extended
/dev/sda5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1926&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 17566&nbsp;&nbsp;&nbsp;&nbsp; 125628416&nbsp; 83&nbsp;&nbsp; Linux
/dev/sda6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 17566&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18183&nbsp;&nbsp;&nbsp;&nbsp; 4960256&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 82&nbsp;&nbsp; Linux swap / Solaris

Partition table entries are not in disk order
No meu caso o GRUB precisa estar em /dev/sda5, sabendo disso montei minha partição com:

mount /dev/sad5 /mnt
mount -t proc none /mnt/proc
mount -o bind /dev /mnt/dev
Depois que o GRUB descobriu meus drivers, faço o chroot 
&nbsp; 
chroot /mnt /bin/bash
Assim que acabar essa parte, abra o grub: &nbsp; 

grub
Encontre quais os parâmetros que você deve passar no comando root com o find abaixo:

find /boot/grub/stage1

No meu caso a saída foi (hd0,4), passe ele no root: 

root (hd0,4)
Por fim rode o setup e feche:

setup (hd0)
quit
Reinicie a máquina e estará pronto.&nbsp;