运行 update-grub 时出现奇怪的错误

运行 update-grub 时出现奇怪的错误

更新 grub 时会出现错误,无论是手动更新还是运行 apt upgrade。输出如下:

{
Generating grub configuration file ...
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
Found linux image: /boot/vmlinuz-4.4.0-36-generic
Found initrd image: /boot/initrd.img-4.4.0-36-generic
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
  Configuration setting "types" invalid. It's not part of any section.
  Configuration setting "types" invalid. It's not part of any section.
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
  Configuration setting "types" invalid. It's not part of any section.
done
}

几个月来我一直看到这个消息,但一切似乎都正常。这是从 14.04 升级而来的 Ubuntu Server 16.04.01,尽管错误在那之前就出现了。

我检查过了/etc/default/grub,没发现什么问题。很想知道原因...

编辑:/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=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=2
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
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"

答案1

您是否曾手动编辑过您的grub.cfg文件?

无论如何,您可能希望grub.cfg通过在终端中输入以下命令来备份当前文件:

sudo mv /boot/grub/grub.cfg /boot/grub/grub.cfg.bak 

然后输入以下命令生成一个新的:

sudo update-grub

如果出现任何问题(但不应该),您可以恢复以前的grub.cfg文件,然后通过输入以下命令再次更新 grub:

sudo mv /boot/grub/grub.cfg.bak /boot/grub/grub.cfg && sudo update-grub

答案2

因此,在清除旧内核并查看 grub 配置文件后,我回到谷歌并找到了一个链接,其中顺便提到了一个类似的错误 -http://www.hpuxtips.es/?q=content/red-hat-openstack-administration-cl210-exam-notes

Configuration setting "snapshot_autoextend_percent" invalid. It's not part of any section.

这使我了解了 vlm。

我发现运行 lvm 命令(例如 pvdisplay)会出现同样的错误(尽管该命令确实有效):

Configuration setting "types" invalid. It's not part of any section.

因此我查看了我的 etc/lvm/lvm.conf 文件,其中唯一带有“类型”的行是:

types = [ "bcache", 16 ]

我已将其注释掉,现在可以运行 update-grub 和 pvdisplay 而不会出现任何错误。

如果有人能解释一下这个设置的作用,如果我需要的话,请告诉我。当然,一切似乎都运行正常。

相关内容