Trouble in signing virtualbox modules in Fedora

Hi all,

I have virtualbox installed in Fedora 39, and I’m trying hard to sign the virtualbox modules, which is a requirement if secure boot is enabled. I checked a stackoverflow response to do this.

It has 2 steps: add the key using mokutil, and sign the modules.
I have completed the first part (enrolled the MOK.der file, rebooted the system and entered the passphrase to enroll the key). But I couldn’t sign the modules.

The stackoverflow response that I followed:

The code enclosed within the response:

#!/bin/bash

# Store the module directory in a variable
module_dir=$(dirname $(modinfo -n vboxdrv))

# Iterate over the module files directly
for modfile in "$module_dir"/*.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

I am using Fedora 39 with Linux Kernel 6.5 (Linux 6.5.12-300.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 20 22:44:24 UTC 2023 x86_64 GNU/Linux)

Could someone help me with signing the modules?