我正在尝试在虚拟机 VirtualBox 上升级我的 Ubuntu 16.04。但是当运行以下代码时:
sudo apt-get upgrade
我收到以下错误消息:
(Reading database ... 248247 files and directories currently
installed.) Removing linux-image-extra-4.4.0-109-generic
(4.4.0-109.132) ... run-parts: executing
/etc/kernel/postinst.d/apt-auto-removal 4.4.0-109-generic
/boot/vmlinuz-4.4.0-109-generic run-parts: executing
/etc/kernel/postinst.d/initramfs-tools 4.4.0-109-generic
/boot/vmlinuz-4.4.0-109-generic update-initramfs: Generating
/boot/initrd.img-4.4.0-109-generic run-parts: executing
/etc/kernel/postinst.d/pm-utils 4.4.0-109-generic
/boot/vmlinuz-4.4.0-109-generic run-parts: executing
/etc/kernel/postinst.d/unattended-upgrades 4.4.0-109-generic
/boot/vmlinuz-4.4.0-109-generic run-parts: executing
/etc/kernel/postinst.d/update-notifier 4.4.0-109-generic
/boot/vmlinuz-4.4.0-109-generic run-parts: executing
/etc/kernel/postinst.d/vboxadd 4.4.0-109-generic
/boot/vmlinuz-4.4.0-109-generic run-parts: failed to exec
/etc/kernel/postinst.d/vboxadd: Exec format error run-parts:
/etc/kernel/postinst.d/vboxadd exited with return code 1 dpkg: error
processing package linux-image-extra-4.4.0-109-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-109-generic E: Sub-process /usr/bin/dpkg
returned an error code (1)
我不知道如何修复 109 个文件的配置文件。但这是输出uname -r
:
4.4.0-116-generic
以下是运行时可用版本的完整列表dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)
ri linux-image-4.4.0-109-generic 4.4.0-109.132
amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-112-generic 4.4.0-112.135
amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
我似乎无法在此网站上找到解决方案,因为我错误地应用了解决方案,导致问题变得更加严重。非常感谢您帮助我修复机器。
答案1
根据这篇文章(Apt 无法删除部分安装的内核,也无法安装任何其他软件包),
我创建了状态文件的备份,以防出现问题:
sudo cp /var/lib/dpkg/status /var/lib/dpkg/status.backup
我打开
/var/lib/dpkg/status
并gedit
搜索并删除了损坏包的引用。以下是验证此类包的代码:(状态会告诉您它们是否真的损坏了):dpkg --status linux-image-4.4.0-109-generic
dpkg --status linux-image-extra-4.4.0-109-generic
我跑去
sudo apt-get update
确保sudo apt-get upgrade
问题已得到解决。