virtualbox dkms軟件包問題(ubunty 18.04)


0

我最近安裝了virtualbox(修復了dpkg錯誤後),現在每次啟動時都會收到錯誤消息;

~ 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.

If your system has EFI Secure Boot enabled you may also 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.

where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT. ~

~The virtual machine 'Kali-Linux-2020.1-vbox-amd64' has terminated unexpectedly during startup with exit code 1 (0x1).


Result Code: 
NS_ERROR_FAILURE (0x80004005)
Component: 
MachineWrap
Interface: 
IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}
~

i have tried everything here https://superuser.com/questions/1438279/how-to-sign-a-kernel-module-ubuntu-18-04 but it has no affect. when i run this command 

~apt install virtualbox-dkms~ i get ~Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 virtualbox-dkms : Depends: dkms (>= 2.1.0.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.~

ive嘗試手動安裝dkms,它只是向下鑽了一個兔子洞。我當然是在這里以root用戶身份登錄的。我對此非常陌生,如果我第一次不太了解這些內容,對不起。非常感謝您的幫助!

0

I had a similar issue and I'm guessing it is the same root cause for you since we are both on 18.04 Bionic; however I'm using mainline kernel 5.4.21, I don't believe you mentioned what kernel you're using.

My root cause was that 18.04 Bionic defaults gcc to gcc-7 and the latest VBox 6.1 when run with kernels 5.4.x and 5.5.x requires gcc-8 or higher. So when /sbin/vboxconfig is run (whether in a script or manually) it is using the default gcc-7 which fails to include a header in building some of the binaries.

I already had gcc-8 and actually thought I was already using it. However when I ran gcc --version it showed 7.4.0.

I forced gcc-8 as the default using sudo update-alternatives --config gccthen chose gcc-8. Then I ran sudo /sbin/vboxconfig. No errors Then ran VBox and voila! All working again!

So Steps [I don't know what you have so listing here assuming you haven't got most of it, but keeping it high level so you can have fun figuring out the syntax :) ]

  1. Shutdown vbox
  2. install update-alternatives
  3. install gcc-8
  4. setup gcc with update-alternatives and force gcc-8 as default
  5. run /sbin/vboxconfig
  6. run VBox 6.1