Reinstall refind bootloader.

user1272047user1272047
2 min read

Reinstall refind bootloader.

Pre installation
You need to ensure the EFI System Partition (ESP) is mounted when reinstalling rEFInd. The installation process requires access to the ESP to copy rEFInd files to the appropriate location. Here's how to proceed.

sudo mkdir -p /boot/efi
sudo mount /dev/sda1 /boot/efi

Remove old entries

for i in $(efibootmgr | grep '^Boot000' | awk '{print $1}' | sed 's/Boot//;s/\*//'); do
  sudo efibootmgr -b "$i" -B
done

**

The installation**

Steps to Mount ESP and Reinstall rEFInd

  1. Verify the Mount: Check that the ESP is properly mounted:

     ls /boot/efi
    

    You should see directories such as EFI.

  2. Reinstall rEFInd: Run the installation command:

     sudo refind-install
    
  3. Check for Success: Confirm the files are correctly copied into the ESP (e.g., /boot/efi/EFI/refind):

     ls /boot/efi/EFI/refind
    
  4. Set Boot Entry: If necessary, recreate the boot entry:

     sudo efibootmgr -c -d /dev/sda -p 1 -L "rEFInd" -l "\EFI\refind\refind_x64.efi"
    
  5. Set Boot Order: Update the boot order to prioritize rEFInd:

     sudo efibootmgr -o 0000
    
  6. Unmount the ESP (Optional): If you do not need the ESP mounted for other tasks:

     sudo umount /boot/efi
    
  7. Reboot: Reboot to confirm rEFInd is working:

     sudo reboot
    
  8. configuration file refind.conf example

    ```bash

    root@debian:/boot/EFI/refind# sudo efibootmgr BootCurrent: 0000 Timeout: 1 seconds BootOrder: 0000 Boot0000 rEFInd

root@debian:/boot/EFI/refind# cat refind.conf

scan_all_linux_kernels true scan_all_windows true scanfor manual,internal,external,optical,netboot,auto

timeout 20

use_nvram false

showtools install, shell, bootorder, gdisk, memtest, mok_tool, apple_recovery, windows_recovery, about, hidden_tags, reboot, exit, firmware, fwupdate

menuentry "Linux (disk5 - /dev/sda5)" { icon /EFI/refind/icons/os_linux.png volume 03ad73f5-7493-4691-9338-d0f2966ff03a loader /vmlinuz initrd /initrd.img options "ro root=UUID=03ad73f5-7493-4691-9338-d0f2966ff03a" }

menuentry "Linux (disk6 - /dev/sda6)" { icon /EFI/refind/icons/os_linux.png volume 375f02a2-95e2-44d6-b6f4-dd7ddde43e94 loader /vmlinuz initrd /initrd.img options "ro root=UUID=375f02a2-95e2-44d6-b6f4-dd7ddde43e94" }

menuentry "Windows 11. /dev/sda3" { icon \EFI\refind\icons\os_win.png volume B410BFF310BFBB26 loader \WINDOWS\system32\winload.efi description "Windows 11" options "root=PARTUUID=c58d033c-5ff8-41c2-9695-bfa732e90a01" }

#windows

loader \EFI\Microsoft\Boot\bootmgfw.efi

options "root=UUID=B410BFF310BFBB26"

#examples with the option disabled,

#for educational purpose. menuentry Linux { icon EFI/refind/icons/os_linux.png volume 904404F8-B481-440C-A1E3-11A5A954E601 loader bzImage-3.3.0-rc7 initrd initrd-3.3.0.img options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837" disabled }

menuentry "Arch Linux" { icon /EFI/refind/icons/os_arch.png volume "Arch Linux" loader /boot/vmlinuz-linux initrd /boot/initramfs-linux.img options "root=PARTUUID=5028fa50-0079-4c40-b240-abfaf28693ea rw add_efi_memmap" submenuentry "Boot using fallback initramfs" { initrd /boot/initramfs-linux-fallback.img } submenuentry "Boot to terminal" { add_options "systemd.unit=multi-user.target" } disabled }

menuentry Ubuntu { loader /EFI/ubuntu/grubx64.efi icon /EFI/refind/icons/os_linux.png disabled }

menuentry "ELILO" { loader \EFI\elilo\elilo.efi disabled }

menuentry "Windows 7" { loader \EFI\Microsoft\Boot\bootmgfw.efi disabled }

menuentry "Windows via shell script" { icon \EFI\refind\icons\os_win.png loader \EFI\tools\shell.efi options "fs0:\EFI\tools\launch_windows.nsh" disabled }

menuentry "My macOS" { icon \EFI\refind\icons\os_mac.png volume "macOS boot" loader \System\Library\CoreServices\boot.efi disabled }

menuentry "macOS via BootNext" { icon /EFI/refind/icons/os_mac.png firmware_bootnum 80 disabled } root@debian:/boot/EFI/refind#

] ```

0
Subscribe to my newsletter

Read articles from user1272047 directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

user1272047
user1272047