虚拟机安装在ubuntu 18.04.4上失败

时间:2020-06-28 18:22:39

标签: linux-kernel ubuntu-18.04 docker-machine vbox

我试图在Ubuntu 18.04.4 LTS(GNU / Linux 4.15.0 x86_64)上创建docker机器 使用以下命令:

docker-machine create test.com
Running pre-create checks...
Error with pre-create check: "We support Virtualbox starting with version 5. Your VirtualBox install is \"WARNING: The vboxdrv kernel module is not loaded. Either there is no module\\n         available for the current kernel (4.15.0) or it failed to\\n         load. Please recompile the kernel module and install it by\\n\\n           sudo /sbin/vboxconfig\\n\\n         You will not be able to start VMs until this problem is fixed.\\n6.1.10r138449\". Please upgrade at https://www.virtualbox.org"

经过数小时的研究,我找到了一些尝试过的解决方案。综上所述,我尝试安装vbox:

sudo wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - \
&& wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - \
&& add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" \
&& apt install linux-headers-$(uname -r) dkms \
&& apt update -y && sudo apt install virtualbox-6.1 -y


ubuntu@ubuntu01:~# sudo vboxmanage -v
6.1.10r138449

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

There were problems setting up VirtualBox.  To re-start the set-up process, run
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.

内核标头都是最新的。不幸的是我仍然有同样的问题。之后,我尝试通过EFI安全启动对内核模块进行签名。

openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Descriptive common name/"

sudo /usr/src/linux-headers-4.15.0-88-generic/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)

OUTPUT:
modinfo: ERROR: Module vboxdrv not found.

sudo modprobe vboxdrv
modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.15.0

有人知道如何解决此问题吗?感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

尝试此解决方案,在我的VM中为我工作,使用ubuntu 18.04和Virtualbox 6.0.14

sudo apt install virtualbox-dkms