Autor Tópico: Grub2 não funciona corretamente com WinXP + Ubuntu 10.04 + Win7 [Resolvido]  (Lida 5615 vezes)

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
O meu Windows XP e Ubuntu 10.04 estavam instalados corretamente, cada um na sua particação, quando instalei o Windows 7 em uma outra partição.
Eu imaginava que teria alguns problemas com a MBR após a instalação desse SO mas não imaginava que seria a ponto de não conseguir resolvê-lo  :-[.
O meu grub mostra só o XP e o Ubuntu porém só o Ubuntu inicia  :'(.
Já procurei nos outros tópicos mas nenhum resolve o meu problema.

« Última modificação: 22 de Outubro de 2010, 15:18 por Bruce gun »
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline sistematico

  • Usuário Ubuntu
  • *
  • Mensagens: 576
  • Sistematico
    • Ver perfil
    • Sistematico.org
Tentou:
Código: [Selecionar]
sudo update-grub?
Lucas Saliés Brum
Ubuntu User #27150
http://sistematico.org

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
Sistematico, já tentei o seguinte:

Código: [Selecionar]
Inicie uma sessão pelo live-CD

* Abra um terminal e insira o comando
Código:

$ sudo fdisk -l

* Lembre-se de qual é a sua instalação, como referencia /dev/sda1 será usado.

* Monte o sistema de arquivo em /mnt
Código:

$ sudo mount /dev/sda1 /mnt

* Monte o resto dos dispositivos
Código:

$ sudo mount --bind /dev /mnt/dev

* Use o comanto chroot para acessar o diretório raiz
Código:

$ sudo chroot /mnt

* Edite o arquivo /etc/default/grub do seu sistema
Código:

$ nano /etc/default/grub

(pode-se usar o gedit em vez do nano)

* Crie um novo arquivo de configuração
Código:

$ update-grub

* Reinstale o Grub 2 na MBR
Código:

$ grub-install /dev/sda

* se o comando anterior apresentar erros usse o seguinte
Código:

grub-install --recheck /dev/sda

* Pressione Ctrl+D para sair do chroot

* Desmonte os dispositivos
Código:

$ sudo umount /mnt/dev

* Desmonte o sistema de arquivo
Código:

sudo umount /mnt

Reinicie o sistema

Notei que o arquivo menu.lst está zerado.
Estou até agora procurando algo que me ajude a pelo menos fazer o meu XP voltar a vida.
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline fchevitarese

  • Usuário Ubuntu
  • *
  • Mensagens: 265
    • Ver perfil
    • Fred Chevitarese
acho que você tem que rodar o update-grub2 ao invés do update-grub, ou estou falando besteira?
Fred Chevitarese - GNU/Linux
http://chevitarese.wordpress.com

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
fchevitarese, já fiz isso também.  :-[
Tô começando a achar que vou ter que corrigir a MBR pelo XP.
Mas não entendi porque o arquivo "menu.lst" ficou zerado.
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline fchevitarese

  • Usuário Ubuntu
  • *
  • Mensagens: 265
    • Ver perfil
    • Fred Chevitarese
Quando você carrega o Windows dá algum erro ?

Fred Chevitarese - GNU/Linux
http://chevitarese.wordpress.com

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
fchevitarese, quando ligo o pc só aparece o Ubuntu e o XP.
Quando seleciono o XP, a tela fica escura e aparece um cursor piscando e nunca mais sai dessa tela se eu não fizer nada.
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline sistematico

  • Usuário Ubuntu
  • *
  • Mensagens: 576
  • Sistematico
    • Ver perfil
    • Sistematico.org
Citar
Notei que o arquivo menu.lst está zerado.
O GRUB2 não tem esse arquivo faz tempo.
As configurações dele agora ficam em /etc/default/grub entre outros.

O  passo a passo para restaurar o GRUB2 é mais ou menos assim:
De o boot por um LiveCD(pode ser o do Ubuntu 10.10 mesmo), depois execute esses passos:
Código: [Selecionar]
sudo mkdir /mnt/linux
sudo mount /dev/sda1 /mnt/linux
sudo grub-install --root-directory=/mnt/linux /dev/sda

Dê uma olhada nisso tambem: http://ubuntuforum-br.org/index.php/topic,68478.msg385186.html#msg385186

Um abraço.
Lucas Saliés Brum
Ubuntu User #27150
http://sistematico.org

Offline platao

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 5.052
    • Ver perfil
Caso necessario, e tiver duvidas de como recuperar o grub e grub2 veja;

http://ubuntuforum-br.org/index.php/topic,14614.0.html
\\\\\\\\Apostilas Dicas e Guias do Ubuntu\\\\\\\\\> http://ubuntuforum-br.org/index.php/topic,79368.msg440997.html#msg440997

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
Sistemático, eu já tinha usado os códigos que você me sugeriu.

Platão, eu já tinha visto o tópico "Mil e uma maneiras de recuperar GRUB 2 e GRUB".

Como eu estava desconfiado que o problema do XP não iniciar não era no meu Grub peguei o meu cd do XP e reinstalei apenas os arquivos do Windows XP. Voilà! Funcionou!

Bom, até aqui meio caminho andado.

Agora, tô tentando entender porque o Grub não incluiu o Win 7 nele?
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline sistematico

  • Usuário Ubuntu
  • *
  • Mensagens: 576
  • Sistematico
    • Ver perfil
    • Sistematico.org
Re: Grub não está funcionando corretamente com Windows XP + Ubuntu 10.04 + Windows 7
« Resposta #10 Online: 21 de Outubro de 2010, 18:57 »
Tentou o link que eu te passei?
Lucas Saliés Brum
Ubuntu User #27150
http://sistematico.org

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
Re: Grub não está funcionando corretamente com Windows XP + Ubuntu 10.04 + Windows 7
« Resposta #11 Online: 21 de Outubro de 2010, 20:58 »
Sistematico, vi sim e com muita atenção o site que você me passou.

Segue meus arquivos do Ubuntu.

Arquivo /boot/grub/grub.cfg
Código: [Selecionar]
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="Microsoft Windows XP Professional"
if [ ${prev_saved_entry} ]; then
  set saved_entry=${prev_saved_entry}
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z ${boot_once} ]; then
    saved_entry=${chosen}
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 22c1757b-ffe9-4fba-ad70-cddb4ce0455f
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 22c1757b-ffe9-4fba-ad70-cddb4ce0455f
set locale_dir=($root)/boot/grub/locale
set lang=pt
insmod gettext
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu 10.04 Lucid Lynx' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 22c1757b-ffe9-4fba-ad70-cddb4ce0455f
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=22c1757b-ffe9-4fba-ad70-cddb4ce0455f ro   quiet splash
initrd /boot/initrd.img-2.6.32-24-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d8d863fbd863d672
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/40_custom ###

Arquivo /etc/grub.d/30_os-prober
Código: [Selecionar]
#! /bin/sh -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib

. ${libdir}/grub/grub-mkconfig_lib

found_other_os=

adjust_timeout () {
  if [ "x${found_other_os}" = "x" ] ; then
    if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
      if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
      else
verbose=" --verbose"
      fi

      if [ "x${GRUB_HIDDEN_TIMEOUT}" = "x0" ] ; then
cat <<EOF
if [ \${timeout} != -1 ]; then
  if keystatus; then
    if keystatus --shift; then
      set timeout=-1
    else
      set timeout=0
    fi
  else
    if sleep$verbose --interruptible 3 ; then
      set timeout=0
    fi
  fi
fi
EOF
      else
cat << EOF
if [ \${timeout} != -1 ]; then
  if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
    set timeout=0
  fi
fi
EOF
      fi
    fi
  fi
}

if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
  adjust_timeout
  exit 0
fi

if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
  # missing os-prober and/or linux-boot-prober
  adjust_timeout
  exit 0
fi

OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
if [ -z "${OSPROBED}" ] ; then
  # empty os-prober output, nothing doing
  adjust_timeout
  exit 0
fi

osx_entry() {
        cat << EOF
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
cat << EOF
        insmod ${GRUB_VIDEO_BACKEND}
        set do_resume=0
        if [ /var/vm/sleepimage -nt10 / ]; then
           if xnu_resume /var/vm/sleepimage; then
             set do_resume=1
           fi
        fi
        if [ \$do_resume == 0 ]; then
           xnu_uuid ${OSXUUID} uuid
           if [ -f /Extra/DSDT.aml ]; then
              acpi -e /Extra/DSDT.aml
           fi
           $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
           if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
              xnu_mkext /System/Library/Extensions.mkext
           else
              xnu_kextdir /System/Library/Extensions
           fi
           if [ -f /Extra/Extensions.mkext ]; then
              xnu_mkext /Extra/Extensions.mkext
           fi
           if [ -d /Extra/Extensions ]; then
              xnu_kextdir /Extra/Extensions
           fi
           if [ -f /Extra/devprop.bin ]; then
              xnu_devprop_load /Extra/devprop.bin
           fi
           if [ -f /Extra/splash.jpg ]; then
              insmod jpeg
              xnu_splash /Extra/splash.jpg
           fi
           if [ -f /Extra/splash.png ]; then
              insmod png
              xnu_splash /Extra/splash.png
           fi
           if [ -f /Extra/splash.tga ]; then
              insmod tga
              xnu_splash /Extra/splash.tga
           fi
        fi
}
EOF
}

for OS in ${OSPROBED} ; do
  DEVICE="`echo ${OS} | cut -d ':' -f 1`"
  LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
  LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
  BOOT="`echo ${OS} | cut -d ':' -f 4`"

  if [ -z "${LONGNAME}" ] ; then
    LONGNAME="${LABEL}"
  fi

  echo "Found ${LONGNAME} on ${DEVICE}" >&2
  found_other_os=1

  case ${BOOT} in
    chain)

      cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
      save_default_entry | sed -e "s/^/\t/"
      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"

      case ${LONGNAME} in
Windows\ Vista*|Windows\ 7*)
;;
*)
  cat << EOF
drivemap -s (hd0) \${root}
EOF
;;
      esac

      cat <<EOF
chainloader +1
}
EOF
    ;;
    linux)
      LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
      prepare_boot_cache=

      for LINUX in ${LINUXPROBED} ; do
        LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
        LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
        LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
        LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
        LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
        LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"

        if [ -z "${LLABEL}" ] ; then
          LLABEL="${LONGNAME}"
        fi

if [ "${LROOT}" != "${LBOOT}" ]; then
  LKERNEL="${LKERNEL#/boot}"
  LINITRD="${LINITRD#/boot}"
fi

        cat << EOF
menuentry "${LLABEL} (on ${DEVICE})" {
EOF
save_default_entry | sed -e "s/^/\t/"
if [ -z "${prepare_boot_cache}" ]; then
  prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat <<  EOF
linux ${LKERNEL} ${LPARAMS}
EOF
        if [ -n "${LINITRD}" ] ; then
          cat << EOF
initrd ${LINITRD}
EOF
        fi
        cat << EOF
}
EOF
      done
    ;;
    macosx)
      OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
      osx_entry xnu_kernel 32
      osx_entry xnu_kernel64 64
    ;;
    hurd)
      cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
      save_default_entry | sed -e "s/^/\t/"
      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
      mach_device="`echo "${grub_device}" | tr -d '()' | tr , s`"
      grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
      case "${grub_fs}" in
*fs) hurd_fs="${grub_fs}" ;;
*) hurd_fs="${grub_fs}fs" ;;
      esac
      cat << EOF
multiboot /boot/gnumach.gz root=device:${mach_device}
module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
--multiboot-command-line='\${kernel-command-line}' \\
--host-priv-port='\${host-port}' \\
--device-master-port='\${device-port}' \\
--exec-server-task='\${exec-task}' -T typed '\${root}' \\
'\$(task-create)' '\$(task-resume)'
module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
}
EOF
    ;;
    *)
      echo "  ${LONGNAME} is not yet supported by grub-mkconfig." >&2
    ;;
  esac
done

adjust_timeout

Arquivo /etc/grub.d/40_custom
Código: [Selecionar]
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### BEGIN /etc/grub.d/10_linux ###

menuentry 'Ubuntu 10.04 Lucid Lynx' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 22c1757b-ffe9-4fba-ad70-cddb4ce0455f
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=22c1757b-ffe9-4fba-ad70-cddb4ce0455f ro   quiet splash
initrd /boot/initrd.img-2.6.32-24-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d8d863fbd863d672
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

Arquivo /etc/default/grub
Código: [Selecionar]
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT="Microsoft Windows XP Professional"
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
Re: Grub não está funcionando corretamente com Windows XP + Ubuntu 10.04 + Windows 7
« Resposta #12 Online: 22 de Outubro de 2010, 05:11 »
Depois de dias e dias tentando solucionar o meu problema, reinstalei o Win 7 e o Ubuntu 10.04. Voilà!

Agora o meu grub está perfeito! :'( ::)

Agradeço a todos que, de alguma forma, tiveram a boa intenção de me ajudar!  :D
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline Bruce gun

  • Usuário Ubuntu
  • *
  • Mensagens: 11
  • Ubuntu é bom demais!!!
    • Ver perfil
    • Meu Blog
Grub não está funcionando com Win XP + Ubuntu 10.04 + Win 7 [Resolvido]
« Resposta #13 Online: 22 de Outubro de 2010, 05:18 »
Galera, como esse é o meu primeiro tópico, não tenho certeza se é assim que eu o "fecho".

Tive que diminuir o tamanho do assunto para caber "[Resolvido]".

Abraços!!!
« Última modificação: 22 de Outubro de 2010, 05:20 por Bruce gun »
Windows XP + Ubuntu 10.04 + Windows 7
Athlon XP 2600+; 1,5 GB RAM DDR; HD 160 GB IDE
Tudo velho mas limpinho! :)        Aspirante a programador .Net

Offline platao

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 5.052
    • Ver perfil
Re: Grub não está funcionando corretamente com Windows XP + Ubuntu 10.04 + Windows 7
« Resposta #14 Online: 22 de Outubro de 2010, 14:38 »
Ola Bruce, vc tem que editar o seu primeiro post, e ali acrescentar (resolvido) 
\\\\\\\\Apostilas Dicas e Guias do Ubuntu\\\\\\\\\> http://ubuntuforum-br.org/index.php/topic,79368.msg440997.html#msg440997