每次使用 apt 都会出现很多内核错误

每次使用 apt 都会出现很多内核错误

我在 MacBook Pro 上运行 Ubuntu 16.04。每当我尝试执行与包管理相关的任何操作时,都会看到很多奇怪的错误。它们似乎与内核有关。

root@danielhep-Ubuntu:/home/danielhep# sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  linux-image-4.8.0-36-generic linux-image-extra-4.8.0-36-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
9 not fully installed or removed.
After this operation, 234 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 217741 files and directories currently installed.)
Removing linux-image-extra-4.8.0-36-generic (4.8.0-36.36~16.04.1) ...
depmod: FATAL: could not load /boot/System.map-4.8.0-36-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
Error! Your kernel headers for kernel 4.8.0-36-generic cannot be found.
Please install the linux-headers-4.8.0-36-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
update-initramfs: Generating /boot/initrd.img-4.8.0-36-generic
WARNING: missing /lib/modules/4.8.0-36-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.8.0-36-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_sZRs08/lib/modules/4.8.0-36-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_sZRs08/lib/modules/4.8.0-36-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
Generating grub configuration file ...
/usr/sbin/grub-probe: error: failed to get canonical path of `/boot/grub2/DejaVuSansMono.pf2'.
No path or device is specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 64
dpkg: error processing package linux-image-extra-4.8.0-36-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.8.0-36-generic (4.8.0-36.36~16.04.1) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
update-initramfs: Deleting /boot/initrd.img-4.8.0-36-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.8.0-36-generic /boot/vmlinuz-4.8.0-36-generic
Generating grub configuration file ...
/usr/sbin/grub-probe: error: failed to get canonical path of `/boot/grub2/DejaVuSansMono.pf2'.
No path or device is specified.
Usage: grub-probe [OPTION...] [OPTION]... [PATH|DEVICE]
Try 'grub-probe --help' or 'grub-probe --usage' for more information.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 64
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.8.0-36-generic.postrm line 328.
dpkg: error processing package linux-image-4.8.0-36-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-4.8.0-36-generic
 linux-image-4.8.0-36-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

即使我安装完全不相关的软件包,也会遇到这样的问题。

以及 df -i 和 -h:

root@danielhep-Ubuntu:/home/danielhep# df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
udev            2032866    638  2032228    1% /dev
tmpfs           2038163    887  2037276    1% /run
/dev/sda5       2088960 246539  1842421   12% /
tmpfs           2038163    352  2037811    1% /dev/shm
tmpfs           2038163      5  2038158    1% /run/lock
tmpfs           2038163     16  2038147    1% /sys/fs/cgroup
/dev/sda1             0      0        0     - /boot/efi
tmpfs           2038163     31  2038132    1% /run/user/1000
/dev/sda4      21953384 128805 21824579    1% /media/danielhep/BOOTCAMP
root@danielhep-Ubuntu:/home/danielhep# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  9.6M  1.6G   1% /run
/dev/sda5        32G   11G   20G  35% /
tmpfs           7.8G  471M  7.4G   6% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1       197M   40M  157M  21% /boot/efi
tmpfs           1.6G   64K  1.6G   1% /run/user/1000
/dev/sda4        49G   28G   21G  57% /media/danielhep/BOOTCAMP

答案1

我按照此处提供的说明解决了该问题:https://askubuntu.com/a/652077/682591

使用以下软件包:

 linux-image-4.8.0-49-generic
 linux-image-extra-4.8.0-49-generic
 linux-image-generic-hwe-16.04
 linux-generic-hwe-16.04
 linux-signed-image-4.8.0-49-generic
 linux-signed-image-generic-hwe-16.04
 linux-signed-generic-hwe-16.04

相关内容