Bug#561626: grub-common: please add feature skip partition(s)
Joan Farrerons
jfarrerons at economistes.cat
Fri Dec 18 20:18:45 UTC 2009
Package: grub-common
Version: 1.98~20091210-1
I think skip partition (don't make entry automatically) may be a useful
feature for grub2:
a) if you have installed a distribution that is not well recognized by
grub2 (i.e. Mandriva): you need (1) prevent its autodetection (to be
exact, prevent 30_os-prober to make an entry) and (2) booting the system
by means of a customized entry in the file
/etc/grub.d/40_custom
b) if you have a partition you don't want to be accessed or booted by
users (i.e. Vista recovery partition): in this case the partition only
needs to be ignored.
I have checked successfully a very simple easy implementation of these
feature on Debian squeeze (package grub-common, version 1.98~20091210-1)
STEP 1)
Add the variable
GRUB_DONT_ AUTODETECT_PART
to the file
/etc/default/grub
This variable must contain the name of the partitions you don't want to
be autodetected.
It's the list of these space-separated names.
The partitions naming is the usual one in linux: hdax, hdbx, sdax,
sdbx...
Example:
GRUB_DONT_AUTODETECT_PART="hda1 hda5"
As you can see, in my case I don't want hda1 and hda5 to be
“autodetected”.
STEP 2)
Export this just created variable in the file /usr/sbin/grub-mkconfig:
export GRUP_DONT_AUTODETECT_PART
STEP 3)
And lastly, you must apply a little patch (divided in 2 parts) to the
file
/etc/grub.d/30_os-prober
--- 30_os-prober_198 2009-12-14 15:05:26.000000000 +0100
+++ 30_os-prober_joan 2009-12-18 17:39:22.000000000 +0100
@@ -43,6 +43,13 @@
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
BOOT="`echo ${OS} | cut -d ':' -f 4`"
+# My patch to prevent making grub entry for some partitions: 1st part
+PARTITIONNAME="`echo ${DEVICE} | cut -c 6- 2> /dev/null`"
+if [ "`echo ${GRUB_DONT_AUTODETECT_PART} | grep -e ${PARTITIONNAME}
2> /dev/null`" ] ; then
+ BOOT="banned"
+fi
+# End of first part of the patch
+
if [ -z "${LONGNAME}" ] ; then
LONGNAME="${LABEL}"
fi
@@ -163,6 +170,11 @@
}
EOF
;;
+# My patch to prevent some partitions being autodetected: 2n part
+ banned)
+ echo " ${DEVICE} has been prevented to make grub entry." >&2
+ ;;
+# End of the 2n part of my patch
hurd)
cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
The first part is intended to detect and ignore the partition, and the
second one to report the user that the partition has been ignored.
The result is:
When you run grub-update:
the partitions included in GRUB_DONT_AUTODETECT_PARTare ignored by
30_os-prober
Thanks in advance.
PD. Please find attached the patch
Joan
Information about the package:
# dpkg --status grub-common
Package: grub-common
Status: install ok installed
Priority: extra
Section: admin
Installed-Size: 3792
Maintainer: GRUB Maintainers <pkg-grub-devel at lists.alioth.debian.org>
Architecture: amd64
Source: grub2
Version: 1.98~20091210-1
Replaces: grub-coreboot (<< 1.97+20091114-1), grub-efi (<< 1.96
+20080831-1), grub-ieee1275 (<< 1.96+20080831-1), grub-linuxbios (<<
1.96+20080831-1), grub-pc (<< 1.97+20091114-1)
Depends: base-files (>= 4.0.1~), dpkg (>= 1.15.4) | install-info | dpkg
(<= 1.14.25), libc6 (>= 2.3), libfreetype6 (>= 2.2.1), zlib1g (>=
1:1.1.4), gettext-base
Recommends: os-prober (>= 1.33)
Suggests: multiboot-doc, grub-emu
Conflicts: grub-doc (<< 0.97-32), grub-legacy-doc (<< 0.97-59), mdadm
(<< 2.6.7-2)
Conffiles:
/etc/grub.d/30_os-prober 64201f929dd5286b6c1ab519a5171305
/etc/grub.d/README be58f42dfe74feb6eeb98c6a843c743f
/etc/grub.d/10_linux ad3c3dad94d50d0801d08041cf326a50
/etc/grub.d/40_custom babe7de352fe18de5a238569cf4b8a11
/etc/grub.d/00_header 3f80b0898913310f59192fa4acff7d1e
Description: GRand Unified Bootloader, version 2 (common files)
This package contains common files shared by the distinct flavours of
GRUB.
Homepage: http://www.gnu.org/software/grub/grub-2.en.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 30_os-prober.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20091218/8b980bbf/attachment.bin>
More information about the Pkg-grub-devel
mailing list