Howto Fix Grub/pt

From Super Grub Disk Wiki
Jump to navigationJump to search

After windows reinstallation, Linux no longer boots!

Outros títulos para este mesmo problema.

  • Como restaurar o GRUB?
  • Perdi meu GRUB!! Como encontrá-lo?
  • Reinstalei o Windows e o menu de seleção do Ubuntu desapareceu.

Solução Para Windows

Esta é a solução menos complicada (a mais simples) para usuários do Windows. Veja: Auto Super Grub Disk.

Solução Rápida

  1. GRUB => MBR & !LINUX! (1) AUTO ;-)))
  2. SGD fixa GRUB automagicamente :) para você e apresenta seu menu de boot novamente.

Solução Não Tão Rápida

  1. GRUB => MBR & !LINUX! (>2) MANUAL |8-)
  2. Escolha a partição onde está o GRUB a ser recuperado.
  3. Escolha a partição onde está o GRUB que você quer usar para o boot.

Solução Clássica

  • Super Grub Disk (COM HELP) :-)))

Super grub disk menu with help.png

English menu.png

Gnu linux menu.png

Fix boot of linux.png

  • Escolha a partição onde o está o GRUB que você deseja recuperar e o SGD lhe dirá: SGD HAS SUCCEEDED.

Sgd has suceeded.png

Solução Avançada

Algumas vezes o disco rígido onde seu GRUB será instalado não é o primeiro. Se você deseja instalar o GRUB em um MBR que não é o padrão, deve escolher conforme segue:

  1. Super Grub Disk (WITH HELP) :-)))
  2. English Super Grub Disk
  3. Advanced
  4. Grub
  5. Restore Grub to MBR
  6. Restore Grub to MBR manually
  7. Escolha a partição onde está o GRUB (i.e. onde está stage1).
  8. Escolha o disco rígido onde você deseja que o GRUB seja instalado.

Solução Problemática

TODO EXPLICANDO O USO DE LIVESWAP QUANDO O DISCO RÍGIDO DETECTADO APRESENTA PROBLEMAS

Solução GRUB solution (por si mesmo)

Encontre a partição onde está GRUB stage1.

grub>find /boot/grub/stage1
grub>find /grub/stage1
A saída destes comandos deve ser a seguinte:
  (hd0,1)
  (hd0,3)

Vamos supor que você deseje restaurar o GRUB da segunda partição o primeiro disco rígido(hd0,1).

Digite estes comandos:

grub>root (hd0,1)

provavelmente aparecerá:

Filesystem type is ext2fs, partition type 0x83

e então:

grub>setup (hd0)

Depois:

Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 d (hd0) (hd0)1+15 p (hd0,1)/boot/grub/stage
2 /boot/grub/menu.lst"... succeeded
Done.

Agora você pode reiniciar sua máquina com o comando para reboot.

grub>reboot

Solução GRUB (Linux shell)

Suponhamos que você sabe que sua instalação Linux está na partição sda3. Do liveCD você faz:

$ sudo su
# mkdir /mnt/test
# mount -t ext3 -o dev /dev/sda3 /mnt/test
# chroot /dev/sda3
# grub-install /dev/sda
# exit
# umount /mnt/test
# reboot # This is optional.

Dica: Você pode mudar ext3 o tipo de sistema de arquivos de sua partição. File:Exemplo.jpg

GRUB2 solution (on its own)

As long as I know GRUB2 cannot recover itself on its own.

GRUB2 solution (Linux shell)

You have to type the same commands as the ones found at: #GRUB solution (Linux shell) where we suppose that you have a GRUB2 installed in the GRUB partitions and thus grub-install is not the command from GRUB but the command from GRUB2.

Rescatux

This feature is not yet available at the Rescapp program. It is available at the Super Grub Disk included with Rescatux. If you want to have this feature at the Rescapp program please complain at the super grub disk mailing list.

Tecnical explanation

When you reinstall Windows, MBR boot code points to Windows partition boot sector. Windows partition boot sector has a programa that loads Windows. When you reinstall GRUB, MBR boot code points either to GRUB's stage1_5 file (After MBR and before first partition) or to GRUB's stage2 file (found at the linux filesystem). Either stage1_5 or stage2 read the menu.lst file and present the GRUB menu to the user.

One thing you should know

  • These methods only restore GRUB successfully if a stage1,stage2 (and optionally a stage1_5 file) is found. If you have deleted these files the GRUB solution (Linux shell) might help although it might be better to reinstall GRUB from a chroot environment got from a live cd.

If your Linux filesystem has errors GRUB might not be able to find its files even if they are there. So sometimes is advised to try to run the:

fsck -yc /dev/DEV

command as root where DEV is your linux partition device.

fsck -yc /dev/sda3 

will fix the third partition from an scsi or sata first disk (Although it might not actually be the first one).

  • OpenSolaris GRUB cannot be restored to MBR which this method. You need to boot Linux and then use the install-grub command. See man install-grub for more info.
  • If menu.lst is incorrect you will be able to access your menu.lst again but maybe Linux entries might not boot.

TIP

If you cannot get to restore grub this way you can always try to boot Linux and then use the Grub Solution (on its own) method or the Grub Solution (Linux shell) method.

Problems ?

You can always check the possible problems when fixing grub from Super Grub Disk in Super Grub Disk Problems page.

External resources

resume writing