升级后的 Ubuntu OpenVZ VPS 上无法配置 GRUB

升级后的 Ubuntu OpenVZ VPS 上无法配置 GRUB

我使用以下命令将 OpenVZ VPS 从较旧的 Ubuntu 版本升级到 12.04LTS do-release-upgrade。从那时起,我的所有apt-get运行看起来都像这样:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up linux-image-3.2.0-35-generic (3.2.0-35.55) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.2.0-35-generic /boot/vmlinuz-3.2.0-35-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-35-generic /boot/vmlinuz-3.2.0-35-generic
update-initramfs: Generating /boot/initrd.img-3.2.0-35-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.2.0-35-generic /boot/vmlinuz-3.2.0-35-generic
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.2.0-35-generic.postinst line 1010.
dpkg: error processing linux-image-3.2.0-35-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-35-generic; however:
  Package linux-image-3.2.0-35-generic is not configured yet.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image:
 linux-image depends on linux-image-generic (= 3.2.0.35.40); however:
  Package linux-image-generic is not configured yet.
dpkg: error processing linux-image (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                      No apport report written because the error message indicates its a followup error from a previous failure.
                                                Errors were encountered while processing:
 linux-image-3.2.0-35-generic
 linux-image-generic
 linux-image
E: Sub-process /usr/bin/dpkg returned an error code (1)

我确信 OpenVZ 环境的某些方面导致了此问题,可能是simfs /以及 中缺少任何磁盘 ( hd_) /dev。但是,尽管我花了几个小时阅读所有我能找到的有关该/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).错误的资料,但我仍然遇到这个问题。

更糟糕的是,我可以从应该是干净的备份中恢复。但我宁愿不这样做,因为这意味着需要进行一些与 BOINC 相关的棘手步骤来与附加项目重新同步。

答案1

我的解决方案是:

~# apt-get remove linux-image linux-image-generic
~# mv /var/lib/dpkg/info/linux-image-3.2.0-35-generic.* /tmp/
~# dpkg --remove --force-remove-reinstreq linux-image-3.2.0-35-generic

最后两个步骤按照“在 Ubuntu/Debian 中手动删除损坏的软件包“。

apt不再抱怨dpkg安装过程中的配置错误,这很好,因为今天我发现apt-get install甚至不再安装任何东西了;错误dpkg在任何安装工作发生之前就中止了该过程。但现在一切都正常了。

相关内容