On Fri, 11 Jan 2013 12:34:20 -0500 Gene Czarcinski <g...@czarc.net> wrote:
This was found on Fedora 18.
Both os-prober and linux-boot-prober do not support root, boot, or
root+boot on a btrfs subvolume.
The attached patch corrects that. It supplies information such that
grub2, with an additional small patch, will not handle btrfs in
30_os-prober.
I have attached two additional small patches for os-prober which
suppresses debug messages until needed and to fix os-prober to handle
/boot on a separate logical volume.
Gene
Hi Gene,
This does detect Linux systems in btrfs sub-volumes, but not when the
system is installed in a top level volume.
Mageia does not install to a sub-volume by default and is therefore not
detected.
I have used the attached patch to overcome this limitation and would
appreciate if you would review it.
Thanks,
Barry
diff -ur os-prober-o/os-probes/common/50mounted-tests os-prober/os-probes/common/50mounted-tests
--- os-prober-o/os-probes/common/50mounted-tests 2014-11-15 00:32:15.714509460 +0000
+++ os-prober/os-probes/common/50mounted-tests 2014-11-15 23:33:01.374327628 +0000
@@ -71,11 +71,39 @@
# note that the btrfs volume must not be mounted ro
if mount -t btrfs -U "$UUID" "$tmpmnt" 2>/dev/null; then
debug "btrfs volume $UUID mounted"
+ debug "begin btrfs processing for $UUID"
+ found=
+ mounted=
+ mpoint="$(grep btrfs /proc/self/mountinfo | grep "$partition " | cut -d ' ' -f 5)"
+ if [ -n "$mpoint" ]; then
+ if [ "x$mpoint" = "x/" ]; then
+ continue # this is the root for the running system
+ fi
+ mounted=1
+ else
+ # again, do not mount btrfs ro
+ mount -t btrfs -o subvol="$subvol" -U "$UUID" "$tmpmnt"
+ mpoint="$tmpmnt"
+ fi
else
warn "cannot mount btrfs volume $UUID, exiting"
rmdir "$tmpmnt" || true
exit 1
fi
+ test="/usr/lib/os-probes/mounted/90linux-distro"
+ if [ -f "$test" ] && [ -x "$test" ]; then
+ debug "running subtest $test"
+ if "$test" "$partition" "$mpoint" btrfs "UUID=$UUID"; then
+ debug "os found by subtest $test on $partition"
+ found=1
+ fi
+ fi
+ if [ -z "$mounted" ]; then
+ if ! umount "$tmpmnt"; then
+ warn "failed to umount $tmpmnt"
+ fi
+ fi
+
# besides regular subvols, get ro and snapshot so thet can be excluded
subvols=$(btrfs subvolume list "$tmpmnt" | cut -d ' ' -f 9)
rosubvols=$(btrfs subvolume list -r "$tmpmnt" | cut -d ' ' -f 9)
@@ -87,8 +115,7 @@
fi
if [ -z "$subvols" ]; then
debug "no subvols found on btrfs volume $UUID"
- exit 1
- fi
+ else
found=
for subvol in $subvols; do
debug "begin btrfs processing for $UUID subvol=$subvol"
@@ -130,6 +157,7 @@
else
exit 1
fi
+ fi
fi
if type grub-mount >/dev/null 2>&1 && \