Windows 10和Ubuntu 14.04的Grub菜单

我已经成功安装并运行了Ubuntu 14.04和Windows 10。 但是,我无法正确显示grub菜单,并且我多次尝试使用启动修复。 除了grub之外,我还通过Windows 10进行了启动修复。

Ubuntu在我的系统上没有检测到Windows 10,但它仍然在启动菜单中列出了Windows Recovery Environment(两次),如果我选择其中一个,那么两者都启动到Windows 10就好了。

为什么有两个相同的条目执行和标准启动到Windows 10,但说它是恢复? 我怎样才能摆脱这些条目并只是输入一个“Windows 10”的条目?

复制以下条目:

sudo cp -a /boot/grub/grub.cfg /boot/grub/grub.cfg.backup gedit /boot/grub/grub.cfg 

将Windows启动节复制到并编辑为只包含所需的条目/描述:

 gksudo gedit /etc/grub.d/40_custom 

然后做:

 sudo update-grub 

一旦您的手动条目工作,通过将此行添加到/ etc / default / grub配置文件来关闭os-prober以使grub自动添加条目。 如果添加另一个系统并希望它找到它,您可以再次打开false。

 gksudo gedit /etc/default/grub GRUB_DISABLE_OS_PROBER=true sudo update-grub 

https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen

我修改了grub“os-prober”脚本,允许用户定义的名称替换菜单项。 首先,在/etc/grub.d/30_os-prober中找到以下代码:

 if [ -z "${LONGNAME}" ] ; then LONGNAME="${LABEL}" fi 

在该代码之后,添加以下内容:

 # Begin patch if [ "x${GRUB_OS_PROBER_RENAME_LIST}" != "x" ]; then for RENAME in ${GRUB_OS_PROBER_RENAME_LIST} ; do SRCNAME="`echo ${RENAME} | cut -d ':' -f 1 | tr '^' ' '`" DSTNAME="`echo ${RENAME} | cut -d ':' -f 2 | tr '^' ' '`" if [ "${LONGNAME}" = "${SRCNAME}" ]; then LONGNAME="${DSTNAME}" echo "Renamed '${SRCNAME}' to '${DSTNAME}' by user request." >&2 fi done fi # End patch 

然后,在/ etc / default / grub中,添加要使用的重命名规则。 这可以在文件中的任何位置:

 # Rename list for OS's detected by os-prober. This is a space-separated # list of rename mappings. A rename mapping is a colon-separated pair # of strings, where each string has its spaces converted to ^ characters. # The first string is the name of the OS reported by os-prober, and the # second string is the replacement used by update-grub. This variable # requires a change to /etc/grub.d/30_os-prober. export GRUB_OS_PROBER_RENAME_LIST="Windows^Recovery^Environment^(loader):Windows^10" 

最后,更新你的grub:

 sudo update-grub 

如果它正常工作,update-grub输出将告诉你重命名的内容,你的启动菜单也应该更新。

为了摆脱额外的Windows菜单条目,我在/ etc / default / grub中使用了GRUB_OS_PROBER_SKIP_LISTfunction。

这取决于你做了什么样的分区。 首先运行sudo update-grub 。 如果这不起作用,您可以编辑grub.cfg文件,使其只有一个名为“Windows 10”的窗口或任何您想要的窗口,但不删除任何Ubuntu条目。

 sudo gedit /boot/grub/grub.cfg 

小心! 在做任何事之前阅读在线教程。