内核升级后出现“dkms:警告:缺少 Linux 标头”

内核升级后出现“dkms:警告:缺少 Linux 标头”

我最近跑了:

sudo apt-get update && sudo apt-get dist-upgrade

这样就安装了最新版本的 Linux 内核 15.10。但是,我运行了:

sudo apt-get autoremove

我得到了这个输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  linux-headers-4.2.0-16 linux-headers-4.2.0-16-generic
  linux-image-4.2.0-16-generic linux-image-extra-4.2.0-16-generic
0 to upgrade, 0 to newly install, 4 to remove and 0 not to upgrade.
After this operation, 287 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 266582 files and directories currently installed.)
Removing linux-headers-4.2.0-16-generic (4.2.0-16.19) ...
Removing linux-headers-4.2.0-16 (4.2.0-16.19) ...
Removing linux-image-extra-4.2.0-16-generic (4.2.0-16.19) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
dkms: WARNING: Linux headers are missing, which may explain the above failures.
      please install the linux-headers-4.2.0-16-generic package to fix this.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-16-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.2.0-17-generic
Found initrd image: /boot/initrd.img-4.2.0-17-generic
Found linux image: /boot/vmlinuz-4.2.0-16-generic
Found initrd image: /boot/initrd.img-4.2.0-16-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Removing linux-image-4.2.0-16-generic (4.2.0-16.19) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
update-initramfs: Deleting /boot/initrd.img-4.2.0-16-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.2.0-16-generic /boot/vmlinuz-4.2.0-16-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.2.0-17-generic
Found initrd image: /boot/initrd.img-4.2.0-17-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old 
 you may need to re-run your boot loader[grub]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old 
 you may need to re-run your boot loader[grub]

其中这个错误最为突出(我想我在安装过程中也可能遇到了这个错误,但我真的不记得了):

dkms: WARNING: Linux headers are missing, which may explain the above failures.
      please install the linux-headers-4.2.0-16-generic package to fix this.

我已经看过了这个问题已经没有帮助了。那么这个错误到底是什么意思,我该怎么办?


操作系统信息:

LSB Version:    core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily
Flavour: GNOME
GNOME Version: 3.18

答案1

内核更新4.2.0-17-generic不包含标头。这些标头稍后会删除。autoremove从上一个内核中删除了较旧的标头,4.2.0-16-generic而脚本不应该这样做。

输入以下命令重新安装旧内核头:

sudo apt-get install linux-headers-4.2.0-16-generic

希望这可以帮助!

答案2

linux-headers-generic”包可能未安装。

您可以使用以下方式检查

apt-cache policy linux-headers-generic

并使用修复它

sudo apt-get install linux-headers-generic

相关内容