我将我的主文件夹移到了一台新笔记本电脑上。之前我使用的是 Ubuntu 18.04,而在新笔记本电脑上我使用的是 Kubuntu 19.04。
我将所有相关文件夹复制到我的新系统,但 vagrant 无法在新系统上启动旧容器:
vagrant up trusty64
Bringing machine 'trusty64' up with 'virtualbox' provider...
==> trusty64: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 94 of file VBoxManageHostonly.cpp
这是我的 Vagrantfile:
#!/usr/bin/env ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.define "trusty64" do |node|
node.vm.box = "ubuntu/trusty64"
node.vm.hostname = "blimus"
node.vm.network "private_network", ip: "192.168.33.22", netmask: "255.255.255.0", mac: "08002786814f" # set mac for ruben VM 14.04
node.vm.provision :shell, path: "bootstrap.sh", args: "trusty"
end
config.vm.box_check_update = false
end
问题似乎是 VirtualBox 服务没有运行:
$ service virtualbox status
● virtualbox.service - LSB: VirtualBox Linux kernel module
Loaded: loaded (/etc/init.d/virtualbox; generated)
Active: failed (Result: exit-code) since Tue 2019-07-30 20:12:55 CEST; 3h 35min ago
Docs: man:systemd-sysv-generator(8)
Jul 30 20:12:54 einstein systemd[1]: Starting LSB: VirtualBox Linux kernel module...
Jul 30 20:12:54 einstein virtualbox[1209]: * Loading VirtualBox kernel modules...
Jul 30 20:12:55 einstein virtualbox[1209]: * modprobe vboxnetflt failed. Please use 'dmesg' to find out why
Jul 30 20:12:55 einstein virtualbox[1209]: ...fail!
Jul 30 20:12:55 einstein systemd[1]: virtualbox.service: Control process exited, code=exited, status=1/FAILURE
Jul 30 20:12:55 einstein systemd[1]: virtualbox.service: Failed with result 'exit-code'.
Jul 30 20:12:55 einstein systemd[1]: Failed to start LSB: VirtualBox Linux kernel module.
$ sudo modprobe vboxnetflt
modprobe: ERROR: could not insert 'vboxnetflt': Operation not permitted
$ dmesg|grep vbox
[ 10.008780] vboxdrv: loading out-of-tree module taints kernel.
[ 10.016866] vboxdrv: Found 8 processor cores
[ 10.036574] vboxdrv: TSC mode is Invariant, tentative frequency 1799999896 Hz
[ 10.036576] vboxdrv: Successfully loaded version 6.0.6_Ubuntu (interface 0x00290008)
答案1
就我的情况来说,virtualbox-dkms
安装失败了。我的解决方法是:
apt purge virtualbox-dkms && apt install virtualbox-dkms
重新安装时选择密码并重启系统。系统会要求您再次输入 MOK,选择这样做并选择第一个密钥,输入您的密码并重启。
现在:
$ dmesg |grep vboxdrv
vboxdrv: Found 8 processor cores
vboxdrv: TSC mode is Invariant, tentative frequency 1799998716 Hz
vboxdrv: Successfully loaded version 6.0.6_Ubuntu (interface 0x00290008)
vboxdrv: 0000000000000000 VMMR0.r0
boxdrv: 0000000000000000 VBoxDDR0.r0
$ dmesg|grep 'UEFI:MokListRT '|grep -i ubuntu
Loaded UEFI:MokListRT cert 'kubuntu Secure Boot Module Signature key: ..............' linked to secondary sys keyring
$ service virtualbox status
● virtualbox.service - LSB: VirtualBox Linux kernel module
Loaded: loaded (/etc/init.d/virtualbox; generated)
Active: active