{{tag>Brouillon Boot EFI}} # Grub boot migration BIOS vers UEFI EFI en MBR Voir : * https://wiki.debian-fr.xyz/Debian_%26_UEFI Voir aussi : * systemd-boot (Remplace Grub pour les machines compatibles EFI) Avant toute chose sauvegarder ! Il existe une version de Grub pour DOS/MBR : grub-pc\\ Il existe une version de Grub pour EFI/MBR : grub-efi\\ Les deux peuvent être installés sur la même machine. Testé sous Debian Création d'une partition **/boot/efi** en FAT de type "**ef**" Sur une partition primaire (je n'ai pas testé sur une partition logique) (Taille minimum recommandée : 1MB) ## Installation prérequis ~~~bash #apt-get install efivar syslinux-efi apt-get install efibootmgr grub-efi dosfstools ~~~ Pour Debian Wheezy, une façon de faire est de mettre à jour Grub en prenant les paquets de Jessie : * grub2-common * grub-common * grub-efi * grub-efi-amd64 * grub-efi-amd64-bin ## Partitionnement Créer une partion de VFAT de 20M (1M minimum conseillé) de type "ef" Pour cela il peut être nécessaire de réduire la partition principale à l'aide de GParted (inclus dans systemrescuecd, taper `startx` pour lancer l’interface graphique) Ou avec `fdisk` ~~~bash fdisk /dev/sda # Part type id (Hex code) : "ef" EFI (FAT-12/16/ ~~~ ## Formatage / Montage partition EFI ~~~bash mkfs.vfat /dev/sda4 mkdir -p /boot/efi ~~~ Trouver le UUID de le partition EFI. ~~~bash fdisk -l | grep EFI blkid /dev/sda4 ~~~ Remplacer B24E-9BC6 par votre UUID `/etc/fstab` ~~~ #/dev/sda4 #UUID=B24E-9BC6 /boot/efi vfat defaults,uid=0,gid=0,umask=0077,shortname=winnt 0 0 UUID=8343-3610 /boot/efi vfat umask=0077 0 1 ~~~ Montage de la partition EFI crée. ~~~bash mount /boot/efi ~~~ ## Installation Grub ~~~bash grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck /dev/sda ~~~ ## Boot auto Pour booter automatiquement sur Grub Par défaut le système s'attend à démarrer sur : * /boot/efi/EFI/boot/bootx64.efi * /boot/efi/EFI/BOOT/BOOTX64.efi ~~~bash cd /boot/efi/EFI mkdir boot cp -p debian/grubx64.efi boot/bootx64.efi ~~~ ## Autres A tester ~~~bash mkdir -p /boot/grub/locale cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo ~~~ ## Pb ### Err failed to register the EFI boot entry: Invalid argument. ~~~ # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck /dev/sda Installing for x86_64-efi platform. grub-install: warning: Cannot read EFI Boot* variables. grub-install: warning: efivarfs_get_variable: read failed: Invalid argument. grub-install: warning: efi_get_variable: ops->get_variable failed: Invalid argument. grub-install: error: failed to register the EFI boot entry: Invalid argument. ~~~ #### Solution Ajouter `--no-nvram` ou `--removable` à `grub-install` ~~~bash grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck /dev/sda --removable ~~~