Description
Hello,
I am sure this is a bit of an edge case, but I have a boot stanza with a submenu entry that specifies a different value for "volume", which appears to be causing an issue with the refind-btrfs
script.
This is the boot stanza:
menuentry "Garuda Gnome" {
icon /EFI/refind/gnome_logo.png
volume Btrfs
loader /gnome/boot/vmlinuz-linux-zen
initrd /gnome/boot/initramfs-linux-zen.img
graphics on
options "root=UUID=5fa54f34-b5fc-40be-8092-8ba34ced9eba rw rootflags=subvol=gnome quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0 loglevel=3 nvme.noacpi=1 nowatchdog"
submenuentry "Zen fallback" {
initrd /gnome/boot/initramfs-linux-zen-fallback.img
options "root=UUID=5fa54f34-b5fc-40be-8092-8ba34ced9eba rw rootflags=subvol=gnome nvme.noacpi=1 nowatchdog"
}
submenuentry "LTS kernel" {
loader /gnome/boot/vmlinuz-linux-lts
initrd /gnome/boot/initramfs-linux-lts.img
}
submenuentry "LTS fallback" {
loader /gnome/boot/vmlinuz-linux-lts
initrd /gnome/boot/initramfs-linux-lts-fallback.img
}
submenuentry Grub {
volume EFI
loader /EFI/Gnome/grubx64.efi
}
}
The last submenu entry (Grub) is the one causing an issue, specifically the volume
line. This submenu entry allows booting to Grub from the rEFInd boot options menu.
The "volume" line needs to be specified because the value is different than the one in the main body of the stanza--because, of course, the Grub loader is not on the Btrfs partition, it is on the EFI partition. The submenu entry itself works perfectly fine, but appears to cause an issue when running refind-btrfs
:
sudo refind-btrfs
[sudo] password for jeremy:
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 '/boot/efi' on '/dev/nvme0n1p1'.
Found the root partition on '/dev/nvme0n1p2'.
Searching for snapshots of the 'sway' subvolume in the '/.snapshots' directory.
Found subvolume 'sway' mounted as the root partition.
Found 2 snapshots of the 'sway' subvolume.
Searching for the 'refind.conf' file on '/dev/nvme0n1p1'.
Analyzing the 'refind.conf' file.
ERROR (refind_btrfs.boot.file_refind_config_provider/file_refind_config_provider.py/_read_config_from): Error while parsing the 'refind.conf' file!
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 938, in sub_menu
self._errHandler.sync(self)
File "/usr/lib/python3.10/site-packages/antlr4/error/ErrorStrategy.py", line 231, in sync
raise InputMismatchException(recognizer)
antlr4.error.Errors.InputMismatchException: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/file_refind_config_provider.py", line 246, in _read_config_from
refind_context = parser.refind()
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 183, in refind
self.config_option()
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 237, in config_option
self.boot_stanza()
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 308, in boot_stanza
self.main_option()
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 485, in main_option
self.sub_menu()
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/antlr4/RefindConfigParser.py", line 953, in sub_menu
self._errHandler.reportError(self, re)
File "/usr/lib/python3.10/site-packages/antlr4/error/ErrorStrategy.py", line 128, in reportError
self.reportInputMismatch(recognizer, e)
File "/usr/lib/python3.10/site-packages/antlr4/error/ErrorStrategy.py", line 275, in reportInputMismatch
recognizer.notifyErrorListeners(msg, e.offendingToken, e)
File "/usr/lib/python3.10/site-packages/antlr4/Parser.py", line 322, in notifyErrorListeners
listener.syntaxError(self, offendingToken, line, column, msg, e)
File "/usr/lib/python3.10/site-packages/antlr4/error/ErrorListener.py", line 60, in syntaxError
delegate.syntaxError(recognizer, offendingSymbol, line, column, msg, e)
File "/usr/lib/python3.10/site-packages/refind_btrfs/boot/refind_listeners.py", line 32, in syntaxError
raise RefindSyntaxError(line, column, msg)
refind_btrfs.common.exceptions.RefindSyntaxError: RefindSyntaxError: line - 628, column - 2, message - 'mismatched input 'volume' expecting {'loader', 'initrd', GRAPHICS, 'options', 'add_options', 'disabled'}'
ERROR (refind_btrfs.state_management.refind_btrfs_machine/refind_btrfs_machine.py/run): Could not load rEFInd configuration from file!
Line 628 is the volume EFI
line in the Grub submenu.
Interestingly, this "Garuda Gnome" stanza with the Grub boot option that is causing an issue is not even related to the installation where I am trying to run refind-btrfs
. I am trying to set up refind-btrfs
on a Sway installation that doesn't even have Grub installed.
Disabling the stanza does not prevent refind-btrfs
from erroring out, even when I added the disabled
line above the problematic volume
entry. It seems the script is still trying to make sense of this line for some reason, even when the stanza should be getting ignored.
After explicitly commenting out the four lines related to the Grub submenu entry, the script succeeds.
Since there is a pretty simple workaround, I would consider this a pretty low priority for fixing--especially since, as I mentioned, this is almost certainly an edge case. Still, I figured I would mention it in case you would like to take a look.