Ubuntu 升级失败与内核有关吗?

Ubuntu 升级失败与内核有关吗?

我正在运行 ubuntu 服务器版本 10.04 LTS。我今天在服务器上执行了“sudo apt-get upgrade”,但失败了,并显示以下信息:

Setting up linux-image-2.6.32-318-ec2 (2.6.32-318.38) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-318-ec2
Could not find postinst hook script [update-grub].
Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'
dpkg: error processing linux-image-2.6.32-318-ec2 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up linux-image-2.6.32-319-ec2 (2.6.32-319.39) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-319-ec2
Could not find postinst hook script [update-grub].
Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'
dpkg: error processing linux-image-2.6.32-319-ec2 (--configure):
 subprocess installed post-installation script returned error exit status 2
Setting up linux-image-2.6.32-34-server (2.6.32-34.77) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-34-server
Could not find postinst hook script [update-grub].
Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'
dpkg: error processing linux-image-2.6.32-34-server (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-ec2:
 linux-image-ec2 depends on linux-image-2.6.32-319-ec2; however:
  Package linux-image-2.6.32-319-ec2 is not configured yet.
dpkg: error processing linux-image-ec2 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-ec2:
 linux-ec2 depends on linux-image-ec2 (= 2.6.32.319.20); however:
  Package linux-image-ec2 is not configured yet.
dpkg: error processing linux-ec2 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-server:
 linux-image-server depends on linux-image-2.6.32-34-server; however:
  Package linux-image-2.6.32-34-server is not configured yet.
dpkg: error processing linux-image-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              No apport report written because MaxReports is reached already
                                                                                                                            No apport report written because MaxReports is reached already
                                                                                                                                                                                          No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (= 2.6.32.34.40); however:
  Package linux-image-server is not configured yet.
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-2.6.32-318-ec2
 linux-image-2.6.32-319-ec2
 linux-image-2.6.32-34-server
 linux-image-ec2
 linux-ec2
 linux-image-server
 linux-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

知道如何修复这个问题吗?

答案1

关键错误是这样的:

update-initramfs: Generating /boot/initrd.img-2.6.32-318-ec2
Could not find postinst hook script [update-grub].
Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'

所有其他错误都源于此。

dpkg 似乎想要运行 update-grub,但它在你的主机上不可用。在我的主机上,我有

$ which update-grub
/usr/sbin/update-grub
$ dpkg --search /usr/sbin/update-grub
grub-pc: /usr/sbin/update-grub
$ apt-cache policy grub-pc
grub-pc:
  Installed: 1.98+20100804-5ubuntu3.3
  Candidate: 1.98+20100804-5ubuntu3.3
  Version table:
 *** 1.98+20100804-5ubuntu3.3 0
        500 http://us.archive.ubuntu.com/ubuntu/ maverick-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.98+20100804-5ubuntu3 0
        500 http://us.archive.ubuntu.com/ubuntu/ maverick/main amd64 Packages

根据您的硬件,您可能安装了不同的 grub-* 包:

$ apt-file -x search '/usr/sbin/update-grub$'
grub: /usr/sbin/update-grub
grub-coreboot: /usr/sbin/update-grub
grub-efi-amd64: /usr/sbin/update-grub
grub-efi-ia32: /usr/sbin/update-grub
grub-ieee1275: /usr/sbin/update-grub
grub-pc: /usr/sbin/update-grub

您几乎肯定安装了上述软件包之一。使用dpkg --search /usr/sbin/update-grub找出是哪一个,然后apt-get --reinstall install重新安装它。

相关内容