执行内核升级后出现“dkms:警告:Linux 头文件丢失”

6 upgrade gnome package-management apt kernel

我最近跑了:

sudo apt-get update && sudo apt-get dist-upgrade
Run Code Online (Sandbox Code Playgroud)

并且安装了 15.10 的最新版本的 linux 内核。但是,一旦我跑了:

sudo apt-get autoremove
Run Code Online (Sandbox Code Playgroud)

我得到了这个输出:

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]
Run Code Online (Sandbox Code Playgroud)

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

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 Code Online (Sandbox Code Playgroud)

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


操作系统信息:

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
Run Code Online (Sandbox Code Playgroud)

Ter*_*nce 5

4.2.0-17-generic内核更新不包含头文件。那些后来下来。在autoremove移除了最后的内核旧的头4.2.0-16-generic该脚本不应该做的事。

通过键入以下内容重新安装较旧的内核头文件:

sudo apt-get install linux-headers-4.2.0-16-generic
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!