Modifier grub
Il peut arriver qu'après avoir installé plusieurs distributions vous n'ayez plus la possibilité d'en choisir une dans grub, on peut y remédier en créant une entrée dans /boot/grub/menu.lst
Dans notre exemple on va supposer que sur notre disque dur nous avons Ubuntu 7.04 et qu'ensuite nous avons installé Fedora 7 ce qui nous a fait perdre le choix d'Ubuntu dans grub, donc nous verrons ici comment remettre l'entrée en question pour pouvoir démarrer Ubuntu 7.04
Tout d'abord il nous faut connaitre le nom des partitions pour Ubuntu, pour cela démarrez Fedora, ouvrez une console et tapez (en root):
/sbin/fdisk -l
df -h
On obtient:
[root@localhost]# /sbin/fdisk -l
Disk /dev/sda: 20.4 GB, 20416757760 bytes
255 heads, 63 sectors/track, 2482 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device
Boot
Start
End
Blocks Id System
/dev/sda1
1
131 1052226
82 Linux swap
/dev/sda2
*
132
1306 9438187+
83 Linux
/dev/sda3
1307
2482
9446220 83 Linux
[root@localhost ~]# df -h
Sys. de
fich.
Tail. Occ. Disp. %Occ. Monté sur
/dev/sda2
9,5G 5,5G 4G 55% /
La commande df -h
nous indique que notre racine (/) de Fedora est sur sda2, et la commande
fdisk -l nous montre que la partition
d'Ubuntu est sda3
Ensuite nous avons besoin d'accéder au répertoire /boot d'Ubuntu pour récupérer quelques infos, tapez:
mkdir /mnt/sda3 && mount /dev/sda3 /mnt/sda3 && ls -l /mnt/sda3/boot
(ci-dessus on crée un répertoire dans /mnt nomé sda3, on monte la partition sda3 dans /mnt/sda3 et on liste le contenu de /mnt/sda3/boot)
On obtient:
[root@localhost]# ls -l
/mnt/ubuntu/boot
total 16836
-rw-r--r-- 1 root root 414210 avr 15 abi-2.6.20-15-generic
-rw-r--r-- 1 root root 83234 avr 15
config-2.6.20-15-generic
drwxr-xr-x 2 root root 4096 jun 16 grub
-rw-r--r-- 1 root root 7180606 jun 16 initrd.img-2.6.20-15-generic
-rw-r--r-- 1 root root 6842512 avr 15 initrd.img-2.6.20-15-generic.bak
-rw-r--r-- 1 root root 94600 oct 20 memtest86+.bin
-rw-r--r-- 1 root root 806942 avr 15
System.map-2.6.20-15-generic
-rw-r--r-- 1 root root 1745100 avr 15 vmlinuz-2.6.20-15-generic
Voila, nous avons tout ce dont on a besoin: le nom de partiton d'Ubuntu ainsi que le nom exact de kernel. Il ne nous reste plus qu'à rajouter tout ça dans le fichier /boot/grub/menu.lst
Ouvrez une console, logez-vous en root et tapez:
gedit
/boot/grub/menu.lst (pour Gnome),
ou
kate
/boot/grub/menu.lst (pour KDE),
On obtient quelque chose de ce genre:
#
grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this
file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,1)
# kernel /boot/vmlinuz-version ro root=/dev/sda2
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.21-1.3194.fc7)
root (hd0,1)
kernel /boot/vmlinuz-2.6.21-1.3194.fc7 ro root=LABEL=/1 rhgb quiet
initrd /boot/initrd-2.6.21-1.3194.fc7.img
Et on ajoute une entrée pour Ubuntu:
#ubuntu
title Ubuntu, kernel 2.6.20-15-generic (on /dev/sda3)
root (hd0,2)
kernel /boot/vmlinuz-2.6.20-15-generic root=/dev/sda3 ro
initrd /boot/initrd.img-2.6.20-15-generic
rootnoverify (hd0,2)
Quelques explications:
Enumeration des partitions:
1ère partition (hd0,0)
2ème partition (hd0,1)
3ème partition (hd0,2)
Donc la partie root (hd0,2)
active la partition sda3
en tant que partition de démarrage.
Le chargement du noyau: kernel
/boot/vmlinuz-2.6.20-15-generic et root=/dev/sda3
indique la racine du système.
Le
noyau monte un système racine à l'aide d'une image compressée:
initrd
/boot/initrd.img-2.6.20-15-generic
Sauvegardez et quittez. Ensuite redémarrez et vous devriez avoir une entrée pour Ubuntu.
Si malgré tout, cela ne marche pas vous pouvez récupérer votre fichier menu.lst d'Ubuntu et copier la partie dont vous avez besoin dans le fichier menu.lst de Fedora. Pour voir le fichier menu.lst d'Ubuntu tapez:
cat /mnt/sda3/boo/grub/menu.lst
| Haut de page |
Si vous relevez des erreurs, des imprécisions ou si vous avez des suggestions ou des questions qui restent sans réponse n'hésitez pas à poster sur le forum.

