grub-btrfs
grub-btrfs copied to clipboard
Bind mounted /boot, no boot menu option in GRUB although snapshots are found during initialization.
Arch linux, latest grub-btrfs, snapper, similar issue to: https://github.com/Antynea/grub-btrfs/issues/72, but I have a bind mounted /boot partition.
I have a binded /boot mount from /efi/EFI/GRUB. Initialization of grub-mkconfig is successful and grub-btrfs finds the latest 50 snapshots, so nothing wrong there, however no boot menu entry shows up. I also enabled and activated grub-btrfs with systemctl.
In my grub.conf, @ ### BEGIN /etc/grub.d/10_linux ### the linux and initrd lines are the following:
linux /EFI/GRUB/vmlinuz-linux root=UUID=e1a54cc8-50d4-44bf-8795-58633742fefe rw rootflags=subvol=@root loglevel=3 quiet
initrd /EFI/GRUB/intel-ucode.img /EFI/GRUB/initramfs-linux.img
thus in my grub-btrfs.cfg, the same happens:
`submenu 'Snapshot: 2021-05-20 12:00:09 @snapshots/990/snapshot | single | timeline' { submenu '---> Snapshot: 2021-05-20 12:00:09 @snapshots/990/snapshot | single | timeline <---' { echo }
menuentry 'vmlinuz-linux & initramfs-linux-fallback.img & intel-ucode.img' --class snapshots --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-snapshots-20BD-33C4' {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
fi
set gfxpayload=keep
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 20BD-33C4
else
search --no-floppy --fs-uuid --set=root 20BD-33C4
fi
echo 'Loading Snapshot: 2021-05-20 12:00:09 @snapshots/990/snapshot'
echo 'Loading Kernel: vmlinuz-linux ...'
linux "/EFI/GRUB/vmlinuz-linux" root=UUID=e1a54cc8-50d4-44bf-8795-58633742fefe loglevel=3 quiet rootflags=rw,noatime,compress=zstd:1,ssd,space_cache=v2,subvol="@snapshots/990/snapshot"
echo 'Loading Microcode & Initramfs: intel-ucode.img initramfs-linux-fallback.img ...'
initrd "/EFI/GRUB/intel-ucode.img" "/EFI/GRUB/initramfs-linux-fallback.img"
}`
I am not sure if this is the issue or not. If this is the issue, does it mean that I cannot use grub-btrfs if I have used a bind mount method, or is there a workaround?
however no boot menu entry shows up
please specify
Also, tell me where the files grub.conf and grub-btrfs.conf are actually located, without your tweak
And finally, provide the grub.conf file
The files are located at /efi/EFI/GRUB/grub/*. They get automatically copied, kind of a symlinked to /boot/grub/*.
My grub.cfg: https://pastebin.com/bKxwF3Vc
grub.cfg
### BEGIN /etc/grub.d/41_snapshots-btrfs ###
submenu 'Arch Linux snapshots' {
configfile "${prefix}/grub-btrfs.cfg"
}
/efi/EFI/GRUB/grub/*
understand that it can't work
configure this: https://github.com/Antynea/grub-btrfs/blob/3433754c69220b0379e205c722b849952d5467de/config#L84
# Location of the folder containing the "grub.cfg" file.
# Use by grub-btrfs to save the file "grub-btrfs.cfg".
# Might be grub2 on some systems.
# For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
# Default: "/boot/grub"
#GRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"
But the default is /boot/grub, and this is where my binded mount ends up anyways. Note that because I have a binded mount, I have the grub-btrfs.cfg in both /efi/EFI/GRUB/grub, but more importantly also /boot/grub, so I am not sure why it should not work, assuming ${prefix} is pulled from the "Default:" field?
Boot in Grub
Open a terminal in Grub
echo $prefix
echo $root
And uses ls + return of command abovecommand to find where grub.cfg and grub-btrfs.cfg is located in Grub terminal
assuming ${prefix} is pulled from the "Default:" field?
Don't worry about the variable, it belongs to Grub.
echo $prefix is /@root/boot/grub, the other one just prints hd0,gpt2.
Although it does not make sense, I pointed to /efi/EFI/GRUB/grub, instead of /boot/grub where it is linked to, of course it did not work, the initialization goes well and snapshots are recognized, but still no boot menu option.
I did the changes in /etc/default/grub-btrfs/config.
Okay,
Do you navigate in the Grub terminal
and find the location of the grub.cfg and grub-btrfs.cfg files ?
What command did you use to install Grub ?
# grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB
refer to Grub on Arch Linux Wiki
I can navigate between Arch and the recovery option. As I already mentioned, I have bind mounted /boot, this means that I have grub.cfg and grub-btrfs.cfg in two places, in /efi/EFI/GRUB/boot/* and where it gets in a way symlinked to /boot. Here is more info on this.
I used:
grub-install --target=x86_64-efi --efi-directory=/efi/EFI/GRUB --bootloader-id=GRUB
Did you find a solution to the problem/bug?
No universal solution at the moment.
For your case, you just have to modify this line in grub.cfg:
configfile "${prefix}/grub-btrfs.cfg"
By the exact path you found in the Grub Terminal, as I have already asked you twice, and you didn't tell me.
11 Days ago Navigate in the Grub terminal and find the location of the grub.cfg and grub-btrfs.cfg files.
should look like this:
configfile "(hd0,gpt2)/boot/grub/grub-btrfs.cfg"
It's up to you to find the exact path, I've already told you how.
I have configured the grub.cfg file, however:
Navigate in the Grub terminal and find the location of the grub.cfg and grub-btrfs.cfg files
In the grub terminal, the grub.cfg file is located at /@root/boot/grub/grub.cfg, but ls /@root/boot/grub/ does not list grub-btrfs.cfg, grub-btrfs.cfg cannot be found anywhere I have checked, the interesting this is;
While booted in the machine, I have both the grub.cfg and grub-btrfs.cfg files in /boot/grub/. I also have them in the original directory too, where the linking is done from, which is in /efi/EFI/GRUB.
You found something interesting.
it would be wise to know why, grub-btrfs.cfg file isn't saved in the same location of grub.cfg.
Maybe... because of your custom setup...
I remember that $prefix = /@root/boot/grub
configfile "${prefix}/grub-btrfs.cfg" is correct, however the file doesn't exist...
When we invoke the following command:
grub-mkconfig -o /boot/grub/grub.cfg
grub-btrfs.cfg is supposed to be created in the same location.
I need to replicate your setup to understand more ...
https://www.gnu.org/software/grub/manual/grub/html_node/prefix.html
15.1.36 prefix
The location of the ‘/boot/grub’ directory as an absolute file name (see File name syntax). This is normally set by GRUB at startup based on information provided by grub-install. GRUB modules are dynamically loaded from this directory, so it must be set correctly in order for many parts of GRUB to work.
Generally speaking, only after GRUB2 is initialized and the prefix variable is correctly set, other modules of GRUB2 will be loaded.
/@root/boot/grubdoes not seem to be the correct value of the prefix variable.
This may be due to the wrong installation of GRUB2.
Or, it may be because a certain version of GRUB2 has related bugs, and OP happens to be using this version of GRUB2.
@matru How about installing GRUB2 using the sudo grub-install command?
The Arch wiki article that mentions using bind mounts for ESP and /boot was NOT intended to be used with GRUB. Don't do this. You can mount your ESP to /efi and your GRUB install should be using the defaults in /boot/grub. Not sure what problem you're trying to solve unless you're following the notion that you need your kernel and initram to be in the ESP due to using LUKS2, which is no longer the case since Grub v2.06 - even then, you can just use LUKSv1. There is even a LUKSv2 to LUKSv1 conversion process if you want to go that route, but configuring the PBKDF2 should be the easiest option.