Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Modifying main refind config in case when manual stanzas are defined in an included file #12

Closed
psfloyd opened this issue Aug 1, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@psfloyd
Copy link

psfloyd commented Aug 1, 2021

I think i have found a bug. For the tool to work properly the manual stanza that it searches must be on the main config file (the one specified in /etc/refind-btrfs.conf).
If the stanzas are in a file that is included (using refind's include token), then the tool does not generate the necesary files under btrfs-snapshot-stanzas and does not moidify the main config file.

I leave an example of this behavior below. I have created 2 files to isolate the issue refind-main.conf and refind-stanzas.conf in the ESP mount and pointed refind-btrfs to the main file.

Situation 1: stanza in main config file, working properly

In this situation the tool created the files in the btrfs-snapshot-stanzas subdirectory and appended the include btrfs-snapshot-stanzas/kstar-root_vmlinuz-linux.conf line.

Main config:

# refind-main.conf

timeout -1

use_graphics_for linux, windows
scanfor manual,internal,external,optical,netboot,hdbios,biosexternal,cd

include refind-stanzas.conf

# stanza
menuentry "Arch Linux - Stable" {
    icon /EFI/refind/icons/os_arch.png
    volume kstar-root
    loader /vmlinuz-linux
    initrd /initramfs-linux.img
    options "root=/dev/mapper/kstar-root rw add_efi_memmap rootflags=subvol=@ initrd=\intel-ucode.img"
    submenuentry "Boot - fallback" {
        initrd /initramfs-linux-fallback.img
    }
    submenuentry "Boot - terminal" {
        add_options "systemd.unit=multi-user.target"
    }
}

Included config:

# refind-stanzas.conf

Output of refind-btrfs

Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/nvme0n1' using lsblk.
Initializing the live partition table for device '/dev/nvme0n1' using findmnt.
Found the ESP mounted at '/efi' on '/dev/nvme0n1p1'.
Found the root partition on '/dev/mapper/kstar-root'.
Found a separate boot partition on '/dev/nvme0n1p2'.
Searching for snapshots of the '@' subvolume in the '/.snapshots' directory.
Found subvolume '@' mounted as the root partition.
Found 58 snapshots of the '@' subvolume.
Searching for the 'refind-main.conf' file on '/dev/nvme0n1p1'.
Analyzing the 'refind-main.conf' file.
Found 1 boot stanza matched with the root partition.
Initializing the static partition table for subvolume '@snapshots/68/snapshot' from its fstab file.
Found 1 snapshot for addition.
Found 1 snapshot for removal.
Creating a new writable snapshot from the read-only '@snapshots/68/snapshot' snapshot at '/root/.refind-btrfs/rwsnap_2021-08-01_11-54-02_ID587'.
Modifying the '/root/.refind-btrfs/rwsnap_2021-08-01_11-54-02_ID587/etc/fstab' file.
Deleting the '@/root/.refind-btrfs/rwsnap_2021-08-01_11-53-22_ID585' snapshot.
Writing to the 'btrfs-snapshot-stanzas/kstar-root_vmlinuz-linux.conf' file.
Appending 1 'include' directive to the 'refind-main.conf' file.

Situation 2: stanza is in an included config file, not working

In this situation the tool did not create any files or subdirectories and did not add any lines to the main config file.

Main config:

# refind-main.conf

timeout -1

use_graphics_for linux, windows
scanfor manual,internal,external,optical,netboot,hdbios,biosexternal,cd

include refind-stanzas.conf

Included config:

# refind-stanzas.conf

# stanza
menuentry "Arch Linux - Stable" {
    icon /EFI/refind/icons/os_arch.png
    volume kstar-root
    loader /vmlinuz-linux
    initrd /initramfs-linux.img
    options "root=/dev/mapper/kstar-root rw add_efi_memmap rootflags=subvol=@ initrd=\intel-ucode.img"
    submenuentry "Boot - fallback" {
        initrd /initramfs-linux-fallback.img
    }
    submenuentry "Boot - terminal" {
        add_options "systemd.unit=multi-user.target"
    }
}

Output of refind-btrfs

Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/nvme0n1' using lsblk.
Initializing the live partition table for device '/dev/nvme0n1' using findmnt.
Found the ESP mounted at '/efi' on '/dev/nvme0n1p1'.
Found the root partition on '/dev/mapper/kstar-root'.
Found a separate boot partition on '/dev/nvme0n1p2'.
Searching for snapshots of the '@' subvolume in the '/.snapshots' directory.
Found subvolume '@' mounted as the root partition.
Found 59 snapshots of the '@' subvolume.
Searching for the 'refind-main.conf' file on '/dev/nvme0n1p1'.
Analyzing the 'refind-main.conf' file.
Analyzing the 'refind-stanzas.conf' file.
Found 1 boot stanza matched with the root partition.
Initializing the static partition table for subvolume '@snapshots/69/snapshot' from its fstab file.
Found 1 snapshot for addition.
Found 1 snapshot for removal.
Creating a new writable snapshot from the read-only '@snapshots/69/snapshot' snapshot at '/root/.refind-btrfs/rwsnap_2021-08-01_11-56-02_ID589'.
Modifying the '/root/.refind-btrfs/rwsnap_2021-08-01_11-56-02_ID589/etc/fstab' file.
Deleting the '@/root/.refind-btrfs/rwsnap_2021-08-01_11-54-02_ID587' snapshot.
@Venom1991
Copy link
Owner

Venom1991 commented Aug 1, 2021

So, it did generate a new snapshot, modify its fstab file but it did not create a new config file for the generated boot stanza nor did it include that file in the refind-main.conf file? Alright, I'll have to reproduce that locally and debug it, I guess.
What's interesting is that the output simply stops after the "Deleting the..." line without an error or something.

I remember that this scenario worked well, initially, but later changes might have broken that functionality (that is, included config support).

@Venom1991 Venom1991 self-assigned this Aug 1, 2021
@Venom1991 Venom1991 added the bug Something isn't working label Aug 1, 2021
@Venom1991 Venom1991 changed the title Possible bug: Modifiing refind configs when manual stanzas are in an included file Possible bug: Modifying main refind config in case manual stanzas are defined in an included file Aug 1, 2021
@Venom1991 Venom1991 changed the title Possible bug: Modifying main refind config in case manual stanzas are defined in an included file Possible bug: Modifying main refind config in case when manual stanzas are defined in an included file Aug 1, 2021
@Venom1991 Venom1991 changed the title Possible bug: Modifying main refind config in case when manual stanzas are defined in an included file Bug: Modifying main refind config in case when manual stanzas are defined in an included file Aug 1, 2021
@Venom1991
Copy link
Owner

Fix in the following commit, pending release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants