SecureBootが有効になっているDebianで署名されたVirtualBoxカーネルモジュールをロードできないのはなぜですか?

SecureBootが有効になっているDebianで署名されたVirtualBoxカーネルモジュールをロードできないのはなぜですか?

DebianテストとSecureBootを有効にした後:

vboxconfigコマンド出力に示すように、VirtualBoxモジュールに署名する必要があります。

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: You must sign these kernel modules before using VirtualBox:
  vboxdrv vboxnetflt vboxnetadp
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.

フォローするSecureBootに関するDebian Wiki私はそうしました:

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

# mokutil --import MOK.der // prompts for one-time password

# mokutil --list-new // recheck your key will be prompted on next boot

<rebooting machine then enters MOK manager EFI utility: enroll MOK, continue, confirm, enter password, reboot>

# dmesg | grep cert // verify your key is loaded

モジュールに署名します。

# /usr/src/linux-headers-5.7.0-1-amd64/scripts/sign-file sha256 /root/MOK.priv /root/MOK.der /lib/modules/5.7.0-1-amd64/misc/vboxdrv.ko

# /usr/src/linux-headers-5.7.0-1-amd64/scripts/sign-file sha256 /root/MOK.priv /root/MOK.der /lib/modules/5.7.0-1-amd64/misc/vboxnetflt.ko

# /usr/src/linux-headers-5.7.0-1-amd64/scripts/sign-file sha256 /root/MOK.priv /root/MOK.der /lib/modules/5.7.0-1-amd64/misc/vboxnetadp.ko

注:モジュールが見つからないvboxpciため、モジュールに署名しませんでした。sudo modinfo -n vboxpci

modinfo: ERROR: Module vboxpci not found.

vboxconfig後でrootとして再実行しようとすると、モジュールをロードできないため、同じ結果が得られます。

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: You must sign these kernel modules before using VirtualBox:
  vboxdrv vboxnetflt vboxnetadp
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.

注:モジュールを直接ロードしようとすると、sudo modprobe vboxdrv次のエラーも発生します。

modprobe: ERROR: could not insert 'vboxdrv': Operation not permitted

このコマンドは、dmesgモジュールが署名されていないことを示します。

[   35.668028] Lockdown: modprobe: unsigned module loading is restricted; see https://wiki.debian.org/SecureBoot
[   59.965757] Lockdown: modprobe: unsigned module loading is restricted; see https://wiki.debian.org/SecureBoot
[  247.249605] Lockdown: modprobe: unsigned module loading is restricted; see https://wiki.debian.org/SecureBoot

どうですか? ? ? SecureBootを無効にしませんか?

ベストアンサー1

同じ手順に従い、同じ問題が発生しましたが、なぜ動作しないのかわかりませんでした。その後、カーネルモジュールの再構築をトリガーしながらモジュールに署名した後、vboxconfigを再実行するのに問題があることに気づきました。 "vboxdrv.sh: Building VirtualBox カーネルモジュール。"

この時点で私はモジュールに署名し、modprobeを使ってロードしましたが、問題なくロードされました。

心配しないでください。 vboxconfigを初めて実行した後、毎回手動でモジュールをロードする必要はありません。 vboxconfigはすでに設定を完了して再起動するだけです(少なくとも私にはうまくいきました)。

おすすめ記事