14.04 升级触发 grub-pc 故障

14.04 升级触发 grub-pc 故障

我的问题始于从 Ubuntu 12.04 LTS 升级到 14.02 LTS。在此期间,我收到了几条有关无法删除旧内核的错误消息。

第一次启动 14.02 时,我通过运行检查一切正常sudo apt-get autoremove,但出现了相同的错误。

按照网上的指南,我运行了以下命令:

sudo apt-get purge grub-common
sudo apt-get install grub-pc

第一个操作成功,从我的电脑中删除了 grub。第二个操作失败,并显示以下内容:

Creating config file /etc/default/grub with new version
Installing for i386-pc platform.
Installation finished. No error reported.
Generating grub configuration file ...
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.13.0-54-generic
Found initrd image: /boot/initrd.img-3.13.0-54-generic
Found linux image: /boot/vmlinuz-3.13.0-44-generic
Found initrd image: /boot/initrd.img-3.13.0-44-generic
Found linux image: /boot/vmlinuz-3.13.0-40-generic
Found initrd image: /boot/initrd.img-3.13.0-40-generic
Adding boot menu entry for EFI firmware configuration
cat: /video.lst: No such file or directory
/usr/sbin/grub-probe: error: failed to get canonical path of `'.
No path or device is specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.
dpkg: error processing package grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 64
Errors were encountered while processing:
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试过很多方法来解决此问题,其中大多数都有记录这里。我在删除之前创建了一个 LiveCD grub-common,因此我可以访问我的旧分区并可以mount进入chroot它。

但是运行时update-grub出现同样的错误,dpkg --configure -a如果没有发生这种情况,我也无法运行。

我曾经boot-repair得到启动摘要对于我的机器,它是一台 2 HDD 设备,在第一个驱动器上具有双启动功能 ( /dev/sda)。Windows开启/dev/sda1并且我的Ubuntu分区 (也启动) 开启/dev/sda2

请帮我修复这个问题,我保证以后不会再碰我的 Ubuntu 安装。:-)

答案1

“优雅地解决”我的问题通过使用以下:

sudo apt-get purge grub-pc grub-common
sudo rm -r /etc/grub.d/
sudo apt-get install grub-pc grub-common
sudo grub-install /dev/sda
sudo update-grub

删除/etc/grub.d/目录似乎已经摆脱了12.04我潜伏的所有文件,允许14.04继续安装 grub!

当然,我还是建议你先备份一下你要删除的内容。

答案2

这些 grub 错误已经持续了很多年,甚至现在在 20.04 上...只需运行这些

sudo apt-get update
sudo apt-get --fix-broken install -y
sudo apt-get -f install -y 
sudo  apt-get -o Dpkg::Options::="--force-confnew" -yy dist-upgrade -yq
sudo apt-get autoremove -yq
sudo apt-get autoclean -y

如果上面的输出显示有一些爆发,那么只需重新运行上述所有内容,您就可以开始了

答案3

使用 Boot-Repair 最简单的方法是创建一个包含该工具的磁盘(例如 Boot-Repair-Disk、自动启动 Boot-Repair 的磁盘),然后在其上启动。

我个人更喜欢使用启动修复磁盘 ISO

相关内容