[Grub] problemi GRUB2 e dual boot con windows7

Problemi riscontrati durante l'installazione di Ubuntu, degli aggiornamenti e degli avanzamenti del sistema.
giongio
Prode Principiante
Messaggi: 3
Iscrizione: lunedì 26 settembre 2011, 3:40

[Grub] problemi GRUB2 e dual boot con windows7

Messaggio da giongio »

Ciao a tutti

ho installato kubuntu 11.04 da poco (ora sta facendo l'aggiornamento).
Nel menù di boot ci sono tutte le voci che dovrebbero esserci, ma quando scelgo "windows 7 loader" non fa altro che ricaricarmi nuovamente il menù di boot come se niente fosse successo. Invece kubuntu funziona tranquillamente.

Evidentemente ho confuso qualcosa durante l'installazione.
Però sono anche sicuro che la partizione con win sia intatta (posso accederci come se fosse una cartella ed è tutto come prima).

Quello che mi lascia più perplesso è che nel menù la voce completa dalla quale dovrei lanciarlo è "Windows 7 (loader) (on /dev/sda1)", mentre win si tova in realtà in sda2.

Ho usato uno script trovato in rete (boot_info_script.sh) per avere informazioni più complete sullo stato delle mie partizioni e questo è l'output:

Codice: Seleziona tutto

                  Boot Info Script 0.60    from 17 May 2011


============================= Boot Info Summary: ===============================

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for (,msdos5)/boot/grub on this drive.

sda1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Grub2 (v1.99)
    Boot sector info:   Grub2 (v1.99) is installed in the boot sector of sda1 
                       and looks at sector 345348656 of the same hard drive 
                       for core.img. core.img is at this location and looks 
                       for (,msdos5)/boot/grub on this drive. According to 
                       the info in the boot sector, sda1 has 204799 sectors, 
                       but according to the info from fdisk, it has 208781 
                       sectors.
    Operating System:  
    Boot files:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:   No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sda4: __________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  -
    Boot sector info:  

sda5: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Ubuntu 11.04
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda6: __________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:  

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disco /dev/sda: 250.1 GB, 250059350016 byte
255 testine, 63 settori/tracce, 30401 cilindri, totale 488397168 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1    *             63       208,844       208,782   7 NTFS / exFAT / HPFS
/dev/sda2             208,845   244,187,635   243,978,791   7 NTFS / exFAT / HPFS
/dev/sda4         244,189,182   488,396,799   244,207,618   5 Extended
/dev/sda5         244,189,184   472,772,606   228,583,423  83 Linux
/dev/sda6         472,772,608   488,396,799    15,624,192  82 Linux swap / Solaris


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/sda1        684ECFC64ECF8AF0                       ntfs       Riservato per il sistema
/dev/sda2        C6EED208EED1F123                       ntfs       Sistema
/dev/sda5        ca4cab2c-804d-47ba-a2e2-d39d86fb2070   ext4       
/dev/sda6        02b0ecd9-d6d0-4fc8-941a-acc199deb00a   swap       

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/sda2        /windows                 fuseblk    (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions)
/dev/sda5        /                        ext4       (rw,errors=remount-ro,commit=600)


=========================== sda5/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by 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
  set have_grubenv=true
  load_env
fi
set default="0"
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
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos5)'
search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos5)'
search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
set locale_dir=($root)/boot/grub/locale
set lang=it_IT
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
if background_color 0,71,115; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
if [ ${recordfail} != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, con Linux 2.6.38-11-generic' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	set gfxpayload=$linux_gfx_mode
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos5)'
	search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
	linux	/boot/vmlinuz-2.6.38-11-generic root=UUID=ca4cab2c-804d-47ba-a2e2-d39d86fb2070 ro   quiet splash vt.handoff=7
	initrd	/boot/initrd.img-2.6.38-11-generic
}
menuentry 'Ubuntu, con Linux 2.6.38-11-generic (modalità ripristino)' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	set gfxpayload=$linux_gfx_mode
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos5)'
	search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
	echo	'Loading Linux 2.6.38-11-generic ...'
	linux	/boot/vmlinuz-2.6.38-11-generic root=UUID=ca4cab2c-804d-47ba-a2e2-d39d86fb2070 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.38-11-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, con Linux 2.6.38-8-generic' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	set gfxpayload=$linux_gfx_mode
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos5)'
	search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
	linux	/boot/vmlinuz-2.6.38-8-generic root=UUID=ca4cab2c-804d-47ba-a2e2-d39d86fb2070 ro   quiet splash vt.handoff=7
	initrd	/boot/initrd.img-2.6.38-8-generic
}
menuentry 'Ubuntu, con Linux 2.6.38-8-generic (modalità ripristino)' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	set gfxpayload=$linux_gfx_mode
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos5)'
	search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
	echo	'Loading Linux 2.6.38-8-generic ...'
	linux	/boot/vmlinuz-2.6.38-8-generic root=UUID=ca4cab2c-804d-47ba-a2e2-d39d86fb2070 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.38-8-generic
}
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos5)'
	search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos5)'
	search --no-floppy --fs-uuid --set=root ca4cab2c-804d-47ba-a2e2-d39d86fb2070
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
	insmod part_msdos
	insmod ntfs
	set root='(/dev/sda,msdos1)'
	search --no-floppy --fs-uuid --set=root 684ECFC64ECF8AF0
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda5/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=ca4cab2c-804d-47ba-a2e2-d39d86fb2070 /               ext4    errors=remount-ro 0       1
# /windows was on /dev/sda2 during installation
UUID=C6EED208EED1F123 /windows        ntfs    defaults,nls=utf8,umask=007,gid=46 0       0
# swap was on /dev/sda6 during installation
UUID=02b0ecd9-d6d0-4fc8-941a-acc199deb00a none            swap    sw              0       0
--------------------------------------------------------------------------------

=================== sda5: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

 158.565250397 = 170.258141184  boot/grub/core.img                             1
 221.040466309 = 237.340393472  boot/grub/grub.cfg                             1
 119.258789062 = 128.053149696  boot/initrd.img-2.6.38-11-generic              2
 224.065673828 = 240.588685312  boot/initrd.img-2.6.38-8-generic               2
 118.634101868 = 127.382396928  boot/vmlinuz-2.6.38-11-generic                 1
 222.716129303 = 239.139622912  boot/vmlinuz-2.6.38-8-generic                  1
 119.258789062 = 128.053149696  initrd.img                                     2
 224.065673828 = 240.588685312  initrd.img.old                                 2
 118.634101868 = 127.382396928  vmlinuz                                        1
 222.716129303 = 239.139622912  vmlinuz.old                                    1

=============================== StdErr Messages: ===============================

unlzma: Decoder error
unlzma: Decoder error
Notare che appunto la partizione con win è la sda2 mentre grub in automatico cerca nella sda1.
Quindi ho provato ad aggiungere una "custom entry" al menù aggiungendo nella cartella /etc/grub.d/ un file chiamato 45_win contenente questo codice:

Codice: Seleziona tutto

#!/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.
echo "Adding Win7" >&2
menuentry "Win7" {
set root=(hd0,2)
}
dopo di che ho eseguito da terminale
sudo chmod +x 45_win
sudo update-grub


al che mi viene dato l'errore:

Codice: Seleziona tutto

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-11-generic
Found initrd image: /boot/initrd.img-2.6.38-11-generic
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
errore: syntax error.
errore: Incorrect command.
errore: syntax error.
error: line no: 187
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
done
immagino che il problema sia nel mio 45_win, in particolare credo manchi qualche boot setting essenziale. Leggendo il boot-info-script output per la partizione sda2 mi da
   Boot files:        /Windows/System32/winload.exe

devo forse in qualche modo andare a dirgli di eseguire questo file?
o non centra?
che fare in generale?

grazie mille a tutti per la pazienza
Ultima modifica di giongio il lunedì 17 ottobre 2011, 13:11, modificato 1 volta in totale.
patel
Accecante Asceta
Accecante Asceta
Messaggi: 23782
Iscrizione: martedì 15 aprile 2008, 20:27
Località: Livorno

Re: problemi GRUB2 e dual boot con windows7

Messaggio da patel »

quel rosso è un pugno in un occhio oltre che illeggibile, posta una schermata del gestore partizioni
Un titolo ben azzeccato attira l'attenzione degli esperti in quel campo, fa risparmiare tempo a voi, aumenta la probabilità di successo.
giongio
Prode Principiante
Messaggi: 3
Iscrizione: lunedì 26 settembre 2011, 3:40

Re: problemi GRUB2 e dual boot con windows7

Messaggio da giongio »

patel
Accecante Asceta
Accecante Asceta
Messaggi: 23782
Iscrizione: martedì 15 aprile 2008, 20:27
Località: Livorno

Re: [Grub] problemi GRUB2 e dual boot con windows7

Messaggio da patel »

è vero che win si trova in sda2, ma i file di boot sono nella partiz. di boot, cioè in sda1, inoltre le voci che hai inserito in 45_win non sono corrette, avresti dovuto mettere

Codice: Seleziona tutto

menuentry "Windows 7" --class windows --class os {
	insmod part_msdos
	insmod ntfs
	set root='(/dev/sda,msdos2)'
	chainloader +1
}
Un titolo ben azzeccato attira l'attenzione degli esperti in quel campo, fa risparmiare tempo a voi, aumenta la probabilità di successo.
giongio
Prode Principiante
Messaggi: 3
Iscrizione: lunedì 26 settembre 2011, 3:40

Re: [Grub] problemi GRUB2 e dual boot con windows7

Messaggio da giongio »

patel ora modificando il file 45_win come mi hai indicato (lo ho proprio copiato) riesco ad eseguire senza errori update-grub,
nel menù di boot appare correttamente la voce "win 7", però quando provo ad avviare mi da:

Codice: Seleziona tutto

errore: no such disk
???
patel
Accecante Asceta
Accecante Asceta
Messaggi: 23782
Iscrizione: martedì 15 aprile 2008, 20:27
Località: Livorno

Re: [Grub] problemi GRUB2 e dual boot con windows7

Messaggio da patel »

come già detto i file di boot sono nella partiz. di boot, cioè in sda1 quindi la tua modifica è inutile, ora te ne sei accorto, l'unica cosa da fare è ripristinare il boot di win7 avviando dal dvd di installazione o dalla partiz. di recovery
Un titolo ben azzeccato attira l'attenzione degli esperti in quel campo, fa risparmiare tempo a voi, aumenta la probabilità di successo.
Scrivi risposta

Ritorna a “Installazione e aggiornamento del sistema operativo”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 5 ospiti