# If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' GRUB_DEFAULT=0 #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 enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # 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_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1"
:~$ ls -al /etc/grub.d/ total 96 drwxr-xr-x 2 root root 4096 févr. 10 11:45 . drwxr-xr-x 157 root root 12288 févr. 11 10:29 .. -rwxr-xr-x 1 root root 9791 juin 21 2017 00_header -rwxr-xr-x 1 root root 6258 mars 15 2016 05_debian_theme -rwxr-xr-x 1 root root 12512 juin 21 2017 10_linux -rwxr-xr-x 1 root root 11082 juin 21 2017 20_linux_xen -rwxr-xr-x 1 root root 1992 janv. 28 2016 20_memtest86+ -rwxr-xr-x 1 root root 11692 juin 21 2017 30_os-prober -rwxr-xr-x 1 root root 1418 juin 21 2017 30_uefi-firmware -rwxr-xr-x 1 root root 468 févr. 10 11:45 40_custom -rwxr-xr-x 1 root root 216 juin 21 2017 41_custom -rw-r–r– 1 root root 483 juin 21 2017 README :~$ </cli>
Explications :
; 05_debian_theme
; 10_linux
; 20_linux_xen
; 20_memtest86+
; 30_os-prober
; 40_custom
; 41_custom
</WRAP>
Ne pas toucher au fichier /boot/grub/grub.cfg ! Il est généré automatiquement par
~$ sudo update-grub
++++
Pour changer la configuration, les fichiers à modifier sont /etc/default/grub et les fichiers du répertoire /etc/grub.d.
Après avoir édité ces fichiers, exécuter
~$ sudo update-grub
pour intégrer les changements dans le menu GRUB 2.
Des applications comme Grub Customizerpermettent de faire certains changements courants, comme le système d'exploitation/noyau par défaut et le délai d'expiration du menu.
Éditer la ou les lignes commençant par GRUB_DISTRIBUTOR. Ces lignes définissent ce qui sera affiché à l'écran.
Choisir parmi les options suivantes (dé-commenter) :
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` # donne : Ubuntu, Linux 2.6...
#GRUB_DISTRIBUTOR=`lsb_release -d -s 2> /dev/null || echo Debian` # donne : Ubuntu 9.10, Linux 2.6...
#GRUB_DISTRIBUTOR=`echo -n $(lsb_release -cds 2> /dev/null || echo Debian)` # donne : Ubuntu 9.10 karmic, Linux 2.6....
Pour ajouter des entrées, éditer avec les droits d'administration le fichier /etc/grub.d/40_custom pour y ajouter les entrées voulues. Tout ce qui est présent dans ce fichier sera recopié tel quel dans le fichier grub.cfg.
Exemple :
### 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. menuentry "Windows 7" { set root=(hd0,1) chainloader +1 }
Avant toute installation de nouveau système, il peut être judicieux de faire une clé USB de secours pour pouvoir remettre en route votre Grub, au cas où.
Avec Gparted (présent sur le live-cd d'Ubuntu), supprimer les partitionss existantes sur la clé et créer 2 partitions :
~$ sudo grub-install --root-directory=/media/ubuntu/GRUB-SOS /dev/sdb
Dans le cas d'une partition de boot séparée, remplacer root-directory par boot-directory.
Maintenant, copier coller tout le contenu du dossier /boot/grub du système à démarrer vers le dossier identique de la clé USB.
Dorénavant, en démarrant l'ordinateur sur la clé USB, on accède au système principal (car il est appelé par son UUID).
On peut aussi éditer le fichier grub.cfg de la clé USB 1)
Par exemple, on peut y mettre un menu de chaînage ou un menu pour lancer l'iso d'un live-cd,..
Basé sur « Article » par Auteur.