我读过几个以前的问题,但找不到解决方案。我运行命令时,update-grub
它给出了以下输出:
root@Agustin-Ubuntu:/home/agustin# update-grub
Generating grub.cfg ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-40-generic
Found initrd image: /boot/initrd.img-3.5.0-40-generic
Found linux image: /boot/vmlinuz-3.5.0-39-generic
Found initrd image: /boot/initrd.img-3.5.0-39-generic
Found linux image: /boot/vmlinuz-3.5.0-37-generic
Found initrd image: /boot/initrd.img-3.5.0-37-generic
Found linux image: /boot/vmlinuz-3.5.0-36-generic
Found initrd image: /boot/initrd.img-3.5.0-36-generic
Found linux image: /boot/vmlinuz-3.5.0-34-generic
Found initrd image: /boot/initrd.img-3.5.0-34-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found Windows 8 (loader) on /dev/sda1
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-40-generic
Found initrd image: /boot/initrd.img-3.5.0-40-generic
Found linux image: /boot/vmlinuz-3.5.0-39-generic
Found initrd image: /boot/initrd.img-3.5.0-39-generic
Found linux image: /boot/vmlinuz-3.5.0-37-generic
Found initrd image: /boot/initrd.img-3.5.0-37-generic
Found linux image: /boot/vmlinuz-3.5.0-36-generic
Found initrd image: /boot/initrd.img-3.5.0-36-generic
Found linux image: /boot/vmlinuz-3.5.0-34-generic
Found initrd image: /boot/initrd.img-3.5.0-34-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found memtest86+ image: /boot/memtest86+.bin
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-40-generic
Found initrd image: /boot/initrd.img-3.5.0-40-generic
Found linux image: /boot/vmlinuz-3.5.0-39-generic
Found initrd image: /boot/initrd.img-3.5.0-39-generic
Found linux image: /boot/vmlinuz-3.5.0-37-generic
Found initrd image: /boot/initrd.img-3.5.0-37-generic
Found linux image: /boot/vmlinuz-3.5.0-36-generic
Found initrd image: /boot/initrd.img-3.5.0-36-generic
Found linux image: /boot/vmlinuz-3.5.0-34-generic
Found initrd image: /boot/initrd.img-3.5.0-34-generic
Found linux image: /boot/vmlinuz-3.5.0-23-generic
Found initrd image: /boot/initrd.img-3.5.0-23-generic
Found Windows 8 (loader) on /dev/sda1
error: syntax error.
error: Incorrect command.
error: syntax error.
error: Incorrect command.
error: syntax error.
error: line no: 165
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
done
这里的问题是,在更新到 3.5.0-45-generic 版本后,Grub Customizer 没有更新,因此菜单中的条目全都乱了,而且我无法按照我想要的顺序排列它们,因为 Grub Customizer 没有效果,它显示了正确的新条目,但在我启动时它不会修改菜单。
这是我的/etc/default/grub
文件:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT="1"
#GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
GRUB_SAVEDEFAULT="false"
答案1
我刚刚检查了我的/etc/default/grub
,它看起来和你的 pastebin 中的一样,但自从默认安装 Ubuntu 14.04 Trusty Thar 以来,我也收到这个警告。
所以这对我没有帮助。结果仍然一样。我发现 launchpad 上已经有了很大的讨论。看看这里:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1258597
但是此链接上的注释#10
显示了诀窍,如何理清事情。/etc/default/grub
需要在第二行和第三行编辑该文件,如上图 launchpad 链接上的注释 #10 所示:
sudo gedit /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=countdown
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.modeset=1"
GRUB_CMDLINE_LINUX=""
然后做:
sudo update-grub
这样就把事情理顺了...
答案2
Grub Customizer 添加或编辑文件,/etc/default/grub.d
因此您需要修复的文件位于此目录中,这就是为什么您的文件没有任何问题/etc/default/grub
。
此外,错误告诉您检查第 165 行,而您需要检查的文件是/boot/grub/grub.cfg.new
。
因此,转到文件/boot/grub/grub.cfg.new
并向下滚动到第 165 行。这是语法错误所在。在每个代码段的开头,都有一行以 开头,### BEGIN
后面跟着配置文件名。这是包含您需要修复的错误的文件。
看这个详细的例子按用户@donquixote。
答案3
我已经在 pastebin 中保存了一个原始的 /etc/default/grub 文件,以应对这种情况。打开终端并执行
sudo cp /etc/default/grub ~/default-grub.bad
sudo wget "http://pastebin.com/raw.php?i=g3TMZgTP" -o /etc/default/grub
sudo update-grub
查看原始格式的文件这里
附加建议:
您已安装了许多内核。尝试删除旧内核。您可以使用 ubuntu-tweak 或 synaptic 等程序。
答案4
您将几个命令放在了注释掉的一行上,却将最后一个命令分成了两半,放在了下一行的非注释行上,这样就搞砸了您的 /etc/default/grub 文件。“echo Debian`” GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"" 是前一个命令的一部分,必须位于同一行。