vboxdrv.sh:失败:modprobe vboxdrv失败。 请使用’dmesg’找出原因

我在Ubuntu笔记本电脑上运行VirtualBox时遇到问题。 我的笔记本电脑是双启动和运行(Windows 10 – 我认为,多年来没有使用它),以及Ubuntu 16.0.4 LTS。

我在笔记本电脑的BIOS设置上启用了安全启动。

我知道这里有类似的问题,特别是这两个:

  • 在Ubuntu 16.04上安装Virtualbox 5.1失败
  • VirtualBox安装提供消息“modprobe vboxdrv”失败

我已经按照答案部分中给出的所有说明来解决这两个问题 – 然而,问题仍然没有得到解决。

当我尝试运行virtualbox时,这是控制台输出:

me@YOURBOX:~$ virtualbox WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (4.4.0-47-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. 

这是我按照建议运行/sbin/vboxconfig时的控制台输出:

 me@YOURBOX:~$ sudo /sbin/vboxconfig vboxdrv.sh: Stopping VirtualBox services. vboxdrv.sh: Building VirtualBox kernel modules. vboxdrv.sh: Starting VirtualBox services. vboxdrv.sh: Building VirtualBox kernel modules. vboxdrv.sh: failed: modprobe vboxdrv failed. Please use 'dmesg' to find out why. There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root. 

这是dmesg输出的尾端:

 [ 44.319682] audit: type=1400 audit(1491313982.374:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/evince-previewer" pid=705 comm="apparmor_parser" [ 45.041433] cgroup: new mount options do not match the existing superblock, will be ignored [ 59.682936] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready [ 59.697820] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready [ 59.702008] IPv6: ADDRCONF(NETDEV_UP): enp2s0f0: link is not ready [ 60.267000] IPv6: ADDRCONF(NETDEV_UP): enp2s0f0: link is not ready [ 62.473044] IPv6: ADDRCONF(NETDEV_UP): wlp3s0: link is not ready [ 70.681706] audit_printk_skb: 60 callbacks suppressed [ 70.681709] audit: type=1400 audit(1491314008.734:32): apparmor="STATUS" operation="profile_load" profile="unconfined" name="docker-default" pid=2009 comm="apparmor_parser" [ 70.850936] aufs 4.x-rcN-20160111 [ 75.407218] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this. [ 75.408555] Bridge firewalling registered [ 75.427172] nf_conntrack version 0.5.0 (16384 buckets, 65536 max) [ 75.848416] ip_tables: (C) 2000-2006 Netfilter Core Team [ 76.703232] Initializing XFRM netlink socket [ 77.060003] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready [ 80.101042] aufs au_opts_verify:1597:dockerd[1402]: dirperm1 breaks the protection by the permission bits on the lower branch [ 113.895236] wlp3s0: authenticate with 84:16:f9:77:e1:54 [ 113.910483] wlp3s0: send auth to 84:16:f9:77:e1:54 (try 1/3) [ 113.912712] wlp3s0: authenticated [ 113.915101] wlp3s0: associate with 84:16:f9:77:e1:54 (try 1/3) [ 113.919397] wlp3s0: RX AssocResp from 84:16:f9:77:e1:54 (capab=0x1411 status=0 aid=1) [ 113.919516] wlp3s0: associated [ 113.919559] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready 

现在,我不会撒谎 – 我完全不知道 dmesg刚刚喷出的东西 – 据我所知,日志输出中没有错误消息 – 这使情况更加令人愤怒。

有没有人在运行Ubuntu 16.0.4 LTS的笔记本电脑上安装VirtualBox 5.x – 但是在BIOS上启用了安全启动 ? – 如果是,那么解决方案是什么。 ???!

很多人都有这个问题 – 甚至几年前也会如此。 很奇怪,没有人似乎有解决方案 – ???

VirtualBox +安全启动+ Ubuntu =失败

问题是要求所有内核模块必须由UEFI系统信任的密钥签名,否则加载将失败。 Ubuntu不签署第三方vbox *内核模块,而是在安装virtualbox软件包时为用户提供禁用安全启动的选项。 我可以这样做,但是每次机器启动时我都会看到一个恼人的“在不安全模式下启动”消息,而且我所拥有的双启动Windows 10安装也无法正常工作。

戴尔Latitude E7440上的Ubuntu 16.04,带有BIOS A18,并且安装了双启动Windows 10。

信用是我用来解决这个问题的主要信息来源,特别适用于Fedora / Redhat: http : //gorka.eguileor.com/vbox-vmware-in-secureboot-linux-2016-update/

和相关的Ask Ubuntu问题: 升级到Ubuntu 16.04后无法加载’vboxdrv’(我想保持安全启动)

使其工作的步骤,特别是对于Ubuntu / Debian

  1. 安装virtualbox包。 如果安装程序检测到启用了安全启动,则会出现问题并提供禁用安全启动的选项。 选择“否”。

  2. 创建将用于签署内核模块的个人公共/私有RSA密钥对。 我选择使用root帐户和目录/ root / module-signing /来存储与签名内核模块相关的所有内容。

     $ sudo -i # mkdir /root/module-signing # cd /root/module-signing # openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=YOUR_NAME/" [...] # chmod 600 MOK.priv 
  3. 使用MOK(“机器所有者密钥”)实用程序导入公钥,以便系统可以信任它。 这是一个两步过程,首先导入密钥,然后必须在下次启动机器时注册。 一个简单的密码足够好,因为它只是临时使用。

     # mokutil --import /root/module-signing/MOK.der input password: input password again: 
  4. 重新启动机器。 引导加载程序启动时,MOK管理器EFI实用程序应自动启动。 它将询问步骤3中提供的部分密码。选择“注册MOK”,然后您应该看到在步骤3中导入的密钥。完成注册步骤,然后继续引导。 Linux内核将记录加载的密钥,您应该能够使用以下命令查看自己的密钥: dmesg|grep 'EFI: Loaded cert'

  5. 使用带有内核构建文件的签名实用程序,使用在步骤2中生成的私有MOK密钥对所有VirtualBox模块进行签名。我将它放在一个小脚本/root/module-signing/sign-vbox-modules ,因此它可以是当新内核作为常规更新的一部分安装时,可以轻松运行:

     #!/bin/bash for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko; do echo "Signing $modfile" /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 \ /root/module-signing/MOK.priv \ /root/module-signing/MOK.der "$modfile" done 

    然后:

     # chmod 700 /root/module-signing/sign-vbox-modules 
  6. 以root身份运行步骤5中的脚本。 每次安装新的内核更新时,您都需要运行签名脚本,因为这将导致重建第三方VirtualBox模块。 仅在引导新内核后使用该脚本,因为它依赖于modinfo -nuname -r来告知要签署的内核版本。

  7. 加载vboxdrv模块并启动VirtualBox:

     # modprobe vboxdrv 

如果需要,该过程还可用于签署其他第三方内核模块,如nvidia图形驱动程序。 (我自己没有测试过。)

注意:上述答案完全来自ØyvindStegard的博文, VirtualBox + Secure Boot + Ubuntu = fail 。

上面的答案可能工作正常,但如果你想要一个更容易的时间:

我能够解决它

启动进入BIOS并进入>高级(f7)>启动>向下滚动到“安全启动”>将“Windows EUFI模式”更改为“其他操作系统”

我的虚拟盒现在运行得很好。