错误!无法找到内核 3.5.0-25-generic 的内核头文件

错误!无法找到内核 3.5.0-25-generic 的内核头文件

我运行 dist-upgrade 但最终出现此错误:

错误!无法找到内核 3.5.0-25-generic 的内核头文件。

请安装 linux-headers-3.5.0-25-generic 包,

或者使用 --kernelsourcedir 选项告诉 DKMS 它位于何处

运行部分:执行 /etc/kernel/postinst.d/initramfs-tools 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic`

我已经安装了这些dkms xserver-xorg xserver-xorg-core

我已经尝试过这些问题

无法在 Ubuntu 12.10 上安装 VirtualBox:找不到内核头

错误:未找到内核头文件。(但它们已就位)但没什么帮助

输出如下:

suhaib@suhaib-sda8:~$ sudo apt-get dist-upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-image-3.5.0-25-generic linux-image-extra-3.5.0-25-generic
The following packages will be upgraded:
  linux-image-generic
1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 39.6 MB of archives.
After this operation, 153 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://ca.archive.ubuntu.com/ubuntu/ quantal-updates/main linux-image-3.5.0-25-generic amd64 3.5.0-25.39 [11.9 MB]
Get:2 http://ca.archive.ubuntu.com/ubuntu/ quantal-updates/main linux-image-extra-3.5.0-25-generic amd64 3.5.0-25.39 [27.7 MB]
Get:3 http://ca.archive.ubuntu.com/ubuntu/ quantal-updates/main linux-image-generic amd64 3.5.0.25.31 [2,442 B]
Fetched 39.6 MB in 13s (2,894 kB/s)                                            
Selecting previously unselected package linux-image-3.5.0-25-generic.
(Reading database ... 142958 files and directories currently installed.)
Unpacking linux-image-3.5.0-25-generic (from .../linux-image-3.5.0-25-generic_3.5.0-25.39_amd64.deb) ...
Done.
Selecting previously unselected package linux-image-extra-3.5.0-25-generic.
Unpacking linux-image-extra-3.5.0-25-generic (from .../linux-image-extra-3.5.0-25-generic_3.5.0-25.39_amd64.deb) ...
Preparing to replace linux-image-generic 3.5.0.17.19 (using .../linux-image-generic_3.5.0.25.31_amd64.deb) ...
Unpacking replacement linux-image-generic ...
Setting up linux-image-3.5.0-25-generic (3.5.0-25.39) ...
Running depmod.
^[[1;3B^[[1;3Bupdate-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
**Error! Your kernel headers for kernel 3.5.0-25-generic cannot be found.
Please install the linux-headers-3.5.0-25-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic**
update-initramfs: Generating /boot/initrd.img-3.5.0-25-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.5.0-25-generic
Found initrd image: /boot/initrd.img-3.5.0-25-generic
Found linux image: /boot/vmlinuz-3.5.0-17-generic
Found initrd image: /boot/initrd.img-3.5.0-17-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Ubuntu 12.10 (12.10) on /dev/sda6
Found Ubuntu 12.04.1 LTS (12.04) on /dev/sda7
done
Setting up linux-image-extra-3.5.0-25-generic (3.5.0-25.39) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
Error! Your kernel headers for kernel 3.5.0-25-generic cannot be found.
Please install the linux-headers-3.5.0-25-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
update-initramfs: Generating /boot/initrd.img-3.5.0-25-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.5.0-25-generic /boot/vmlinuz-3.5.0-25-generic
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.5.0-25-generic
Found initrd image: /boot/initrd.img-3.5.0-25-generic
Found linux image: /boot/vmlinuz-3.5.0-17-generic
Found initrd image: /boot/initrd.img-3.5.0-17-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Ubuntu 12.10 (12.10) on /dev/sda6
Found Ubuntu 12.04.1 LTS (12.04) on /dev/sda7
done
Setting up linux-image-generic (3.5.0.25.31) ...

答案1

尝试这个:

sudo apt-get install linux-headers-$(uname -r)

相关内容