Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2014 11:57:41 GMT
From:      Borodin Oleg <onborodin@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/185741: Resolve problem for install Grub2 on UFS
Message-ID:  <201401131157.s0DBvfHY084054@oldred.freebsd.org>
Resent-Message-ID: <201401131200.s0DC00xn010061@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         185741
>Category:       ports
>Synopsis:       Resolve problem for install Grub2 on UFS
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 13 12:00:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Borodin Oleg
>Release:        9-stable
>Organization:
>Environment:
FreeBSD zee.home 9.2-STABLE FreeBSD 9.2-STABLE #26 r260550: Sun Jan 12 01:24:17 FET 2014     root@zee.home:/usr/obj/data/stable9/sys/ZEE2  i386

>Description:
Grub2 grub-install don't autocreate correct /boot/grub/some_target/core.img for freebsd ufs filesystem on mbr+bsdslice

Without part_msdos & part_bsd grub can not read /boot/grub/grub.conf







>How-To-Repeat:

>Fix:
Fast resolve patch include in the pr + Option for force use of filesystem label


Patch attached with submission follows:

--- ./util/grub-install.in.orig	2012-06-27 00:31:03.000000000 +0300
+++ ./util/grub-install.in	2013-12-25 20:28:58.000000000 +0300
@@ -107,6 +107,8 @@
     print_option_help "--recheck" "$(gettext "delete device map if it already exists")"
     print_option_help "--force" "$(gettext "install even if problems are detected")"
     print_option_help "--force-file-id" "$(gettext "use identifier file even if UUID is available")"
+    print_option_help "--force-label" "$(gettext "use filesystem label even if UUID is available")"
+
     print_option_help "--disk-module=$(gettext "MODULE")" "$(gettext "disk module to use (biosdisk or native). This option is only available on BIOS target.")"
     print_option_help "--no-nvram" "$(gettext "don't update the \`boot-device' NVRAM variable. This option is only available on IEEE1275 targets.")"
     print_option_help  "--removable" "$(gettext "the installation device is removable. This option is only available on EFI.")"
@@ -159,6 +161,9 @@
     --force-file-id)
 	force_file_id=y ;;
 
+    --force-label)
+	force_fs_label=y ;;
+
 # Accept and ignore for compatibility
     --font)
         shift;;
@@ -585,7 +590,7 @@
 partmap_module=
 for x in `echo "${grub_device}" | xargs "$grub_probe" --device-map="${device_map}" --target=partmap --device 2> /dev/null`; do
    case "$x" in
-       netbsd | openbsd) 
+       netbsd | openbsd | freebsd )
 	   partmap_module="$partmap_module part_bsd";;
        "") ;;
        *)
@@ -593,6 +598,11 @@
    esac
 done
 
+case `uname -o` in 
+    FreeBSD)
+	    partmap_module="$partmap_module part_msdos part_bsd";;
+esac
+
 # Device abstraction module, if any (lvm, raid).
 devabstraction_module="`echo "${grub_device}" | xargs "$grub_probe" --device-map="${device_map}" --target=abstraction --device`"
 
@@ -668,16 +678,28 @@
 	    echo 1>&2
 	    hints=
         fi
+
+	if [ x"$force_fs_label" = xy ]; then
+            fs_label="`echo "${grub_device}" | xargs "$grub_probe" --device-map="${device_map}" --target=fs_label --device`"
+	fi
+
+	if [ x"$fs_label" != x ]; then
+            echo "search.fs_label ${fs_label} root $hints " >> "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/load.cfg"
+	    search_module=search_label
+	else
+
 	if [ x"$uuid" != x ]; then
             echo "search.fs_uuid ${uuid} root $hints " >> "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/load.cfg"
 	    search_module=search_fs_uuid
 	else
 	    mkdir -p "${grubdir}/uuid"
-	    file="`mktemp "${grubdir}/uuid/XXXXXXXXXXXXXXXXXXXXXXXXX"`"
+	    file="`mktemp "${grubdir}/uuid/XXXX-XXXX-XXXX"`"
 	    relfile="`${grub_mkrelpath} "$file"`"
             echo "search.file '${relfile}' root $hints " >> "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/load.cfg"
 	    search_module=search_fs_file
 	fi
+	fi
+
 	echo 'set prefix=($root)'"$(echo "${relative_grubdir}" | sed "s,\\([ \"'\\\\]\\),\\\\\\1,g")" >> "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/load.cfg"
 	config_opt_file="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/load.cfg"
         modules="$modules $search_module"


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401131157.s0DBvfHY084054>