Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 567170 - sys-boot/systemrescuecd-x86-grub ignores btrfs subvolumes when generating grub configuration
Summary: sys-boot/systemrescuecd-x86-grub ignores btrfs subvolumes when generating gru...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michael Lange
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-30 17:20 UTC by Michael Jones
Modified: 2019-10-18 06:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Jones 2015-11-30 17:20:05 UTC
When running grub2-mkconfig, you get something like this:

	menuentry "SystemRescueCD (64bit standard)" --class rescue {
		insmod part_gpt
		insmod btrfs
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  1650c4f0-d078-4e8d-af0d-181c86a5f3df
		else
		  search --no-floppy --fs-uuid --set=root 1650c4f0-d078-4e8d-af0d-181c86a5f3df
		fi
		set isofile=/usr/share/systemrescuecd/systemrescuecd-x86-newest.iso
		loopback loop ${isofile}
		linux (loop)/isolinux/rescue64  isoloop=${isofile}
		initrd (loop)/isolinux/initram.igz
	}




However, on my machine, I have my root volume on btrfs, but in a subvolume (namely, the subvolume "@").


So the line

		loopback loop ${isofile}

Would really need to read something like:

		loopback loop /@${isofile}

or
		loopback loop (hd0,gpt2)/@${isofile}


to properly boot the iso.





Without having dug into it too much, it seems that in

/etc/grub.d/10_linux

The code snippet

case x"$GRUB_FS" in
    xbtrfs)
        rootsubvol="`make_system_path_relative_to_its_root /`"
        rootsubvol="${rootsubvol#/}"
        if [ "x${rootsubvol}" != x ]; then
            GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
        fi;;
    xzfs)
        rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
        bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
        LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
        ;;
esac


provides some hints at how to resolve this.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-10-18 06:59:30 UTC
Package removed.