Ubuntu 20.04 上的 Virtualbox 内核驱动程序问题(从 16.04 更新)

Ubuntu 20.04 上的 Virtualbox 内核驱动程序问题(从 16.04 更新)

我在 ubuntu 20.04 focal 上安装了 virtualbox(版本 6.1.22 r144080(Qt5.12.8))。安装虚拟盒后,我在启动虚拟机时出现此错误。

Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver is either not loaded or not set up
 correctly. Please try setting it up again by executing
 
 '/sbin/vboxconfig'
  as root.

如果您的系统已启用 EFI 安全启动,您可能还需要对内核模块(vboxdrv、vboxnetflt、vboxnetadp、vboxpci)进行签名,然后才能加载它们。请参阅 Linux 系统的文档以了解更多信息。

其中:suplibOsInit 内容:3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - 未安装支持驱动程序。在 Linux 上,open 返回 ENOENT。

我正在使用此代码来解决问题:

sudo /sbin/vboxconfig

并得到以下输出:

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
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.4.0-104-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.4.0-104-generic

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
`as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.

我有两个操作系统。windows10 和带有 grub 的 ubuntu 20.04。我正在检查 bios 选项,安全机器人已被禁用。还检查了 windows,windows 中的启动选项没有问题。并且没有以 UEFI 样式安装。

我正在尝试安装

linux-headers-generic linux-headers-4.4.0-104-generic

但出现了这个错误:

E: Package 'linux-headers-4.4.0-104-generic' has no installation candidate

我该如何解决这个问题?

输出uname -r

4.4.0-104-generic

输出dpkg -l | egrep linux-'[g|h|i|m]'

 ii  binutils-x86-64-linux-gnu                     2.34-6ubuntu1.1     
 amd64        GNU binary utilities, for x86-64-linux-gnu target ii 
 linux-generic                                 5.4.0.74.77             
 amd64        Complete Generic Linux kernel and headers ii 
 linux-headers-5.4.0-73                        5.4.0-73.82             
 all          Header files related to Linux kernel version 5.4.0 ii 
 linux-headers-5.4.0-73-generic                5.4.0-73.82             
 amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
 ii  linux-headers-5.4.0-74                        5.4.0-74.83         
 all          Header files related to Linux kernel version 5.4.0 ii 
 linux-headers-5.4.0-74-generic                5.4.0-74.83             
 amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
 ii  linux-headers-5.4.0-74-lowlatency             5.4.0-74.83         
 amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
 ii  linux-headers-generic                         5.4.0.74.77         
 amd64        Generic Linux kernel headers ii  linux-headers-lowlatency
 5.4.0.74.77                                                                 amd64        lowlatency Linux kernel headers rc 
 linux-image-4.15.0-143-generic                4.15.0-143.147          
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-101-generic                 4.4.0-101.124           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-103-generic                 4.4.0-103.126           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii
 linux-image-4.4.0-104-generic                 4.4.0-104.127           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-109-generic                 4.4.0-109.132           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-112-generic                 4.4.0-112.135           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-116-generic                 4.4.0-116.140           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-119-generic                 4.4.0-119.143           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-121-generic                 4.4.0-121.145           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-127-generic                 4.4.0-127.153           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-128-generic                 4.4.0-128.154           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-130-generic                 4.4.0-130.156           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-133-generic                 4.4.0-133.159           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-134-generic                 4.4.0-134.160           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-137-generic                 4.4.0-137.163           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-138-generic                 4.4.0-138.164           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-139-generic                 4.4.0-139.165           
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-157-generic                 4.4.0-157.185           
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-169-generic                 4.4.0-169.198           
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-174-generic                 4.4.0-174.204           
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-176-generic                 4.4.0-176.206           
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-179-generic                 4.4.0-179.209           
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-21-generic                  4.4.0-21.37             
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-210-generic                 4.4.0-210.242           
 amd64        Signed kernel image generic rc 
 linux-image-4.4.0-97-generic                  4.4.0-97.120            
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP rc
 linux-image-4.4.0-98-generic                  4.4.0-98.121            
 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP ii
 linux-image-5.4.0-73-generic                  5.4.0-73.82             
 amd64        Signed kernel image generic ii 
 linux-image-5.4.0-74-generic                  5.4.0-74.83             
 amd64        Signed kernel image generic rc 
 linux-image-extra-4.4.0-101-generic           4.4.0-101.124           
 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-103-generic          
 4.4.0-103.126                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP ii  linux-image-extra-4.4.0-104-generic          
 4.4.0-104.127                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-109-generic          
 4.4.0-109.132                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-112-generic          
 4.4.0-112.135                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-116-generic          
 4.4.0-116.140                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-119-generic          
 4.4.0-119.143                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-121-generic          
 4.4.0-121.145                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-127-generic          
 4.4.0-127.153                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-128-generic          
 4.4.0-128.154                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-130-generic          
 4.4.0-130.156                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-133-generic          
 4.4.0-133.159                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-134-generic          
 4.4.0-134.160                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-137-generic          
 4.4.0-137.163                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-138-generic          
 4.4.0-138.164                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-139-generic          
 4.4.0-139.165                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-21-generic            4.4.0-21.37 
 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-97-generic            4.4.0-97.120
 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-image-extra-4.4.0-98-generic            4.4.0-98.121
 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP ii  linux-image-generic                           5.4.0.74.77 
 amd64        Generic Linux kernel image rc 
 linux-modules-4.15.0-143-generic              4.15.0-143.147          
 amd64        Linux kernel extra modules for version 4.15.0 on 64 bit
 x86 SMP rc  linux-modules-4.4.0-157-generic              
 4.4.0-157.185                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-4.4.0-169-generic              
 4.4.0-169.198                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-4.4.0-174-generic              
 4.4.0-174.204                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-4.4.0-176-generic              
 4.4.0-176.206                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-4.4.0-179-generic              
 4.4.0-179.209                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-4.4.0-210-generic              
 4.4.0-210.242                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP ii  linux-modules-5.4.0-73-generic                5.4.0-73.82 
 amd64        Linux kernel extra modules for version 5.4.0 on 64 bit
 x86 SMP ii  linux-modules-5.4.0-74-generic                5.4.0-74.83 
 amd64        Linux kernel extra modules for version 5.4.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.15.0-143-generic       
 4.15.0-143.147                                                              amd64        Linux kernel extra modules for version 4.15.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.4.0-157-generic        
 4.4.0-157.185                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.4.0-169-generic        
 4.4.0-169.198                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.4.0-174-generic        
 4.4.0-174.204                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.4.0-176-generic        
 4.4.0-176.206                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.4.0-179-generic        
 4.4.0-179.209                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP rc  linux-modules-extra-4.4.0-210-generic        
 4.4.0-210.242                                                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit
 x86 SMP ii  linux-modules-extra-5.4.0-73-generic          5.4.0-73.82 
 amd64        Linux kernel extra modules for version 5.4.0 on 64 bit
 x86 SMP ii  linux-modules-extra-5.4.0-74-generic          5.4.0-74.83 
 amd64        Linux kernel extra modules for version 5.4.0 on 64 bit
 x86 SMP

答案1

确保您的系统已完全更新,并且旧的、过时的内核不会妨碍您:

sudo apt update && sudo apt full-upgrade && sudo apt autoremove

如果没有报告错误,则继续安装vboxconfig似乎缺少的内容:

sudo apt install build-essential linux-kernel-headers

最后,此时应该能够正确运行脚本:

sudo /sbin/vboxconfig

相关内容