Skip to content

Conversation

@justbispo
Copy link

@justbispo justbispo commented Aug 4, 2025

This fixes #1951.

PR Description:

This PR simply adds support for rEFInd boot manager. I've checked all the places where the boot managers are called to make sure I didn't miss anything.
I've also followed the Arch Wiki page about rEFInd to make sure I made the installation function correct.
Before accepting the PR, I'd like an opinion about a small issue I noticed. I didn't know this but per the Arch Wiki, rEFInd is supposed to use the distro logo but after the installation is finished, it uses the Tux logo. After checking the partitions, it's as it says there, the root partition is of type Linux x86-64 root (/) instead of Linux filesystem. But the installation guide suggests using Linux x86-64 root (/). The Wiki also shows two other fixes, but I don't know if the label can be changed in the rEFInd installation step and copying the distro image seems easy, tho I don't know if it's the best solution
Is this and issue that can be fixed?

Just a note for the future, I'd also like to include refind-btrfs, like grub includes grub-btrfs, to show BTRFS snapshots as boot options, but refind-btrfs isn't in the extra repository.

Tests and Checks

  • I have tested the code!

@justbispo justbispo requested a review from Torxed as a code owner August 4, 2025 00:26
@Torxed
Copy link
Member

Torxed commented Aug 4, 2025

Thank you for this contribution, I'll do some tests with this one before merging in.
While I do those tests, could you fix the ruff formatting complaints?

I have never used refind, so I'll have to test and read about the logo situation :)

I could also look into the possibility to package refind-btrfs for us into extra instead of AUR, I just need to check the build process and see what it does before we do.

@justbispo
Copy link
Author

Done, I thought the pre-commit hook would add the formatting changes to the commit.

@Torxed
Copy link
Member

Torxed commented Aug 4, 2025

Done, I thought the pre-commit hook would add the formatting changes to the commit.

My understanding is that you need to enable them locally, our repo simply contains the hooks that you would need.

@Torxed
Copy link
Member

Torxed commented Aug 27, 2025

I'm still away on a trip and have limited access to proper internet.
So I won't be able to test this (installing packages and what not takes too much data).
This means I don't dare to merge this in for the next minor release that I plan on pushing today.

I still welcome this contribution, just thought I'd let you know why it won't make it in to the next release ~today. But it's coming!

@Mattyan89
Copy link

I've tried this PR, the system doesn't boot if the esp is mounted to /efi instead of /boot:
Schermata_20250910_154127
Schermata_20250910_153701
The installed system has two refind_linux.conf files, one in /efi and one in /boot:
Schermata_20250910_155153
To me it looks like it's trying to boot from the iso instead of the installed system, but I'm not sure if it is the only problem as I don't understand the error in the second screen.

@justbispo
Copy link
Author

I did some testing and noticed that the boot_partition and efi_partition point to the same /efi partition.
Can you try replacing the line 1562 with config_path = self.target / 'boot' / 'refind_linux.conf'? It worked for me when I tried to fix your situation.
I've never installed Arch with a separate partition for the ESP, can you confirm that this disk configuration is the correct one, so I know I'm testing it correctly:

{
    "disk_config": {
        "btrfs_options": {
            "snapshot_config": null
        },
        "config_type": "manual_partitioning",
        "device_modifications": [
            {
                "device": "/dev/vda",
                "partitions": [
                    {
                        "btrfs": [],
                        "dev_path": null,
                        "flags": [
                            "boot",
                            "esp"
                        ],
                        "fs_type": "fat32",
                        "mount_options": [],
                        "mountpoint": "/efi",
                        "obj_id": "cbfc8315-b53e-497a-b793-8620731d3b02",
                        "size": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "MiB",
                            "value": 512
                        },
                        "start": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "MiB",
                            "value": 1
                        },
                        "status": "create",
                        "type": "primary"
                    },
                    {
                        "btrfs": [],
                        "dev_path": null,
                        "flags": [
                            "bls_boot"
                        ],
                        "fs_type": "ext4",
                        "mount_options": [],
                        "mountpoint": "/boot",
                        "obj_id": "33ec68f8-2106-4a14-a980-3bdcb63b3a2f",
                        "size": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "GiB",
                            "value": 1
                        },
                        "start": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "B",
                            "value": 537919488
                        },
                        "status": "create",
                        "type": "primary"
                    },
                    {
                        "btrfs": [],
                        "dev_path": null,
                        "flags": [],
                        "fs_type": "ext4",
                        "mount_options": [],
                        "mountpoint": "/",
                        "obj_id": "c9a4c1a3-9306-4451-b6d4-df8f394f6c42",
                        "size": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "B",
                            "value": 19862126592
                        },
                        "start": {
                            "sector_size": {
                                "unit": "B",
                                "value": 512
                            },
                            "unit": "B",
                            "value": 1611661312
                        },
                        "status": "create",
                        "type": "primary"
                    }
                ],
                "wipe": false
            }
        ]
    }
}

@Mattyan89
Copy link

Mattyan89 commented Sep 12, 2025

Thank you, I am trying to leave /boot on the root filesystem so the kernel is backed up toghether with the rest of the system when I take a btrfs snapshot. So only /efi is mounted on a separate fat32 partition and should only contain the bootloader. This happens when booting with that line changed:
Schermata_20250912_060749
EDIT: I managed to get it to boot by editing /boot/refind_linux.conf
If the initramfs image is on a btrfs subvolume, the entry has to be: initrd=@\boot\initramfs-linux.img
https://wiki.archlinux.org/title/REFInd#Auto_detection

Also fixed issue where if /boot is located in a BTRFS root partition, the initrd path wasn't including the subvol name.
@justbispo
Copy link
Author

I've investigated further and I think this last commit fixes the cases of different partition layouts.
I've tested with /, /boot and /efi in different partitions, only /efi a separate partition and /boot inside the / partition as BTRFS and ext4. It should cover all cases.

@Torxed
Copy link
Member

Torxed commented Nov 2, 2025

Good job, and thank you for the work you've put in.
I apologies for my radio silence, for personal reasons I haven't been able to dig into this one - but that does not mean this isn't desired or appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rEFind as an alternative bootloader

3 participants