为虚拟机模块(vboxdrv,vboxnetflt,vboxnetadp,vboxpci)签名Centos 8 [已关闭]

c9x0cxw0  于 2022-11-07  发布在  其他
关注(0)|答案(3)|浏览(93)

**已关闭。**此问题不符合Stack Overflow guidelines。当前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site相关,您可以留下评论,说明在何处可以找到此问题的答案。
去年关闭了。
机构群体在10个月前审查了是否重新讨论此问题,并将其关闭:
原始关闭原因未解决
Improve this question
我最近开始使用Centos 8,并安装了VirtualBox来管理我的虚拟机,我遇到的问题是VirtualBox无法 Boot 任何虚拟机,它告诉我以root身份执行此脚本/sbin/vboxconfig,当我运行此脚本时,出现以下消息:

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: You must sign these kernel modules before using VirtualBox:
  vboxdrv vboxnetflt vboxnetadp vboxpci
See the documenatation for your Linux distribution..
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.  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.

注意我的安全 Boot 是启用的。我的问题是如何在Centos 8中对这些内核模块进行签名?

siv3szwd

siv3szwd1#

经过一番研究,我找到了解决办法。
解决方案一:禁用安全 Boot 。
解决方案二:
1-安装mokutil软件包

sudo dnf update
sudo dnf install mokutil

2-在新文件夹下创建RSA密钥。

sudo -i
mkdir /root/signed-modules
cd /root/signed-modules
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox/"
chmod 600 MOK.priv

3-此命令将要求您添加一个密码,您在下次重新启动后需要此密码。

sudo mokutil --import MOK.der

4-重新启动您的系统,出现蓝屏,选择注册MOK --〉继续--〉输入以前的密码,您的系统将启动。
5-将前面的命令放在脚本中,以便稍后运行(系统更新后)

cd /root/signed-modules
vi sign-virtual-box

将以下cmd添加到此脚本:


# !/bin/bash

for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko; do
  echo "Signing $modfile"
  /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 \
                                /root/signed-modules/MOK.priv \
                                /root/signed-modules/MOK.der "$modfile"
done

如果上述操作失败,请使用下面的方法查找签名文件并相应地编辑脚本。

find /usr/src -name sign-file

5-添加exec权限并运行脚本

chmod 700 sign-virtual-box
./sign-virtual-box

6-启动虚拟盒

modprobe vboxdrv

欲了解更多信息,请查看此链接(适用于ubuntu用户)https://stegard.net/2016/10/virtualbox-secure-boot-ubuntu-fail/

drnojrws

drnojrws2#

我遵循@Younes LAB给出的solution,但我需要更改sign-virtual-box脚本中的sign-file路径,以便它正常工作:


# !/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/signed-modules/MOK.priv \
                                /root/signed-modules/MOK.der "$modfile"
done

我使用的是Ubuntu 20.04.2 LTS和VirtualBox 6.1

umuewwlo

umuewwlo3#

我从virtualbox 6. 0升级到6. 1,vboxconfig运行时没有错误(或者需要对内核模块进行签名)。

相关问题