Venom1991 / refind-btrfs

Generate rEFInd manual boot stanzas from Btrfs snapshots
GNU General Public License v3.0
144 stars 8 forks source link

Could not load rEFInd configuration from file #24

Closed mizzunet closed 2 years ago

mizzunet commented 2 years ago
Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/loop0' using lsblk.
Initializing the live partition table for device '/dev/loop0' using findmnt.
Initializing the physical partition table for device '/dev/loop1' using lsblk.
Initializing the live partition table for device '/dev/loop1' using findmnt.
Initializing the physical partition table for device '/dev/sda' using lsblk.
Initializing the live partition table for device '/dev/sda' using findmnt.
Initializing the physical partition table for device '/dev/sdb' using lsblk.
Initializing the live partition table for device '/dev/sdb' using findmnt.
Found the ESP mounted at '/boot' on '/dev/sdb1'.
Found the root partition on '/dev/sdb2'.
Found a separate boot partition on '/dev/sdb1'.
Searching for snapshots of the '@' subvolume in the '/.snapshots' directory.
Found subvolume '@' mounted as the root partition.
Found 4 snapshots of the '@' subvolume.
Searching for the 'refind.conf' file on '/dev/sdb1'.
Analyzing the 'refind.conf' file.
Analyzing the 'theme.conf' file.
ERROR (refind_btrfs.boot.file_refind_config_provider/file_refind_config_provider.py/_read_config_from): Error while parsing the 'theme.conf' file!
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/refind_btrfs/boot/file_refind_config_provider.py", line 246, in _read_config_from
    refind_context = parser.refind()
  File "/usr/lib/python3.9/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 185, in refind
    self.config_option()
  File "/usr/lib/python3.9/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 239, in config_option
    self.boot_stanza()
  File "/usr/lib/python3.9/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 304, in boot_stanza
    self.match(RefindConfigParser.OPEN_BRACE)
  File "/usr/lib/python3.9/site-packages/antlr4/Parser.py", line 126, in match
    t = self._errHandler.recoverInline(self)
  File "/usr/lib/python3.9/site-packages/antlr4/error/ErrorStrategy.py", line 395, in recoverInline
    matchedSymbol = self.singleTokenDeletion(recognizer)
  File "/usr/lib/python3.9/site-packages/antlr4/error/ErrorStrategy.py", line 463, in singleTokenDeletion
    self.reportUnwantedToken(recognizer)
  File "/usr/lib/python3.9/site-packages/antlr4/error/ErrorStrategy.py", line 318, in reportUnwantedToken
    recognizer.notifyErrorListeners(msg, t, None)
  File "/usr/lib/python3.9/site-packages/antlr4/Parser.py", line 322, in notifyErrorListeners
    listener.syntaxError(self, offendingToken, line, column, msg, e)
  File "/usr/lib/python3.9/site-packages/antlr4/error/ErrorListener.py", line 60, in syntaxError
    delegate.syntaxError(recognizer, offendingSymbol, line, column, msg, e)
  File "/usr/lib/python3.9/site-packages/refind_btrfs/boot/refind_listeners.py", line 32, in syntaxError
    raise RefindSyntaxError(line, column, msg)
refind_btrfs.common.exceptions.RefindSyntaxError: RefindSyntaxError: line - 89, column - 16, message - 'extraneous input 'Linux'' expecting '{''
ERROR (refind_btrfs.state_management.refind_btrfs_machine/refind_btrfs_machine.py/run): Could not load rEFInd configuration from file!

Boot stanzas

menuentry 'Arch Linux' {
        icon     \EFI\refind\themes\rEFInd-minimal-dark\icons_dark\os_arch.png
        loader   /vmlinuz-linux-xanmod-anbox
        options "root=UUID=8e77f93a-a048-41b4-878e-c9675ea77193 rw rootflags=subvol=@  psi=1 quiet"
        initrd   /intel-ucode.img
        initrd   /initramfs-linux-xanmod-anbox.img
    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
}
menuentry "Windows 11" {
    icon \EFI\refind\themes\rEFInd-minimal-dark\icons_dark\os_win11.png
    loader \EFI\Microsoft\Boot\bootmgfw.efi
}

Full configs. refind.conf: https://0x0.st/-FZJ.conf themes.conf: https://0x0.st/-FZy.conf

Thank you very much (:

Venom1991 commented 2 years ago

Hi there, sorry for the late response - I was asleep (different timezones, I guess).

menuentry 'Arch Linux' should be menuentry "Arch Linux" because the lexer doesn't handle single quoted strings which means that the parser ends up receiving unexpected tokens as its input.
These strings should probably be handled by this tool, though, as rEFInd obviously handles them just fine.

Once you fix that you'll definitely run into this issue for which also exists a simple workaround.

mizzunet commented 2 years ago

Thank for your reply, I got this issue resolved by "", also the next initrd issue as well (:

But now I seem to have another one, Could not find a boot stanza matched with the root partition!

Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/loop0' using lsblk.
Initializing the live partition table for device '/dev/loop0' using findmnt.
Initializing the physical partition table for device '/dev/loop1' using lsblk.
Initializing the live partition table for device '/dev/loop1' using findmnt.
Initializing the physical partition table for device '/dev/sda' using lsblk.
Initializing the live partition table for device '/dev/sda' using findmnt.
Initializing the physical partition table for device '/dev/sdb' using lsblk.
Initializing the live partition table for device '/dev/sdb' using findmnt.
Found the ESP mounted at '/boot' on '/dev/sdb1'.
Found the root partition on '/dev/sdb2'.
Found a separate boot partition on '/dev/sdb1'.
Searching for snapshots of the '@' subvolume in the '/.snapshots' directory.
Found subvolume '@' mounted as the root partition.
Found 5 snapshots of the '@' subvolume.
Searching for the 'refind.conf' file on '/dev/sdb1'.
Analyzing the 'refind.conf' file.
Analyzing the 'theme.conf' file.
ERROR (refind_btrfs.state_management.conditions/conditions.py/check_matched_boot_stanzas): Could not find a boot stanza matched with the root partition!
Venom1991 commented 2 years ago

Try checking whether root=UUID=8e77f93a-a048-41b4-878e-c9675ea77193 really is matched with you / partition (by using lsblk, findmnt or some other tool).

The boot stanza matching requirements are described here (last bullet).

EDIT: Oh, I see why your "Arch Linux" boot stanza is ignored... It's missing the "volume" option which causes this method to return False.

mizzunet commented 2 years ago

Try checking whether root=UUID=8e77f93a-a048-41b4-878e-c9675ea77193 really is matched with you / partition (by using lsblk, findmnt or some other tool).

I have been booting the entry without any errors. I checked once again anyway, Yes it is

The boot stanza matching requirements are described here (last bullet).

So, I added volume, volume ARCH. Now, the command is successfully executed.

Thanks once again ♥

Venom1991 commented 2 years ago

No problem. :+1: