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

Hom*_*lli 68 virtualbox lubuntu bios

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

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

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

我已按照这两个问题的答案部分中给出的所有说明进行操作 - 然而,问题仍未解决。

这是控制台输出,当我尝试运行 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.
Run Code Online (Sandbox Code Playgroud)

这是我/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.
Run Code Online (Sandbox Code Playgroud)

这是输出的尾端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
Run Code Online (Sandbox Code Playgroud)

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

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

很多人都有这个问题——即使是几年前。很奇怪,似乎没有人有解决方案 - ???

You*_*Git 85

VirtualBox + 安全启动 + Ubuntu = 失败

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

Dell Latitude E7440 上的 Ubuntu 16.04,BIOS A18,双引导 Windows 10 安装。

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

还有一个相关的 Ask Ubuntu 问题: Could not load 'vboxdrv' after upgrade to Ubuntu 16.04 (and I want to keep secure boot)

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

  1. 安装虚拟机包。如果安装检测到安全启动已启用,您将看到手头的问题并提供禁用安全启动的选项。选择“否”。

  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
    
    Run Code Online (Sandbox Code Playgroud)
  3. 使用 MOK(“机器所有者密钥”)实用程序导入公钥,以便系统信任它。这是一个两步过程,首先导入密钥,然后在下次启动机器时必须注册。一个简单的密码就足够了,因为它仅供临时使用。

    # mokutil --import /root/module-signing/MOK.der
    input password:
    input password again:
    
    Run Code Online (Sandbox Code Playgroud)
  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
    
    Run Code Online (Sandbox Code Playgroud)

    进而:

    # chmod 700 /root/module-signing/sign-vbox-modules
    
    Run Code Online (Sandbox Code Playgroud)
  6. 以 root 身份运行第 5 步中的脚本。每次安装新的内核更新时,您都需要运行签名脚本,因为这将导致第三方 VirtualBox 模块的重建。仅在新内核启动后才使用该脚本,因为它依赖 modinfo -nuname -r指示要签名的内核版本。

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

    # modprobe vboxdrv
    
    Run Code Online (Sandbox Code Playgroud)

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

注意:以上答案完全来自 Øyvind Stegard 的博客文章VirtualBox + Secure Boot + Ubuntu = fail

  • 关于 18.04+ 的注意事项:建议的 grep 应为:`dmesg|grep 'EFI:'` 而不是 `dmesg|grep 'EFI: Loaded cert'` (7认同)
  • 绝对不知道和理解这是做什么的,但它有效。 (4认同)

小智 20

上面的答案可能工作正常,但如果您想要更轻松的时间:

我能够解决它

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

我的虚拟机现在完美运行。

  • 你有什么理由不想这样做吗? (3认同)