分页: 1 / 1
grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 20:55
由 lightmark
小弟改了grub.b/内的某些文件sudo update-grub之后
就没有了win7启动选项了,现在进不去win7只能在ubuntu9.10下google,到现在还不知道怎么办阿。。。
30_os-proder内容对的啊,还是搜不到win7.。。。
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 21:34
由 tusheng
以前是好的么?30_os-proder内容贴出来看看
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 21:37
由 leeaman
update-grub多几次看看
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 21:49
由 lightmark
tusheng 写了:以前是好的么?30_os-proder内容看看
不知道改了什么。。。以前好的
都update很多次了,就是找不到win7
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 21:51
由 tusheng
我没说清楚,你把30_os-proder内容贴出来看看。
再贴下 sudo fdisk -l的结果
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 22:00
由 lightmark
代码: 全选
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x05f655a3
Device Boot Start End Blocks Id System
/dev/sda1 * 1 4290 34459393 7 HPFS/NTFS
/dev/sda2 4291 30401 209736607+ 5 Extended
/dev/sda5 4291 10818 52436128+ 7 HPFS/NTFS
/dev/sda6 10819 18651 62918541 7 HPFS/NTFS
/dev/sda7 18652 26484 62918541 7 HPFS/NTFS
/dev/sda8 26485 30234 30121843+ 83 Linux
/dev/sda9 30235 30401 1341396 82 Linux swap / Solaris
30_os-proder
代码: 全选
#! /bin/sh -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib
found_other_os=
adjust_timeout () {
if [ "x${found_other_os}" = "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
else
verbose=" --verbose"
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" = "x0" ] ; then
cat <<EOF
if [ \${timeout} != -1 ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep$verbose --interruptible 3 ; then
set timeout=0
fi
fi
fi
EOF
else
cat << EOF
if [ \${timeout} != -1 ]; then
if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
set timeout=0
fi
fi
EOF
fi
fi
fi
}
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
adjust_timeout
exit 0
fi
if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
# missing os-prober and/or linux-boot-prober
adjust_timeout
exit 0
fi
OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
if [ -z "${OSPROBED}" ] ; then
# empty os-prober output, nothing doing
adjust_timeout
exit 0
fi
for OS in ${OSPROBED} ; do
DEVICE="`echo ${OS} | cut -d ':' -f 1`"
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
BOOT="`echo ${OS} | cut -d ':' -f 4`"
if [ -z "${LONGNAME}" ] ; then
LONGNAME="${LABEL}"
fi
echo "Found ${LONGNAME} on ${DEVICE}" >&2
found_other_os=1
case ${BOOT} in
chain)
cat << EOF
menuentry "启动 Windows 7" {
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
case ${LONGNAME} in
Windows\ Vista*|Windows\ 7*)
;;
*)
cat << EOF
drivemap -s (hd0) \${root}
EOF
;;
esac
cat <<EOF
chainloader +1
}
EOF
;;
linux)
LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
for LINUX in ${LINUXPROBED} ; do
LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
if [ -z "${LLABEL}" ] ; then
LLABEL="${LONGNAME}"
fi
cat << EOF
menuentry "${LLABEL}" {
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
cat << EOF
linux ${LKERNEL} ${LPARAMS}
EOF
if [ -n "${LINITRD}" ] ; then
cat << EOF
initrd ${LINITRD}
EOF
fi
cat << EOF
}
EOF
done
;;
macosx)
OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
cat << EOF
menuentry "${LONGNAME} (on ${DEVICE})" {
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
cat << EOF
insmod vbe
do_resume=0
if [ /var/vm/sleepimage -nt10 / ]; then
if xnu_resume /var/vm/sleepimage; then
do_resume=1
fi
fi
if [ \$do_resume == 0 ]; then
xnu_uuid ${OSXUUID} uuid
if [ -f /Extra/DSDT.aml ]; then
acpi -e /Extra/DSDT.aml
fi
xnu_kernel /mach_kernel boot-uuid=\${uuid} rd=*uuid
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
xnu_mkext /System/Library/Extensions.mkext
else
xnu_kextdir /System/Library/Extensions
fi
if [ -f /Extra/Extensions.mkext ]; then
xnu_mkext /Extra/Extensions.mkext
fi
if [ -d /Extra/Extensions ]; then
xnu_kextdir /Extra/Extensions
fi
if [ -f /Extra/devtree.txt ]; then
xnu_devtree /Extra/devtree.txt
fi
if [ -f /Extra/splash.jpg ]; then
insmod jpeg
xnu_splash /Extra/splash.jpg
fi
if [ -f /Extra/splash.png ]; then
insmod png
xnu_splash /Extra/splash.png
fi
if [ -f /Extra/splash.tga ]; then
insmod tga
xnu_splash /Extra/splash.tga
fi
fi
}
EOF
;;
hurd|*)
echo " ${LONGNAME} is not yet supported by grub-mkconfig." >&2
;;
esac
done
adjust_timeout
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 22:00
由 O_O_BOT
irc <fwv> say: 加回去。。。
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 22:02
由 lightmark
O_O_BOT 写了:irc <fwv> say: 加回去。。。

Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 22:38
由 tusheng
好复杂,用正则表达式实现的,汗了
用置顶教程里的置换掉看看,把下面的这个写到40_custom里好了
menuentry "Microsoft Windows XP Professional" {
set root=(hd0,1)
drivemap -s (hd0) $root
chainloader +1
}
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-02 23:19
由 lightmark
tusheng 写了:好复杂,用正则表达式实现的,汗了
用置顶教程里的置换掉看看,把下面的这个写到40_custom里好了
menuentry "Microsoft Windows XP Professional" {
set root=(hd0,1)
drivemap -s (hd0) $root
chainloader +1
}
我现在在重装。。。
Re: grub2启动菜单中的win7启动项不见了怎么办
发表于 : 2010-01-03 13:09
由 lastlingfeng
如果你确定WIN 7安装正确,这么做
sudo update-grub
等待GURB更新 之后应该就好了
有问题可以进 QQ群 56169661