使用标准 ubuntu 更新程序进行更新时出现错误。之后,在发送错误报告后,我将此输入到控制台中。
有没有什么办法可以解决这个问题,还是需要重新安装?
~ sudo apt-get -f install
[sudo] password for gary:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED
linux-image-extra-4.4.0-21-generic
0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade.
8 not fully installed or removed.
After this operation, 162 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 222138 files and directories currently installed.)
Removing linux-image-extra-4.4.0-21-generic (4.4.0-21.37) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-21-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
Error! Your kernel headers for kernel 4.4.0-21-generic cannot be found.
Please install the linux-headers-4.4.0-21-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-21-generic cannot be found.
Please install the linux-headers-4.4.0-21-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
WARNING: missing /lib/modules/4.4.0-21-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-21-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
cp: cannot stat '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf': No such file or directory
E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-21-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-21-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-21-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
运行之前,apt-get install -f
检查内核包的 postinst 脚本是否已完成设置。要执行此操作,请键入:
sudo /var/lib/dpkg/info/linux-image-extra-4.4.0-21-generic.postinst configure
我认为这应该在尝试删除包之前完成 postinst 过程。
答案2
我看到你用
/etc/default/grub: i915.preliminary_hw_support=1:
这是对一些错误的修复(由 AskUbuntu 用户建议),但它也会打乱升级过程。只需从 grub 文件中删除该行,重新启动,就可以了。