Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 23/04/2009, à 21:18

Loki-59

[résolu] Installer grub !?

Bonjour,

Je suis en dual boot XP/Ubuntu.
J'étais en 8.04 et j'ai installé la 9.04 sans installer grub (ne me demandez pas pourquoi tongue )
Je ne peux donc plus booter ni sous XP ni sous Ubuntu.

Voici mon fstab :

root@ubuntu:/# fdisk -l

Disque /dev/sda: 163.9 Go, 163928604672 octets
255 têtes, 63 secteurs/piste, 19929 cylindres
Unités = cylindres de 16065 * 512 = 8225280 octets
Identifiant de disque : 0x0fbd0fbc

Périphérique Amorce  Début        Fin      Blocs     Id  Système
/dev/sda1   *           1        3916    31455238+   7  HPFS/NTFS
/dev/sda2            3917       18276   115346700    b  W95 FAT32
/dev/sda3           18277       18400      996030   82  Linux swap / Solaris
/dev/sda4           18401       19929    12281692+   5  Etendue
/dev/sda5           18401       19520     8996368+  83  Linux
/dev/sda6           19521       19929     3285261   83  Linux

Disque /dev/sdb: 500.1 Go, 500107862016 octets
255 têtes, 63 secteurs/piste, 60801 cylindres
Unités = cylindres de 16065 * 512 = 8225280 octets
Identifiant de disque : 0x3aae4037

Périphérique Amorce  Début        Fin      Blocs     Id  Système
/dev/sdb1   *           1       60801   488384001    7  HPFS/NTFS

Disque /dev/sdc: 200.0 Go, 200049647616 octets
255 têtes, 63 secteurs/piste, 24321 cylindres
Unités = cylindres de 16065 * 512 = 8225280 octets
Identifiant de disque : 0x40612268

Périphérique Amorce  Début        Fin      Blocs     Id  Système
/dev/sdc1   *           1       24321   195358401    7  HPFS/NTFS

sda5 est mon /
sda6 est mon /home
J'ai donc monté ma sda5 dans /media/sda5 et voici le contenu de /boot : 

root@ubuntu:/media/sda5/boot# ls
abi-2.6.28-11-generic         System.map-2.6.28-11-generic
config-2.6.28-11-generic      vmcoreinfo-2.6.28-11-generic
initrd.img-2.6.28-11-generic  vmlinuz-2.6.28-11-generic
memtest86+.bin

Le dossier /boot/grub n'existe pas !
Comment installer grub !?
J'ai bien sûr jeté un oeil dans la doc mais comme le fichier stage1 est absent je ne peux pas aller plus loin ...

D'avance, merci de votre aide.

Dernière modification par Loki-59 (Le 25/04/2009, à 10:16)

Hors ligne

#2 Le 23/04/2009, à 21:22

gargouille

Re : [résolu] Installer grub !?

Veux-tu installer grub sur le mbr ou sur la partition Ubuntu?

Hors ligne

#3 Le 23/04/2009, à 21:38

Loki-59

Re : [résolu] Installer grub !?

J'aimerais l'installer sur le mbr.

Hors ligne

#4 Le 23/04/2009, à 21:54

gargouille

Re : [résolu] Installer grub !?

Un

sudo grub-install /dev/sda

à partir du live cd ne fonctionne pas?

Hors ligne

#5 Le 23/04/2009, à 22:03

Loki-59

Re : [résolu] Installer grub !?

Non, j'obtiens ce message d'erreur :

root@ubuntu:/media/sda5# grub-install /dev/sda
Could not find device for /boot: Not found or not a block device.

Hors ligne

#6 Le 23/04/2009, à 22:08

philarmonie

Re : [résolu] Installer grub !?

et avec

sudo apt-get install grub

Dernière modification par philarmonie (Le 23/04/2009, à 22:10)

#7 Le 23/04/2009, à 22:08

Compte anonymisé

Re : [résolu] Installer grub !?

Salut

Il faudrait peut être auparavant CHROOTER /dev/sda5

@+

#8 Le 23/04/2009, à 23:38

Loki-59

Re : [résolu] Installer grub !?

Après avoir chrooter  /dev/sda5, j'ai pu installer grub via un apt-get install grub.
Le dossier grub existe bien maintenant dans /boot mais il ne contient que le fichier device.map.
Le

sudo grub-install /dev/sda

renvoi toujours le message

Could not find device for /boot: Not found or not a block device

Des idées ?

Hors ligne

#9 Le 23/04/2009, à 23:50

tontonsalam

Re : [résolu] Installer grub !?

Loki-59 a écrit :

Non, j'obtiens ce message d'erreur :

root@ubuntu:/media/sda5# grub-install /dev/sda
Could not find device for /boot: Not found or not a block device.

http://ubuntuforums.org/showthread.php?t=504678

pour moi ça a super bien marché


Ca va passer

Hors ligne

#10 Le 24/04/2009, à 06:37

Compte anonymisé

Re : [résolu] Installer grub !?

Salut

Il faudrait peut être tenter un :
sudo  grub-install hd0


@+

#11 Le 24/04/2009, à 09:36

elfoiros

Re : [résolu] Installer grub !?

Depuis le live CD tu dois simplement monter ta partition de boot dans /boot

sudo mount /dev/sdaN /boot
sudo grub-install /dev/sda

remplace sda et sdaN en fonction de ta config ...


Coluche : "Bite" c'est un gros mot, même si c'est une petite
Consultant e-commerce
Étude et realisation
Optimisation, maintenance

Hors ligne

#12 Le 24/04/2009, à 18:04

Loki-59

Re : [résolu] Installer grub !?

jeanjd63 a écrit :

Salut

Il faudrait peut être tenter un :
sudo  grub-install hd0


@+

Me renvoi le message d'erreur  : Could not find device for /boot: Not found or not a block device.

elfoiros
    Aujourd'hui à 09:36

Depuis le live CD tu dois simplement monter ta partition de boot dans /boot

sudo mount /dev/sdaN /boot
sudo grub-install /dev/sda

remplace sda et sdaN en fonction de ta config ...

M'installe grub, mais au boot, j'arrive directement dans grub

grub >
root@ubuntu:/home/ubuntu# mount /dev/sda5 /boot 


root@ubuntu:/home/ubuntu# grub-install /dev/sda
Probing devices to guess BIOS drives. This may take a long time.
Searching for GRUB installation directory ... found: /boot/grub
Installing GRUB to /dev/sda as (hd0)...
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(fd0)	/dev/fd0
(hd0)	/dev/sda
(hd1)	/dev/sdb
(hd2)	/dev/sdc

Et je n'ai toujours que le fichier device.map dans /boot/grub

Je crois qu'on avance ... big_smile

EDIT 18h50

J'ai pu récupérer les fichiers stage1 etc... depuis le répertoire /usr/lib/grub/i386-pc et je les ai copié dans /boot/grub et j'ai donc pu paramétrer grub mais au boot j'arrive toujours sur grub> hmm

grub> find /boot/grub/stage1
 (hd0,4)

grub> root (hd0,4)

grub> setup (hd0)
 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)"...  17 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,4)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

EDIT 18h56
Je viens de remarquer que je n'avais pas de menu.lst dans /boot/grub;
Je vais essayer d'en créer un ..

Dernière modification par Loki-59 (Le 24/04/2009, à 19:01)

Hors ligne

#13 Le 24/04/2009, à 21:39

Loki-59

Re : [résolu] Installer grub !?

J'ai pu créer un fichier menu.lst via la commande update-grub.
Mais il y a des erreurs :

root@ubuntu:/# update-grub
Searching for GRUB installation directory ... found: /boot/grub
findfs: Impossible de résoudre « UUID=f3e4b255-e570-463a-85ac-fcdf181986d1 »
Cannot determine root device.  Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... 

Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.28-11-generic
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

Voici le fichier créé :

root@ubuntu:/# cat /boot/grub/menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default		0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		3

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title		Windows 95/98/NT/2000
# root		(hd0,0)
# makeactive
# chainloader	+1
#
# title		Linux
# root		(hd0,1)
# kernel	/vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=/dev/hda1 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
##      indomU=true
##      indomU=false
# indomU=detect

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title		Ubuntu 9.04, kernel 2.6.28-11-generic
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.28-11-generic root=/dev/hda1 ro quiet splash 
initrd		/boot/initrd.img-2.6.28-11-generic

title		Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.28-11-generic root=/dev/hda1 ro  single
initrd		/boot/initrd.img-2.6.28-11-generic

title		Ubuntu 9.04, memtest86+
root		(hd0,0)
kernel		/boot/memtest86+.bin

### END DEBIAN AUTOMAGIC KERNELS LIST

Au boot, j'obtiens le message Error 17 : Cannot mount selected partition

J'ai remplacé ce fichier par une version sauvegardé avant la migration.
Ce fichier utilise les UUID :

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default		0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title		Windows 95/98/NT/2000
# root		(hd0,0)
# makeactive
# chainloader	+1
#
# title		Linux
# root		(hd0,1)
# kernel	/vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=5671aae2-f04c-4e6f-8baf-eec04a878cd2 ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,4)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title		Ubuntu 8.04.1, kernel 2.6.24-22-generic
root		(hd0,4)
kernel		/boot/vmlinuz-2.6.24-22-generic root=UUID=5671aae2-f04c-4e6f-8baf-eec04a878cd2 ro quiet splash
initrd		/boot/initrd.img-2.6.24-22-generic
quiet

title		Ubuntu 8.04.1, kernel 2.6.24-22-generic (recovery mode)
root		(hd0,4)
kernel		/boot/vmlinuz-2.6.24-22-generic root=UUID=5671aae2-f04c-4e6f-8baf-eec04a878cd2 ro single
initrd		/boot/initrd.img-2.6.24-22-generic

#title		Ubuntu 8.04.1, kernel 2.6.24-19-generic
#root		(hd0,4)
#kernel		/boot/vmlinuz-2.6.24-19-generic root=UUID=5671aae2-f04c-4e6f-8baf-eec04a878cd2 ro quiet splash
#initrd		/boot/initrd.img-2.6.24-19-generic
#quiet

#title		Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
#root		(hd0,4)
#kernel		/boot/vmlinuz-2.6.24-19-generic root=UUID=5671aae2-f04c-4e6f-8baf-eec04a878cd2 ro single
#initrd		/boot/initrd.img-2.6.24-19-generic

title		Ubuntu 8.04.1, memtest86+
root		(hd0,4)
kernel		/boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title		Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdb1
title		Microsoft Windows XP Professionnel
root		(hd0,0)
savedefault
makeactive
chainloader	+1

Mais cette fois ci, au boot j'obtiens le message Error 15 : file not found

Question : les UUID peuvent-ils changer d'une réinstallation à une autre !?

Hors ligne

#14 Le 24/04/2009, à 21:56

philarmonie

Re : [résolu] Installer grub !?

non, et d'ailleurs il reconnait bien l'uuid mais le file not found c'est

/boot/vmlinuz-2.6.24-22-generic

soit l'image de ton noyau
sinon pour voir les uuid de tes disques

ls -l /dev/disk/by-uuid

Dernière modification par philarmonie (Le 24/04/2009, à 21:56)

#15 Le 25/04/2009, à 10:16

Loki-59

Re : [résolu] Installer grub !?

Problème résolu !

Explication pour le file not found : Le menu.lst utilisé était celui sauvegardé sous 8.04.
Forcément, ce fichier n'existait plus sur la 9.04, le noyau étant en 2.6.28-11.
Après la rectif, ça ne bootait toujours pas.
J'ai vérifié les UUID avec ls -l /dev/disk/by-uuid et effectivement, l'UUID renseignée était incorrecte.
Bref, cette fois-ci, aucun problème pour booter.

La solution la plus simple aurait été de réinstaller la distrib complète, en 25 min c'était fait, mais après plusieurs heures de galère, ce fût un bon exercice pratique smile

Merci à tous pour votre aide.

Hors ligne