grub 无法与 lvm 一起使用

grub 无法与 lvm 一起使用

我在 LVM 上有一个带有 windows + ubuntu 的双引导系统:

/dev/sda1 -> efi
/dev/sda2-4 -> windows
/dev/sda5 -> LVM

/dev/vgsys/root -> /
/dev/vgsys/home -> /home

它所在的驱动器开始损坏,所以我最近转移到了新的 SSD。在传输和重新安装一些已损坏的程序(例如 wpasupplicant 和 sed,哈哈)后,系统工作正常,直到我像个白痴一样执行了系统升级并重新启动,尽管看到 grub 吐出了一些我以前从未见过的错误。现在我的系统无法启动,我试图通过系统救援启动驱动器找出原因。

我尝试清除并重新安装 grub,这似乎确实解决了我遇到的一些问题(当然,以丢失一些我没有备份的自定义 grub 配置设置为代价),但每当我运行grub-installupdate-grub收到这些奇怪且可怕的错误时,我无法在网上找到任何记录。我是手工复制的,所以可能不是 100% 准确:

File descriptor 4 (/dev/sda1) leaked on vgs invocation. Parent PID 12201: grub-install
Internal error:  cfg tree element not declared as boolean.
Internal error:  cfg tree element not declared as boolean.
Internal error:  cfg tree element not declared as string.
Internal error:  cfg tree element not declared to allow empty values.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as array.
  Internal error:  cfg tree element not declared as array.
  Internal error:  cfg tree element not declared as array.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as integer.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as array.
  Ignoring invalid activation/mlock_filter entry in config file
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as integer.
  Ignoring too small pv_min_size 0KB, using default 512KB.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as boolean.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared to allow empty values.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as integer.
  Internal error:  cfg tree element not declared as string.
  Internal error:  cfg tree element not declared as array.
  Expecting string in devices/types in config file
  _control_fd: close failed: Bad file descriptor

然后似乎又重复了一次。

我其实以前见过File descriptor 4 (/dev/sda1) leaked on vgs invocation. Parent PID 12201: grub-install,它是据称无害。其他一些错误似乎也与 LVM 相关,pv_min_size所以我猜测这通常是一个 LVM 问题。

我尝试grub-install在使用 efi 和启动分区创建的外部拇指驱动器上执行以下操作:

umount /boot/efi
mv /boot /boot.bad
mkdir /boot
mount /dev/sdb2 /boot
mkdir /boot/efi
mount /dev/sdb1 /boot/efi
grub-install --efi-directory=/boot/efi

实际上没有收到任何错误。但每当我运行时,update-grub我都会再次遇到这些错误。它们来自哪里以及如何解决?

更新:我发现这一页其中包含一些cfg tree element..消息,想知道这意味着什么......

答案1

正如 @psusi 指出的,问题是我的 lvm 二进制文件已损坏。我跑了

apt-cache depends lvm2 | grep Depends | awk '{print $2}' | xargs apt install --reinstall -y
apt install --reinstall -y lvm2

重新安装 lvm2 及其所有依赖项,这解决了我的问题。

相关内容