如何安装当前版本的 `linux-headers-generic` 包?

如何安装当前版本的 `linux-headers-generic` 包?

我正在尝试安装virtualbox需要编译内核模块的程序。这给了我一个错误信息:

vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    linux-headers-generic linux-headers-4.13.0-31-generic
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
    linux-headers-generic linux-headers-4.13.0-31-generic

它找出linux-headers所需的版本,并从中uname -r返回4.13.0-31-generic。但是该版本的内核头文件没有安装候选。

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

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package linux-headers-4.13.0-31-generic is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'linux-headers-4.13.0-31-generic' has no installation candidate

dpkg-query显示已安装旧版本:

 sudo dpkg-query -l "linux-headers*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                           Version                      Architecture                 Description
+++-==============================================-============================-============================-==================================================================================================
un  linux-headers                                  <none>                       <none>                       (no description available)
un  linux-headers-2.6-686                          <none>                       <none>                       (no description available)
un  linux-headers-2.6-amd64                        <none>                       <none>                       (no description available)
un  linux-headers-3.0                              <none>                       <none>                       (no description available)
ii  linux-headers-4.13.0-16                        4.13.0-16.19                 all                          Header files related to Linux kernel version 4.13.0
ii  linux-headers-4.13.0-16-generic                4.13.0-16.19                 amd64                        Linux kernel headers for version 4.13.0 on 64 bit x86 SMP
un  linux-headers-4.13.0-21-generic                <none>                       <none>                       (no description available)
un  linux-headers-4.13.0-25-generic                <none>                       <none>                       (no description available)
un  linux-headers-4.13.0-31-generic                <none>                       <none>                       (no description available)
un  linux-headers-686-pae                          <none>                       <none>                       (no description available)
un  linux-headers-amd64                            <none>                       <none>                       (no description available)
ii  linux-headers-generic                          4.13.0.16.17                 amd64                        Generic Linux kernel headers
un  linux-headers-generic-pae                      <none>                       <none>                       (no description available)

我如何安装该linux-headers-4.13.0-31-generic软件包?

[编辑]:手动安装来自https://packages.ubuntu.com/xenial-updates/linux-headers-4.13.0-31作品!

相关内容