REFInd

De Banane Atomic
Aller à la navigationAller à la recherche
La version imprimable n’est plus prise en charge et peut comporter des erreurs de génération. Veuillez mettre à jour les signets de votre navigateur et utiliser à la place la fonction d’impression par défaut de celui-ci.

Mise à jour

Manuelle

Bash.svg
# faire une sauvegarde du fichier de configuration
sudo cp /boot/EFI/refind/refind.conf /boot/EFI/refind/refind.conf.bak
# comparer la configuration actuelle avec la nouvelle configuration d'exemple
sudo meld /boot/EFI/refind/refind.conf /usr/share/refind/refind.conf-sample

# mettre à jour les dossiers drivers_x64, il ne doit contenir que les drivers utiles, car refind les charge tous.
sudo cp -R /boot/EFI/refind/drivers_x64 /boot/EFI/refind/drivers_x64.bak
sudo meld /boot/EFI/refind/drivers_x64 /usr/share/refind/drivers_x64

# mettre à jour les dossiers icons et fonts
sudo mv /boot/EFI/refind/icons /boot/EFI/refind/icons.bak
sudo mv /boot/EFI/refind/fonts /boot/EFI/refind/fonts.bak
sudo cp -R /usr/share/refind/icons /boot/EFI/refind
sudo cp -R /usr/share/refind/fonts /boot/EFI/refind

Pacman hook

/etc/pacman.d/hooks/refind.hook
[Trigger]
Operation=Upgrade
Type=Package
Target=refind-efi

[Action]
When=PostTransaction
Exec=/usr/bin/refind-install
Un script perso peut être utilisé à la place de /usr/bin/refind-install

Configuration

/boot/EFI/refind/refind.conf
# en secondes. 0 → pas de boot auto. -1 → immédiat
timeout -1

# Which types of boot loaders to search, and in what order to display them:
#  internal      - internal EFI disk-based boot loaders
#  external      - external EFI disk-based boot loaders
#  optical       - EFI optical discs (CD, DVD, etc.)
#  netboot       - EFI network (PXE) boot options
#  hdbios        - BIOS disk-based boot loaders
#  biosexternal  - BIOS external boot loaders (USB, eSATA, etc.)
#  cd            - BIOS optical-disc boot loaders
#  manual        - use stanzas later in this configuration file
# On UEFI PCs, default is internal,external,optical,manual
scanfor manual

# partitions à ne pas scanner
# identifier les partitions par leurs labels (blkid /dev/{devicename})
dont_scan_volumes "label1","label2"

# sélection par défaut
default_selection "Arch Linux"
# default_selection 1
# The default behavior is to boot the previously-booted OS.

Manuelle

/boot/EFI/refind/refind.conf
menuentry "Arch Linux" {
    icon     /EFI/refind/icons/os_arch.png
    volume   BOOT
    loader   /vmlinuz-linux
    initrd   /initramfs-linux.img
    options  "root=/dev/sdxy rootfstype=ext4 rw add_efi_memmap"
    # root=LABEL=root
    # root=PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF
    submenuentry "Boot using fallback initramfs" {
        initrd /initramfs-linux-fallback.img
    }
    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
}

menuentry "Windows" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
}
volume peut référencer un LABEL, un PARTLABEL, un PARTUUID, ou un volume number (ex 0:)
Bash.svg
# lister les partition qui ont un label
ls -l /dev/disk/by-label

# ajouter un label à une partition vfat 
sudo dosfslabel /dev/sdbX BOOT

# ajouter un label à une partition ext2/3/4 
sudo e2label /dev/sdbX MonLabel

Détection automatique du noyau

Bash.svg
sudo cp /usr/share/refind/refind_linux.conf-sample /boot/refind_linux.conf
/boot/refind_linux.conf
# La première ligne non-commentée définit les options du menu principale
# Chaque ligne supplémentaire permet d'ajouter un sous-menu (accessible via F2)
"Boot with defaults"    "root=/dev/sdxy rootfstype=ext4 rw add_efi_memmap"
"Boot to terminal"      "root=/dev/sdxy rootfstype=ext4 rw add_efi_memmap systemd.unit=multi-user.target"

Kernel parameters

kernel parameter description
acpi_osi=Linux par défaut le noyau se définit comme Windows. Permet de forcer Linux.
Ainsi le BIOS désactivera les fonctionnalités spécifiques à Windows et activera celles de Linux.
acpi_backlight=vendor change l'ordre de chargement des pilotes ACPI de rétroéclairage: le pilote spécifique en premier, puis le pilote générique.

Démarrer sur le terminal

kernel parameter
systemd.unit=multi-user.target écran noir avec le pilote nvidia [1]
systemd.unit=multi-user.target nomodeset ok avec le pilote nvidia

UEFI shell commands

Bash.svg
# affichage de la mapping table
map

# accèder à FS2
FS2:
ls
cd \EFI\arch\refind
edit refind.conf

# chargement du pilote ext4
load FS2:\EFI\refind\drivers_x64\ext4_x64.efi

# recharger la mapping table
map -r

# lister les entrées
bcfg boot dump -v

# ajouter une entrée
bcfg boot add 3 fs2:\EFI\refind\refind_x64.efi "rEFInd"

# passer l'entrée 3 en première position (0)
bcfg boot mv 3 0

# launch the bootloader
\EFI\refind\refind_x64.efi

startup.nsh

Fichier exécuté au lancement d'un UEFI Shell

/boot/startup.nsh
\EFI\refind\refind_x64.efi

Installation

Bash.svg
sudo pacman -S refind-efi

# montez la partition UEFI
mount /dev/sdxy /boot
 
mkdir -p /boot/EFI/refind

cp /usr/share/refind/refind_x64.efi /boot/EFI/refind
cp /usr/share/refind/refind.conf-sample /boot/EFI/refind/refind.conf
cp -r /usr/share/refind/icons /boot/EFI/refind/
cp -r /usr/share/refind/fonts /boot/EFI/refind/
# copier seulement les drivers utiles (ext4, ntfs, iso9660)
cp -r /usr/share/refind/drivers_x64 /boot/EFI/refind/

# Create a boot entry in the UEFI NVRAM in the motherboard using efibootmgr 
efibootmgr --create --disk /dev/sdx --part 1 --label "rEFInd" --loader /EFI/refind/refind_x64.efi

# lister les entrées
efibootmgr -v

Dual boot avec Windows

Si Windows est déjà installé, il faut monter la partition EFI fat32 dans /boot avant de chrooter.

Restore rEFInd boot manager after Windows overwrote it

Ps.svg
# list boot entries
bcdedit /enum firmware
# set the default boot entry to refind boot manager
bcdedit /set "{fwbootmgr}" DEFAULT "{refind boot manager id}"

# move refind boot manager to the first place in the display order (seems to be the same as DEFAULT)
bcdedit /set "{fwbootmgr}" displayorder "{refind boot manager id}" /addfirst

# set the timeout to 5 seconds (doesn't change anything as boot entries are not displayed)
bcdedit /set "{fwbootmgr}" TIMEOUT 5