Skip to content
tvphus tvp's blog

How to migrate from rEFInd to Limine bootloader with Snapper Sync

This is a guide on how to replace the rEFInd bootloader with Limine combined with Snapper Sync to access snapshots right from the Limine boootloader screen. Very convenient to revert to a snapshot for troubleshooting when upgrading.

tvphus tvphus Guide 5 min read

Before diving deep into the boot system, create a manual backup using Snapper. If the Limine installation encounters unexpected issues, you can easily chroot or use a Live USB to rollback to this safe state.

Open your terminal and run the following command:

Terminal window
sudo snapper -c root create -d "Backup before installing Limine"

You can set the description to anything, but it should be something memorable.

To avoid the “No space left on device” error when the tool automatically copies large kernel files, we need to clean up the remnants of the old system.

Open the terminal and delete the old kernel files located in the /boot root directory, along with rEFInd:

Terminal window
# Delete old kernels and initramfs (Only keep the machine ID folder and amd-ucode.img)
sudo rm -f /boot/vmlinuz-*
sudo rm -f /boot/initramfs-*
# Completely remove rEFInd (Only remove if your ESP is full; otherwise, you can remove it after Limine is installed)
sudo rm -rf /boot/EFI/refind
sudo rm -f /boot/refind_linux.conf
sudo pacman -Rs refind
  • If you haven’t removed rEFInd yet: Leave it there. If installing Limine fails, you can still boot using rEFInd without wasting time restoring a snapshot.
  • If you have decided to remove rEFInd: If rEFInd is still in the BIOS, use efibootmgr to find its ID and remove it using sudo efibootmgr -b <id> -B.

Arch Linux typically uses mkinitcpio as the default initramfs generator. You need to install Limine along with its corresponding automatic hook tools:

Terminal window
# Install the core bootloader
sudo pacman -S limine efibootmgr
# Install automation packages (Using yay or paru)
paru -S limine-mkinitcpio-hook limine-snapper-sync snap-pac
  • Note: If your system uses dracut instead of mkinitcpio, install the limine-dracut-support package instead.

We will not write the limine.conf file manually; instead, we will configure parameters so the system generates it automatically.

Terminal window
sudo cp /etc/limine-entry-tool.conf /etc/default/limine
  • The official documentation requires copying this file if it doesn’t already exist in the destination folder.

Open the copied configuration file:

Terminal window
sudo nano /etc/default/limine
  • Use += to ensure you don’t overwrite the system’s default parameters. Add the following lines to the bottom of the file:
# 1. Declare the Btrfs partition and enable modeset for NVIDIA
KERNEL_CMDLINE[default]+=rw root=PARTUUID=713edcc1-746d-4838-976f-ef5220e20e64 rootflags=subvol=@ nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_UseKernelSuspendNotifiers=1 loglevel=3
KERNEL_CMDLINE[default]+=initrd=/amd-ucode.img
# 2. Auto-detect and add Windows to the Boot menu (enabled by default)
FIND_BOOTLOADERS=yes
# 3. Limit the number of snapshot entries and limit the maximum boot partition disk usage
MAX_SNAPSHOT_ENTRIES=2
LIMIT_USAGE_PERCENT=85
  • Parameters 1 and 2 are already declared in the config file. If you need to find them (in the nano editor), you can use Ctrl+W, enter the content (e.g., KERNEL_CMDLINE), and press Enter.
  • It is recommended to use PARTUUID instead of UUID because its value remains constant even when formatting (unless the partition is deleted and recreated), preventing boot errors.
  • The automation tool supports converting the initrd= parameter into a module path for Limine and detects other EFI loaders within the same ESP.
  • Manually declaring Snapper limits: The limine-snapper-sync package will create a snapshot every time there is a system update or if you want to quickly boot into a snapshot right from the Limine screen. I limited it to 2 protective snapshots because my partition is only 700MB. The Wiki recommends a minimum of 4GB; if you want the most accurate configuration, you can follow the Wiki.

To be able to boot into Read-only Btrfs backups without crashing the Wayland interface, a temporary writable layer (OverlayFS) must be created.

  1. Open the mkinitcpio configuration file:
Terminal window
sudo nano /etc/mkinitcpio.conf

Find the line HOOKS=(...) and add sd-btrfs-overlayfs immediately after the filesystems hook (or the systemd hooks).

Now, let Limine do its job:

Terminal window
sudo limine-install
# Successful EFI Limine installation output
Limine EFI install completed successfully.

This command will install Limine and automatically copy the BOOTX64.EFI file to the correct location on your UEFI system.

Terminal window
sudo limine-update
# Output indicating successful generation
Limine EFI update completed successfully.
Building initramfs for linux (7.0.9-arch2-1)
==> Starting build: '7.0.9-arch2-1'
-> Running build hook: [base]
-> Running build hook: [systemd]
-> Running build hook: [autodetect]
-> Running build hook: [microcode]
-> Running build hook: [modconf]
-> Running build hook: [kms]
-> Running build hook: [keyboard]
-> Running build hook: [sd-vconsole]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: '/tmp/staging_initramfs.img'
-> Early uncompressed CPIO image generation successful
==> Initcpio image generation successful
Kernel stored in /boot/8d3cacd7063045c0b66b489e305d358b/linux/vmlinuz-linux
Initramfs stored in /boot/8d3cacd7063045c0b66b489e305d358b/linux/initramfs-linux
Updated: /boot/limine.conf

This command will update Limine, scan the kernels, and automatically call mkinitcpio/dracut to package the system.

To add Windows 11 to the menu, run the sudo limine-scan command, enter the number of the Windows Boot Manager entry, then press Enter to add the entry to Limine:

Terminal window
sudo limine-scan
Available EFI Boot Entries:
# │ Name │ GPT UUID │ EFI Path
───┼──────────────────────┼──────────────────────────────────────┼─────────────────────────────────
1 rEFInd Boot Manager 07d4dccd-51f7-4b8a-80d7-3bacdc77d6cc /EFI/refind/refind_x64.efi
2 Limine 07d4dccd-51f7-4b8a-80d7-3bacdc77d6cc /EFI/limine/limine_x64.efi
3 Windows Boot Manager 07d4dccd-51f7-4b8a-80d7-3bacdc77d6cc /EFI/Microsoft/Boot/bootmgfw.efi
Use ↑/↓ to select a boot entry (1-3), or type [c]ancel to abort.
Your input: 3
New entry name: Windows Boot Manager
Entry added to Limine: /EFI/Microsoft/Boot/bootmgfw.efi

Finally, run sudo limine-update:

Terminal window
sudo limine-update
# Log báo update thành công EFI
Limine EFI update completed successfully.
Building initramfs for linux (7.0.9-arch2-1)
==> Starting build: '7.0.9-arch2-1'...
...Kernel stored in /boot/8d3cacd7063045c0b66b489e305d358b/linux/vmlinuz-linux
Initramfs stored in /boot/8d3cacd7063045c0b66b489e305d358b/linux/initramfs-linux
Updated: /boot/limine.conf

Reboot your machine and boot into Arch Linux using the Limine bootloader.

If you have successfully booted into Arch Linux and Windows, you can now remove rEFInd:

Terminal window
sudo rm -rf /boot/EFI/refind
sudo rm -f /boot/refind_linux.conf
sudo pacman -Rs refind

Use efibootmgr to find the ID of rEFInd and delete it so it no longer appears in the BIOS:

Terminal window
# View boot list and IDs
efibootmgr
# Remove rEFInd entry
sudo efibootmgr -b <id> -B

Start the background service so that every time pacman updates, the system automatically syncs the 2 latest snapshots to the Limine menu.

Terminal window
# Run manual sync for the first time to verify
sudo limine-snapper-sync
# Enable the automated background service
sudo systemctl enable --now limine-snapper-sync.service

ROOT_SNAPSHOTS_PATH="/@/.snapshots" does not match the expected path "/@snapshots" from /proc/mounts
Please set 'ROOT_SNAPSHOTS_PATH=/@snapshots' in /etc/default/limine
  • Cause: By default, the limine-snapper-sync tool is designed according to Snapper’s standard Btrfs structure, where the default backup directory is nested inside the root directory at the path /@/.snapshots.

Solution:

  1. Open the configuration file:
Terminal window
sudo nano /etc/default/limine
  1. Add this line to the bottom of the file:
ROOT_SNAPSHOTS_PATH=/@snapshots
  1. Save the file and run the sync command again:
Terminal window
sudo limine-snapper-sync

This happens because Limine uses auto-scan, it will find any EFI file in the ESP and show it on the menu, even after deleting the boot entry in efibootmgr. Just look for any traces of rEFInd remaining in /boot.

You can visit this folder on a file manager (Dolphin on KDE) instead of the terminal to explore the folders & files easier.

Terminal window
# rEFInd still remains in /boot/EFI/Boot (your path might be a bit different, e.g. `/efi/EFI/Boot`; `/boot/efi/EFI/Boot`)
ls /boot/EFI/Boot -al
total 416
drwxr-xr-x 5 root root 4096 May 19 04:50 .
drwxr-xr-x 8 root root 4096 May 25 06:26 ..
-rwxr-xr-x 1 root root 134 May 19 04:50 BOOT.CSV
-rwxr-xr-x 1 root root 320568 May 25 20:46 bootx64.efi
drwxr-xr-x 2 root root 4096 May 19 04:50 drivers_x64
drwxr-xr-x 3 root root 8192 May 19 04:50 icons
drwxr-xr-x 2 root root 4096 May 19 04:50 keys
-rwxr-xr-x 1 root root 36407 May 19 04:50 refind.conf
-rwxr-xr-x 1 root root 36399 May 19 04:50 refind.conf-sample

There are a lot of files in here, just to make sure we are not accidentally deleting the wrong bootloader, do a strings | grep for rEFInd.

Terminal window
# String grep to search for refind
strings /boot/EFI/Boot/bootx64.efi | grep -i -E "refind|grub|limine|systemd"
refind,1,Roderick W. Smith,refind,0.14.1,https://www.rodsbooks.com/refind
refind.arch,1,Arch Linux,refind,0.14.2-2,https://archlinux.org/packages/?q=refind

Now that we knows this is the remaining files from rEFInd, feel free to delete everything in here and replace the bootx64.efi with Limine’s as this is a fallback EFI.

Terminal window
# Always make sure to double check when you are running a rm -rf command!
sudo rm -rf /boot/EFI/Boot/*
# Copy the bootx64.efi from Limine
sudo cp /usr/share/limine/BOOTX64.EFI /boot/EFI/Boot/bootx64.efi
# Finally, do a limine-update command to update it
sudo limine-update

Reboot your system, and you should no longer see the rEFInd boot entry again.

Once the setup is complete, if there is a new Kernel update in the future, pacman’s hooks will automatically handle everything, completely unattended. Even during system updates, snapper will automatically take a snapshot right before updating; if an error occurs, you can immediately revert to fix it.

Comments