grub-btrfs
grub-btrfs copied to clipboard
gentoo:41_snapshot-btrfs not included in grub.cfg
sorry, having a few issues with github, anyway.
i have used grub-btrfs on arch before, without any issue, however with my new gentoo install 41_snapshots-btrfs is not being included in grub.cfg when running grub-mkconfig -o /boot/grub/grub.cfg
here is the output of grub-mkcofig:
`Generating grub configuration file ...
DO NOT EDIT THIS FILE
It is automatically generated by grub-mkconfig using templates
from /etc/grub.d and settings from /etc/default/grub
BEGIN /etc/grub.d/00_header
if [ -s $prefix/grubenv ]; then load_env fi if [ "${next_entry}" ] ; then set default="${next_entry}" set next_entry= save_env next_entry set boot_once=true else set default="0" fi
if [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id" else menuentry_id_option="" fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi
function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi }
function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi }
if loadfont unicode ; then set gfxmode=auto load_video insmod gfxterm set locale_dir=$prefix/locale set lang=en_GB insmod gettext fi terminal_output gfxterm if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=5
Fallback normal timeout code in case the timeout_style feature is
unavailable.
else set timeout=5 fi
END /etc/grub.d/00_header
BEGIN /etc/grub.d/10_linux
Found linux image: /boot/vmlinuz-5.15.32-gentoo-r1 Found initrd image: /boot/initramfs-5.15.32-gentoo-r1.img menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1' { load_video insmod gzio insmod part_gpt insmod fat set root='hd2,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt1 --hint-efi=hd2,gpt1 --hint-baremetal=ahci2,gpt1 EEE8-DF1A else search --no-floppy --fs-uuid --set=root EEE8-DF1A fi echo 'Loading Linux 5.15.32-gentoo-r1 ...' linux /vmlinuz-5.15.32-gentoo-r1 root=/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1 ro rootflags=subvol=@/0/snapshot root=UUID=c83a595d-7869-44f7-ba0b-0be0c6840b2e rd.luks.uuid=c05ef81e-7717-45d5-b2d1-eacc6b9526a1 echo 'Loading initial ramdisk ...' initrd /initramfs-5.15.32-gentoo-r1.img } submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1' { menuentry 'Gentoo GNU/Linux, with Linux 5.15.32-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.32-gentoo-r1-advanced-/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1' { load_video insmod gzio insmod part_gpt insmod fat set root='hd2,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt1 --hint-efi=hd2,gpt1 --hint-baremetal=ahci2,gpt1 EEE8-DF1A else search --no-floppy --fs-uuid --set=root EEE8-DF1A fi echo 'Loading Linux 5.15.32-gentoo-r1 ...' linux /vmlinuz-5.15.32-gentoo-r1 root=/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1 ro rootflags=subvol=@/0/snapshot root=UUID=c83a595d-7869-44f7-ba0b-0be0c6840b2e rd.luks.uuid=c05ef81e-7717-45d5-b2d1-eacc6b9526a1 echo 'Loading initial ramdisk ...' initrd /initramfs-5.15.32-gentoo-r1.img } menuentry 'Gentoo GNU/Linux, with Linux 5.15.32-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.32-gentoo-r1-recovery-/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1' { load_video insmod gzio insmod part_gpt insmod fat set root='hd2,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt1 --hint-efi=hd2,gpt1 --hint-baremetal=ahci2,gpt1 EEE8-DF1A else search --no-floppy --fs-uuid --set=root EEE8-DF1A fi echo 'Loading Linux 5.15.32-gentoo-r1 ...' linux /vmlinuz-5.15.32-gentoo-r1 root=/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1 ro single rootflags=subvol=@/0/snapshot echo 'Loading initial ramdisk ...' initrd /initramfs-5.15.32-gentoo-r1.img } Found linux image: /boot/vmlinuz-5.15.32-gentoo-dist Found initrd image: /boot/initramfs-5.15.32-gentoo-dist.img menuentry 'Gentoo GNU/Linux, with Linux 5.15.32-gentoo-dist' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.32-gentoo-dist-advanced-/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1' { load_video if [ "x$grub_platform" = xefi ]; then set gfxpayload=keep fi insmod gzio insmod part_gpt insmod fat set root='hd2,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt1 --hint-efi=hd2,gpt1 --hint-baremetal=ahci2,gpt1 EEE8-DF1A else search --no-floppy --fs-uuid --set=root EEE8-DF1A fi echo 'Loading Linux 5.15.32-gentoo-dist ...' linux /vmlinuz-5.15.32-gentoo-dist root=/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1 ro rootflags=subvol=@/0/snapshot root=UUID=c83a595d-7869-44f7-ba0b-0be0c6840b2e rd.luks.uuid=c05ef81e-7717-45d5-b2d1-eacc6b9526a1 echo 'Loading initial ramdisk ...' initrd /initramfs-5.15.32-gentoo-dist.img } menuentry 'Gentoo GNU/Linux, with Linux 5.15.32-gentoo-dist (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.32-gentoo-dist-recovery-/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1' { load_video if [ "x$grub_platform" = xefi ]; then set gfxpayload=keep fi insmod gzio insmod part_gpt insmod fat set root='hd2,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd2,gpt1 --hint-efi=hd2,gpt1 --hint-baremetal=ahci2,gpt1 EEE8-DF1A else search --no-floppy --fs-uuid --set=root EEE8-DF1A fi echo 'Loading Linux 5.15.32-gentoo-dist ...' linux /vmlinuz-5.15.32-gentoo-dist root=/dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1 ro single rootflags=subvol=@/0/snapshot echo 'Loading initial ramdisk ...' initrd /initramfs-5.15.32-gentoo-dist.img } }
END /etc/grub.d/10_linux
BEGIN /etc/grub.d/20_linux_xen
END /etc/grub.d/20_linux_xen
BEGIN /etc/grub.d/30_os-prober
Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. Found Windows Boot Manager on /dev/sdb1@/efi/Microsoft/Boot/bootmgfw.efi menuentry 'Windows Boot Manager (on /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-efi-022F-B8D4' { insmod part_gpt insmod fat set root='hd1,gpt1' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1 022F-B8D4 else search --no-floppy --fs-uuid --set=root 022F-B8D4 fi chainloader /efi/Microsoft/Boot/bootmgfw.efi }
END /etc/grub.d/30_os-prober
BEGIN /etc/grub.d/30_uefi-firmware
Adding boot menu entry for UEFI Firmware Settings ... menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' { fwsetup }
END /etc/grub.d/30_uefi-firmware
BEGIN /etc/grub.d/40_custom
This file provides an easy way to add custom menu entries. Simply type the
menu entries you want to add after this comment. Be careful not to change
the 'exec tail' line above.
END /etc/grub.d/40_custom
BEGIN /etc/grub.d/41_custom
if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfg elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg fi
END /etc/grub.d/41_custom
BEGIN /etc/grub.d/41_snapshots-btrfs
END /etc/grub.d/41_snapshots-btrfs
done`
My system uses these subvolumes: @ @/0/snapshot @home @root @srv @usr @usr/local @swap @var @var/tmp @var/spool @var/log @home/[user] @/1/snapshot [....]
my boot partition is on a fat32 partition and mounted on /boot
any help is greatly appreciated!
Have you installed grub-btrfs via the ebuild in the GURU or manually? Because the ebuild still uses release 4.10.2 instead of 4.11
i've installed it through GURU, I'll try installing it maually.
no, stay with the version installed by the GURU for now, because I have the same version installed. This way I can help you figuring out whats wrong. I will update the ebuild in the GURU later.
just a quick shot in the dark, what is the output of
emerge -s virtual/awk ?
Can you post the output of running 41_snapshots-btrfs on its own? e.g. by running /etc/grub.d/41_snapshots-btrfs ?
this is the output of awk
`
[ Results for search key : virtual/awk ]
Searching...
- virtual/awk
Latest version available: 1
Latest version installed: 1
Size of files: 0 KiB
Homepage:
Description: Virtual for awk implementation License:
[ Applications found : 1 ] `
when I try to run 41_snapshot-btrfs by itself i dont get any output.
Alright, In in the beginning of 41_snapshots-btrfs there are some conditions, and the script is exited without any prompt why it exited, if those conditions aren't met. I made a PR for this already but this PR is for the current master branch and not for the 4.10.2 or even 4.11 we are using. But it should work for 4.11.
Could you upgrade to 4.11 then use the 41_snapshots-btrfs from this PR: https://github.com/Antynea/grub-btrfs/pull/207/files
It should give you output on why it exited then.
I bumped 4.11 to the guru btw, so we can upgrade conveniently
Hi,
I upgraded to 4.11 and used the 41_snapshots-btrfs from the PR and got the output Root filesystem isn't btrfs, exiting.
could this be because I'm using a luks encrypted partition with btrfs installed within?
Well, did you have the same setup with LUKS on Arch before? I don’t think there is a difference between Gentoo and Arch regarding this.
Sadly I don’t have experience with LUKS in combination with grub-btrfs. Maybe it’s just the detection that doesn’t work, so you could uncomment that line in 41_snapshots-btrfs that detects the root partition type and exits the script.
/edit: I mean this line:
[[ "$root_fs" != "btrfs" ]] && exit 0
Give that a try otherwise we rather wait for Antyneas opinion on that.
so I've commented that out and now i get the output:
Detecting snapshots ...
mount: /tmp/grub-btrfs.4LFgX4STDp: /dev/disk/by-uuid is not a block device.
dmesg(1) may have more information after failed mount system call.
No snapshots found.
If you think an error has occurred , please file a bug report at " https://github.com/Antynea/grub-btrfs "
Unmount /tmp/grub-btrfs.4LFgX4STDp .. Success
I can't find anything in dmesg which would relate to this though.
Now we are getting somewhere here. I think there is something going on with grub-probe, but I can not figure out what exactly.
Mount is trying to mount /dev/disk/by-uuid because it is trying to mount /dev/disk/by-uuid/"$root_uuid" (in line 548) but $root_uuid seems to be empty.
Could you post the output of equery u grub ? If equery does not exist for you, install it with emerge -a gentoolkit.
Also run source /usr/share/grub/grub-mkconfig_lib then echo ${grub_probe} and post the output here.
Also ${grub_probe} --target="fs" / and post the output.
Then do root_device=$(${grub_probe} --target=device /), then echo $root_device and post the output.
Then ${grub_probe} --device ${root_device} --target="fs_uuid" and post the output.
cool, okay i've made a pastebin so this comment doesn't get too crowded i'll link to the different pastes rather than just put the output here.
Here's the output of equery u grub: https://pastebin.com/nKWyjCQi
The output of echo ${grub_probe}: /usr/sbin/grub-probe
The output of ${grub_probe} --target="fs" / :https://pastebin.com/0vkVKd8s
The output of echo $root_device : /dev/mapper/luks-c05ef81e-7717-45d5-b2d1-eacc6b9526a1
The output of ${grub_probe} --device ${root_device} --target="fs_uuid": https://pastebin.com/2AJP4u6p
Also to answer your question from before, yes I had the exact same volume setup that I had in arch, I don't think there are any differences
Could you reemerge grub with USEflag device-mapper? If you are root, you can do this easily with USE="device-mapper" emerge grub.
With sudo instead of root (and to make this permanent for future updates) you have to do it the usual way by editing /etc/portage/package.use
Then check if the outputs of the above commands change.
equery u grub changed from :- - device-mapper : Enable support for device-mapper from sys-fs/lvm2
to
- + device-mapper : Enable support for device-mapper from sys-fs/lvm2
echo ${grub_probe} didnt change
${grub_probe} --target="fs" / I got this:
/usr/sbin/grub-probe: error: disk hostdisk//dev/dm-0' not found.`
echo $root_device didn't change
${grub_probe} --device ${root_device} --target="fs_uuid" i got the same /usr/sbin/grub-probe: error: disk hostdisk//dev/dm-0' not found.`
however when i now run sudo grub-mkconfig -o /boot/grub/grub.cfg it now seems to detect snapshots fine. Im just going to reboot and see if it appears in the grub menu.
Sounds good. I didn’t expect grub to work at all with lvm/ luks and without USEflag device-mapper. I have to figure out how to put that into the ebuild now. If lvm or luks is used require USEflag device-mapper in package grub. Hm.
When I get back I'll try recommenting the btrfs detection section and see if that was contributing to the issue as well.
Thanks for all the help!!
I updated the ebuild already to notice the user about this USEflag of grub after the install. They gonna make it available shortly.
In Gentoo minor things can really ruin your whole day. But thanks to your efforts other fellow Gentooers maybe have it easier, when they stumble upon this.