1. 程式人生 > >ubuntu 18.04安裝virtualbox 後啟動沒反應

ubuntu 18.04安裝virtualbox 後啟動沒反應

1. ubuntu 18.04

安裝了virtualbox 對應的ubuntu18.04 amd64以後,啟動virtualbox沒反應,一閃而過,就是啟動不起來

2. 直接命令列啟動

找到命令 cd /usr/bin
啟動 /usr/bin$ ./VirtualBox

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (4.15.0-33-generic) or it failed to
         load. Please recompile the kernel module
and install it by sudo /sbin/vboxconfig You will not be able to start VMs until this problem is fixed. VirtualBox: Error -10 in SUPR3HardenedMain! VirtualBox: Effective UID is not root (euid=1000 egid=1000 uid=1000 gid=1000) VirtualBox: Tip! It may help to reinstall VirtualBox.

然後執行$ sudo /sbin/vboxconfig

,仍然不好使,繼續無情的報錯

sudo: /sbin/vboxconfig: command not found

3. 修復

之後居然鬼使神差的想要檢視軟體版本號。想著安一個檢視版本的工具/usr/bin$ sudo apt-get install apt-show-versions,結果出現如下:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies: virtualbox-5.2 : Depends: libcurl4 (>= 7.16.2) but it is not going to be installed Depends: libqt5opengl5 (>= 5.0.2) but it is not going to be installed Depends: libqt5printsupport5 (>= 5.0.2) but it is not going to be installed Depends: libqt5x11extras5 (>= 5.6.0) but it is not going to be installed Depends: libsdl1.2debian (>= 1.2.11) but it is not going to be installed Recommends: libsdl-ttf2.0-0 but it is not going to be installed Recommends: gcc but it is not going to be installed Recommends: make or build-essential but it is not going to be installed or dpkg-dev but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

既然如此,那就老實的執行/usr/bin$ sudo apt --fix-broken install
然後出現一大堆東西,最後

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.

之後以root身份執行

/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 gcc make perl packages from your distribution.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.

There were problems setting up VirtualBox.  To re-start the set-up process, run
  /sbin/vboxconfig
as root.

到這以後,在從win鍵裡邊就可以啟動virtualbox了,不知道您的問題解決了沒

問題還是沒解決,可能你能打開了virtualbox,但是你仍然不能安裝虛擬機器

怎麼辦??

又見到一高人,他和我報的錯是一樣的:

this system is currently not set up to build kernel modules. 
Please install the gcc make perl packages from your distribution. 
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: 

報錯的原因是沒有安裝核心標頭檔案,因此,我們首先安裝核心標頭檔案。
先看下核心版本號
uname -r

我的是:4.15.0-33-generic
安裝核心標頭檔案,命令:
apt-get install build-essential linux-headers-核心版本號
也就是apt-get install build-essential linux-headers-4.15.0-33-generic
會安裝一些程式,安裝完,重啟一下,就沒問題了